Blame SOURCES/glibc-rh739971.patch

b40826
commit 32c76b63be605d12314e0c6ac2bd702c883d1423
b40826
Author: Andreas Schwab <schwab@redhat.com>
b40826
Date:   Mon Sep 26 17:49:14 2011 +0200
b40826
b40826
    Correctly reparse group line after enlarging the buffer
b40826
b40826
diff --git a/nss/nss_files/files-initgroups.c b/nss/nss_files/files-initgroups.c
b40826
index 113abf2..c343b35 100644
b40826
--- a/nss/nss_files/files-initgroups.c
b40826
+++ b/nss/nss_files/files-initgroups.c
b40826
@@ -52,8 +52,10 @@ _nss_files_initgroups_dyn (const char *user, gid_t group, long int *start,
b40826
   gid_t *groups = *groupsp;
b40826
 
b40826
   /* We have to iterate over the entire file.  */
b40826
-  while (!feof_unlocked (stream))
b40826
+  while (1)
b40826
     {
b40826
+      fpos_t pos;
b40826
+      fgetpos (stream, &pos;;
b40826
       ssize_t n = getline (&line, &linelen, stream);
b40826
       if (n < 0)
b40826
 	{
b40826
@@ -64,9 +66,8 @@ _nss_files_initgroups_dyn (const char *user, gid_t group, long int *start,
b40826
 	}
b40826
 
b40826
       struct group grp;
b40826
-      int res;
b40826
-      while ((res = _nss_files_parse_grent (line, &grp, buffer, buflen,
b40826
-					    errnop)) == -1)
b40826
+      int res = _nss_files_parse_grent (line, &grp, buffer, buflen, errnop);
b40826
+      if (res == -1)
b40826
 	{
b40826
 	  size_t newbuflen = 2 * buflen;
b40826
 	  if (buffer_use_malloc || ! __libc_use_alloca (buflen + newbuflen))
b40826
@@ -85,6 +86,9 @@ _nss_files_initgroups_dyn (const char *user, gid_t group, long int *start,
b40826
 	    }
b40826
 	  else
b40826
 	    buffer = extend_alloca (buffer, buflen, newbuflen);
b40826
+	  /* Reread current line, the parser has clobbered it.  */
b40826
+	  fsetpos (stream, &pos;;
b40826
+	  continue;
b40826
 	}
b40826
 
b40826
       if (res > 0 && grp.gr_gid != group)