summaryrefslogtreecommitdiff
path: root/source/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-06-25 21:29:33 +0000
committerJeremy Allison <jra@samba.org>2001-06-25 21:29:33 +0000
commite88da9dcc79801028127bcbe328af001b58e653a (patch)
tree22c4d234bf3f0c8d1cc6599b8429e831ae379a41 /source/lib
parente94957d548745649ce04423dc6f16bbe3dd4f869 (diff)
downloadsamba-e88da9dcc79801028127bcbe328af001b58e653a.tar.gz
Ensure numeric group or user names don't get misinterpreted.
Jeremy.
Diffstat (limited to 'source/lib')
-rw-r--r--source/lib/util.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/source/lib/util.c b/source/lib/util.c
index 37bb1693d8b..2e2c887b93f 100644
--- a/source/lib/util.c
+++ b/source/lib/util.c
@@ -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;
}