about summary refs log tree commit diff
path: root/nis/nss_nis
diff options
context:
space:
mode:
Diffstat (limited to 'nis/nss_nis')
-rw-r--r--nis/nss_nis/nis-grp.c2
-rw-r--r--nis/nss_nis/nis-publickey.c17
-rw-r--r--nis/nss_nis/nis-pwd.c2
3 files changed, 12 insertions, 9 deletions
diff --git a/nis/nss_nis/nis-grp.c b/nis/nss_nis/nis-grp.c
index 9b7531a68d..e85d68bdf7 100644
--- a/nis/nss_nis/nis-grp.c
+++ b/nis/nss_nis/nis-grp.c
@@ -227,7 +227,7 @@ _nss_nis_getgrgid_r (gid_t gid, struct group *grp,
   if (yp_get_default_domain (&domain))
     return NSS_STATUS_UNAVAIL;
 
-  nlen = sprintf (buf, "%d", gid);
+  nlen = sprintf (buf, "%lu", (unsigned long int) gid);
 
   retval = yperr2nss (yp_match (domain, "group.bygid", buf,
 				nlen, &result, &len));
diff --git a/nis/nss_nis/nis-publickey.c b/nis/nss_nis/nis-publickey.c
index ecdf80f66b..f686054426 100644
--- a/nis/nss_nis/nis-publickey.c
+++ b/nis/nss_nis/nis-publickey.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
 
@@ -143,7 +143,7 @@ static enum nss_status
 parse_netid_str (const char *s, uid_t *uidp, gid_t *gidp, int *gidlenp,
 		 gid_t *gidlist)
 {
-  char *p;
+  char *p, *ep;
   int gidlen;
 
   if (!s || !isdigit (*s))
@@ -153,7 +153,7 @@ parse_netid_str (const char *s, uid_t *uidp, gid_t *gidp, int *gidlenp,
     }
 
   /* Fetch the uid */
-  *uidp = (atoi (s));
+  *uidp = strtoul (s, NULL, 10);
 
   if (*uidp == 0)
     {
@@ -175,14 +175,17 @@ parse_netid_str (const char *s, uid_t *uidp, gid_t *gidp, int *gidlenp,
       return NSS_STATUS_NOTFOUND;
     }
 
-  *gidp = (atoi (p));
+  *gidp = strtoul (p, &ep, 10);
 
   gidlen = 0;
 
-  while ((p = strchr (p, ',')) != NULL)
+  /* After strtoul() ep should point to the first invalid character.
+     This is the marker "," we search for the next value.  */ 
+  while (ep != NULL && *ep == ',')
     {
-      p++;
-      gidlist[gidlen++] = atoi (p);
+      ep++;
+      p = ep;
+      gidlist[gidlen++] = strtoul (p, &ep, 10);
     }
 
   *gidlenp = gidlen;
diff --git a/nis/nss_nis/nis-pwd.c b/nis/nss_nis/nis-pwd.c
index c343d80def..4845fd1c75 100644
--- a/nis/nss_nis/nis-pwd.c
+++ b/nis/nss_nis/nis-pwd.c
@@ -329,7 +329,7 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
   if (yp_get_default_domain (&domain))
     return NSS_STATUS_UNAVAIL;
 
-  nlen = sprintf (buf, "%d", uid);
+  nlen = sprintf (buf, "%lu", (unsigned long int) uid);
 
   retval = yperr2nss (yp_match (domain, "passwd.byuid", buf,
 				nlen, &result, &len));