about summary refs log tree commit diff
path: root/nis/nss_nisplus
diff options
context:
space:
mode:
Diffstat (limited to 'nis/nss_nisplus')
-rw-r--r--nis/nss_nisplus/nisplus-grp.c2
-rw-r--r--nis/nss_nisplus/nisplus-parser.c6
-rw-r--r--nis/nss_nisplus/nisplus-publickey.c16
-rw-r--r--nis/nss_nisplus/nisplus-pwd.c2
4 files changed, 15 insertions, 11 deletions
diff --git a/nis/nss_nisplus/nisplus-grp.c b/nis/nss_nisplus/nisplus-grp.c
index 7cdf21553b..84bc6746a5 100644
--- a/nis/nss_nisplus/nisplus-grp.c
+++ b/nis/nss_nisplus/nisplus-grp.c
@@ -227,7 +227,7 @@ _nss_nisplus_getgrgid_r (const gid_t gid, struct group *gr,
     nis_result *result;
     char buf[36 + tablename_len];
 
-    sprintf (buf, "[gid=%d],%s", gid, tablename_val);
+    sprintf (buf, "[gid=%lu],%s", (unsigned long int) gid, tablename_val);
 
     result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
 
diff --git a/nis/nss_nisplus/nisplus-parser.c b/nis/nss_nisplus/nisplus-parser.c
index ce121ec22b..f160338cee 100644
--- a/nis/nss_nisplus/nisplus-parser.c
+++ b/nis/nss_nisplus/nisplus-parser.c
@@ -89,7 +89,7 @@ _nss_nisplus_parse_pwent (nis_result *result, struct passwd *pw,
   len = strlen (first_unused);
   if (len == 0) /* If we don't have a uid, it's an invalid shadow entry */
     return 0;
-  pw->pw_uid = atoi (first_unused);
+  pw->pw_uid = strtoul (first_unused, NULL, 10);
   room_left -= (len + 1);
   first_unused += (len + 1);
 
@@ -102,7 +102,7 @@ _nss_nisplus_parse_pwent (nis_result *result, struct passwd *pw,
   len = strlen (first_unused);
   if (len == 0) /* If we don't have a gid, it's an invalid shadow entry */
     return 0;
-  pw->pw_gid = atoi (first_unused);
+  pw->pw_gid = strtoul (first_unused, NULL, 10);
   room_left -= (len + 1);
   first_unused += (len + 1);
 
@@ -200,7 +200,7 @@ _nss_nisplus_parse_grent (nis_result *result, u_long entry, struct group *gr,
   len = strlen (first_unused);
   if (len == 0) /* We should always have an gid */
     return 0;
-  gr->gr_gid = atoi (first_unused);
+  gr->gr_gid = strtoul (first_unused, NULL, 10);
   room_left -= (strlen (first_unused) + 1);
   first_unused += strlen (first_unused) + 1;
 
diff --git a/nis/nss_nisplus/nisplus-publickey.c b/nis/nss_nisplus/nisplus-publickey.c
index 1be6139977..ec1290a683 100644
--- a/nis/nss_nisplus/nisplus-publickey.c
+++ b/nis/nss_nisplus/nisplus-publickey.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997, 1999 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1999, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
 
@@ -200,6 +200,7 @@ static enum nss_status
 parse_grp_str (const char *s, gid_t *gidp, int *gidlenp, gid_t *gidlist,
 	       int *errnop)
 {
+  char *ep;
   int gidlen;
 
   if (!s || (!isdigit (*s)))
@@ -208,14 +209,17 @@ parse_grp_str (const char *s, gid_t *gidp, int *gidlenp, gid_t *gidlist,
       return NSS_STATUS_NOTFOUND;
     }
 
-  *gidp = atoi (s);
+  *gidp = strtoul (s, &ep, 10);
 
   gidlen = 0;
 
-  while ((s = strchr (s, ',')) != NULL)
+  /* After strtoul() ep should point to the marker ',', which means
+     here starts a new value. */
+  while (ep != NULL && *ep == ',')
     {
-      s++;
-      gidlist[gidlen++] = atoi (s);
+      ep++;
+      s = ep;
+      gidlist[gidlen++] = strtoul (s, &ep, 10);
     }
   *gidlenp = gidlen;
 
@@ -368,7 +372,7 @@ _nss_nisplus_netname2user (char netname[MAXNETNAMELEN + 1], uid_t *uidp,
 	    _("netname2user: LOCAL entry for %s in directory %s not unique"),
 	    netname, domain);
   /* Fetch the uid */
-  *uidp = atoi (ENTRY_VAL (res->objects.objects_val, 2));
+  *uidp = strtoul (ENTRY_VAL (res->objects.objects_val, 2), NULL, 10);
 
   if (*uidp == 0)
     {
diff --git a/nis/nss_nisplus/nisplus-pwd.c b/nis/nss_nisplus/nisplus-pwd.c
index c387f8e4f8..f7bc8321bd 100644
--- a/nis/nss_nisplus/nisplus-pwd.c
+++ b/nis/nss_nisplus/nisplus-pwd.c
@@ -235,7 +235,7 @@ _nss_nisplus_getpwuid_r (const uid_t uid, struct passwd *pw,
     nis_result *result;
     char buf[100 + tablename_len];
 
-    sprintf (buf, "[uid=%d],%s", uid, tablename_val);
+    sprintf (buf, "[uid=%lu],%s", (unsigned long int) uid, tablename_val);
 
     result = nis_list(buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);