aboutsummaryrefslogtreecommitdiff
path: root/nss/getent.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-11-27 03:47:06 +0000
committerUlrich Drepper <drepper@redhat.com>2001-11-27 03:47:06 +0000
commit8e9b2075ba1d6ce2ab82c2eb2547e2c2ef3ecca8 (patch)
treede7fba86c989c6f7df1d6d7bac078813d0855fa3 /nss/getent.c
parentf4efd06825ba5fec62662be611d94335eff4f8f7 (diff)
downloadglibc-8e9b2075ba1d6ce2ab82c2eb2547e2c2ef3ecca8.tar
glibc-8e9b2075ba1d6ce2ab82c2eb2547e2c2ef3ecca8.tar.gz
glibc-8e9b2075ba1d6ce2ab82c2eb2547e2c2ef3ecca8.tar.bz2
glibc-8e9b2075ba1d6ce2ab82c2eb2547e2c2ef3ecca8.zip
Update.
2001-11-21 Bruno Haible <bruno@clisp.org> * charmaps/ISO-8859-16: Swap 0xa5 and 0xab entries.
Diffstat (limited to 'nss/getent.c')
-rw-r--r--nss/getent.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/nss/getent.c b/nss/getent.c
index 1ddd67ad23..7a755f8b1c 100644
--- a/nss/getent.c
+++ b/nss/getent.c
@@ -207,7 +207,15 @@ group_keys (int number, char *key[])
for (i = 0; i < number; ++i)
{
if (isdigit (key[i][0]))
- grp = getgrgid (atol (key[i]));
+ {
+ char *ep;
+ gid_t arg_gid = strtoul (key[i], &ep, 10);
+
+ if (*key[i] != '\0' && *ep == '\0') /* valid numeric uid */
+ grp = getgrgid (arg_gid);
+ else
+ grp = NULL;
+ }
else
grp = getgrnam (key[i]);
@@ -404,7 +412,15 @@ passwd_keys (int number, char *key[])
for (i = 0; i < number; ++i)
{
if (isdigit (key[i][0]))
- pwd = getpwuid (atol (key[i]));
+ {
+ char *ep;
+ uid_t arg_uid = strtoul (key[i], &ep, 10);
+
+ if (*key[i] != '\0' && *ep == '\0') /* valid numeric uid */
+ pwd = getpwuid (arg_uid);
+ else
+ pwd = NULL;
+ }
else
pwd = getpwnam (key[i]);