]> TLD Linux GIT Repositories - packages/shadow.git/blob - shadow-goodname.patch
- from PLD
[packages/shadow.git] / shadow-goodname.patch
1 diff -up shadow-4.1.5.1/libmisc/chkname.c.goodname shadow-4.1.5.1/libmisc/chkname.c
2 --- shadow-4.1.5.1/libmisc/chkname.c.goodname   2009-07-13 00:24:45.000000000 +0200
3 +++ shadow-4.1.5.1/libmisc/chkname.c    2012-09-19 18:43:53.492160653 +0200
4 @@ -49,20 +49,28 @@
5  static bool is_valid_name (const char *name)
6  {
7         /*
8 -        * User/group names must match [a-z_][a-z0-9_-]*[$]
9 -        */
10 -       if (('\0' == *name) ||
11 -           !((('a' <= *name) && ('z' >= *name)) || ('_' == *name))) {
12 +         * User/group names must match gnu e-regex:
13 +         *    [a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,30}[a-zA-Z0-9_.$-]?
14 +         *
15 +         * as a non-POSIX, extension, allow "$" as the last char for
16 +         * sake of Samba 3.x "add machine script"
17 +         */
18 +       if ( ('\0' == *name) ||
19 +             !((*name >= 'a' && *name <= 'z') ||
20 +               (*name >= 'A' && *name <= 'Z') ||
21 +               (*name >= '0' && *name <= '9') ||
22 +               (*name == '_') || (*name == '.') 
23 +             )) {
24                 return false;
25         }
26  
27         while ('\0' != *++name) {
28 -               if (!(( ('a' <= *name) && ('z' >= *name) ) ||
29 -                     ( ('0' <= *name) && ('9' >= *name) ) ||
30 -                     ('_' == *name) ||
31 -                     ('-' == *name) ||
32 -                     ( ('$' == *name) && ('\0' == *(name + 1)) )
33 -                    )) {
34 +                if (!(  (*name >= 'a' && *name <= 'z') ||
35 +                        (*name >= 'A' && *name <= 'Z') ||
36 +                        (*name >= '0' && *name <= '9') ||
37 +                        (*name == '_') || (*name == '.') || (*name == '-') ||
38 +                        (*name == '$' && *(name + 1) == '\0') 
39 +                     )) {
40                         return false;
41                 }
42         }
43 diff -up shadow-4.1.5.1/man/groupadd.8.xml.goodname shadow-4.1.5.1/man/groupadd.8.xml
44 --- shadow-4.1.5.1/man/groupadd.8.xml.goodname  2012-05-25 13:45:27.000000000 +0200
45 +++ shadow-4.1.5.1/man/groupadd.8.xml   2012-09-19 18:43:53.492160653 +0200
46 @@ -259,12 +259,6 @@
47     <refsect1 id='caveats'>
48       <title>CAVEATS</title>
49       <para>
50 -       Groupnames must start with a lower case letter or an underscore,
51 -       followed by lower case letters, digits, underscores, or dashes.
52 -       They can end with a dollar sign.
53 -       In regular expression terms: [a-z_][a-z0-9_-]*[$]?
54 -     </para>
55 -     <para>
56         Groupnames may only be up to &GROUP_NAME_MAX_LENGTH; characters long.
57       </para>
58       <para>
59 diff -up shadow-4.1.5.1/man/man8/groupadd.8.goodname shadow-4.1.5.1/man/man8/groupadd.8
60 --- shadow-4.1.5.1/man/man8/groupadd.8.goodname 2012-05-25 13:58:40.000000000 +0200
61 +++ shadow-4.1.5.1/man/man8/groupadd.8  2012-09-19 18:44:42.175123079 +0200
62 @@ -190,9 +190,7 @@ Shadow password suite configuration\&.
63  .RE
64  .SH "CAVEATS"
65  .PP
66 -Groupnames must start with a lower case letter or an underscore, followed by lower case letters, digits, underscores, or dashes\&. They can end with a dollar sign\&. In regular expression terms: [a\-z_][a\-z0\-9_\-]*[$]?
67 -.PP
68 -Groupnames may only be up to 16 characters long\&.
69 +Groupnames may only be up to 32 characters long\&.
70  .PP
71  You may not add a NIS or LDAP group\&. This must be performed on the corresponding server\&.
72  .PP
73 diff -up shadow-4.1.5.1/man/man8/useradd.8.goodname shadow-4.1.5.1/man/man8/useradd.8
74 --- shadow-4.1.5.1/man/man8/useradd.8.goodname  2012-05-25 13:59:28.000000000 +0200
75 +++ shadow-4.1.5.1/man/man8/useradd.8   2012-09-19 18:46:09.249033949 +0200
76 @@ -224,7 +224,7 @@ is not enabled, no home directories are
77  .PP
78  \fB\-M\fR
79  .RS 4
80 -Do no create the user\*(Aqs home directory, even if the system wide setting from
81 +Do not create the user\*(Aqs home directory, even if the system wide setting from
82  /etc/login\&.defs
83  (\fBCREATE_HOME\fR) is set to
84  \fIyes\fR\&.
85 @@ -430,8 +430,6 @@ Similarly, if the username already exist
86  \fBuseradd\fR
87  will deny the user account creation request\&.
88  .PP
89 -Usernames must start with a lower case letter or an underscore, followed by lower case letters, digits, underscores, or dashes\&. They can end with a dollar sign\&. In regular expression terms: [a\-z_][a\-z0\-9_\-]*[$]?
90 -.PP
91  Usernames may only be up to 32 characters long\&.
92  .SH "CONFIGURATION"
93  .PP
94 diff -up shadow-4.1.5.1/man/useradd.8.xml.goodname shadow-4.1.5.1/man/useradd.8.xml
95 --- shadow-4.1.5.1/man/useradd.8.xml.goodname   2012-05-25 13:45:29.000000000 +0200
96 +++ shadow-4.1.5.1/man/useradd.8.xml    2012-09-19 18:43:53.493160675 +0200
97 @@ -366,7 +366,7 @@
98         </term>
99         <listitem>
100           <para>
101 -           Do no create the user's home directory, even if the system
102 +           Do not create the user's home directory, even if the system
103             wide setting from <filename>/etc/login.defs</filename>
104             (<option>CREATE_HOME</option>) is set to
105             <replaceable>yes</replaceable>.
106 @@ -654,12 +654,6 @@
107      </para>
108  
109      <para>
110 -      Usernames must start with a lower case letter or an underscore,
111 -      followed by lower case letters, digits, underscores, or dashes.
112 -      They can end with a dollar sign.
113 -      In regular expression terms: [a-z_][a-z0-9_-]*[$]?
114 -    </para>
115 -    <para>
116        Usernames may only be up to 32 characters long.
117      </para>
118    </refsect1>