Lines 18-30
RCSID ("$Id: chkname.c,v 1.8 2003/05/12
Link Here
|
18 |
static int good_name (const char *name) |
18 |
static int good_name (const char *name) |
19 |
{ |
19 |
{ |
20 |
/* |
20 |
/* |
21 |
* User/group names must match [a-z_][a-z0-9_-]* |
21 |
* User/group names must match [A-Za-z_][A-Za-z0-9_-]* |
22 |
*/ |
22 |
*/ |
23 |
if (!*name || !((*name >= 'a' && *name <= 'z') || *name == '_')) |
23 |
if (!*name || !((*name >= 'a' && *name <= 'z') || (*name >= 'A' && *name <= 'Z') || *name == '_')) |
24 |
return 0; |
24 |
return 0; |
25 |
|
25 |
|
26 |
while (*++name) { |
26 |
while (*++name) { |
27 |
if (!((*name >= 'a' && *name <= 'z') || |
27 |
if (!((*name >= 'a' && *name <= 'z') || |
|
|
28 |
(*name >= 'A' && *name <= 'Z') || |
28 |
(*name >= '0' && *name <= '9') || |
29 |
(*name >= '0' && *name <= '9') || |
29 |
*name == '_' || *name == '-' || |
30 |
*name == '_' || *name == '-' || |
30 |
(*name == '$' && *(name + 1) == '\0'))) |
31 |
(*name == '$' && *(name + 1) == '\0'))) |