about summary refs log tree commit diff
path: root/nis
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2016-06-16 12:44:29 +0200
committerAndreas Schwab <schwab@suse.de>2016-06-30 13:55:36 +0200
commit73fb56a4d51fd4437e4cde6dd3c8077a610f88a8 (patch)
treea03c812f3c385ba07c9f1a4191face6df630e362 /nis
parent3631c9742a8740777e09d9e8f6f5e6cccaf7340c (diff)
downloadglibc-73fb56a4d51fd4437e4cde6dd3c8077a610f88a8.tar.gz
glibc-73fb56a4d51fd4437e4cde6dd3c8077a610f88a8.tar.xz
glibc-73fb56a4d51fd4437e4cde6dd3c8077a610f88a8.zip
Return proper status from _nss_nis_initgroups_dyn (bug 20262)
Diffstat (limited to 'nis')
-rw-r--r--nis/nss_nis/nis-initgroups.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/nis/nss_nis/nis-initgroups.c b/nis/nss_nis/nis-initgroups.c
index dec385cec7..0368667cf6 100644
--- a/nis/nss_nis/nis-initgroups.c
+++ b/nis/nss_nis/nis-initgroups.c
@@ -266,7 +266,7 @@ _nss_nis_initgroups_dyn (const char *user, gid_t group, long int *start,
 
   tmpbuf = __alloca (buflen);
 
-  do
+  while (1)
     {
       while ((status =
 	      internal_getgrent_r (&grpbuf, tmpbuf, buflen, errnop,
@@ -275,8 +275,11 @@ _nss_nis_initgroups_dyn (const char *user, gid_t group, long int *start,
 	tmpbuf = extend_alloca (tmpbuf, buflen, 2 * buflen);
 
       if (status != NSS_STATUS_SUCCESS)
-	goto done;
-
+	{
+	  if (status == NSS_STATUS_NOTFOUND)
+	    status = NSS_STATUS_SUCCESS;
+	  goto done;
+	}
 
       g = &grpbuf;
       if (g->gr_gid != group)
@@ -304,7 +307,11 @@ _nss_nis_initgroups_dyn (const char *user, gid_t group, long int *start,
 
 		    newgroups = realloc (groups, newsize * sizeof (*groups));
 		    if (newgroups == NULL)
-		      goto done;
+		      {
+			status = NSS_STATUS_TRYAGAIN;
+			*errnop = errno;
+			goto done;
+		      }
 		    *groupsp = groups = newgroups;
                     *size = newsize;
                   }
@@ -316,7 +323,6 @@ _nss_nis_initgroups_dyn (const char *user, gid_t group, long int *start,
               }
         }
     }
-  while (status == NSS_STATUS_SUCCESS);
 
 done:
   while (intern.start != NULL)