mirror of
https://github.com/samba-team/samba.git
synced 2025-01-13 13:18:06 +03:00
Ensure numeric group or user names don't get misinterpreted.
Jeremy.
This commit is contained in:
parent
e94957d548
commit
e88da9dcc7
@ -1053,13 +1053,15 @@ uid_t nametouid(char *name)
|
||||
uid_t u;
|
||||
|
||||
u = (uid_t)strtol(name, &p, 0);
|
||||
if (p != name) return u;
|
||||
if ((p != name) && (*p == '\0'))
|
||||
return u;
|
||||
|
||||
if (winbind_nametouid(&u, name))
|
||||
return u;
|
||||
|
||||
pass = sys_getpwnam(name);
|
||||
if (pass) return(pass->pw_uid);
|
||||
if (pass)
|
||||
return(pass->pw_uid);
|
||||
return (uid_t)-1;
|
||||
}
|
||||
|
||||
@ -1075,13 +1077,15 @@ gid_t nametogid(char *name)
|
||||
gid_t g;
|
||||
|
||||
g = (gid_t)strtol(name, &p, 0);
|
||||
if (p != name) return g;
|
||||
if ((p != name) && (*p == '\0'))
|
||||
return g;
|
||||
|
||||
if (winbind_nametogid(&g, name))
|
||||
return g;
|
||||
|
||||
grp = getgrnam(name);
|
||||
if (grp) return(grp->gr_gid);
|
||||
if (grp)
|
||||
return(grp->gr_gid);
|
||||
return (gid_t)-1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user