]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix infinite loop in nscd when netgroup is empty (bz #16365)
authorSiddhesh Poyarekar <siddhesh@redhat.com>
Thu, 2 Jan 2014 04:33:12 +0000 (10:03 +0530)
committerSiddhesh Poyarekar <siddhesh@redhat.com>
Thu, 2 Jan 2014 04:34:21 +0000 (10:04 +0530)
Currently, when a user looks up a netgroup that does not have any
members, nscd goes into an infinite loop trying to find members in the
group.  This is because it does not handle cases when getnetgrent
returns an NSS_STATUS_NOTFOUND (which is what it does on empty group).
Fixed to handle this in the same way as NSS_STATUS_RETURN, similar to
what getgrent does by itself.

ChangeLog
NEWS
nscd/netgroupcache.c

index 7f4015758c0cf101ce4152c63cc051933dbbf4b6..dd7bd669704764b7be79e29fc9e2d209750a5160 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-01-02  Siddhesh Poyarekar  <siddhesh@redhat.com>
+
+       [BZ # 16365]
+       * nscd/netgroupcache.c (addgetnetgrentX): Break if status is
+       NSS_STATUS_NOTFOUND.
+
 2014-01-01  Joseph Myers  <joseph@codesourcery.com>
 
        * sysdeps/i386/fpu/libm-test-ulps: Regenerated.
diff --git a/NEWS b/NEWS
index 94bcd3aaf010a62e2b4f76cc130c48e89fd5c498..869d3b9096c412fe38af2f73e0359f4b21c1773d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -23,7 +23,7 @@ Version 2.19
   16038, 16041, 16055, 16071, 16072, 16074, 16077, 16078, 16103, 16112,
   16143, 16144, 16146, 16150, 16151, 16153, 16167, 16172, 16195, 16214,
   16245, 16271, 16274, 16283, 16289, 16293, 16314, 16316, 16330, 16337,
-  16338, 16356, 16369, 16372, 16375, 16379.
+  16338, 16356, 16365, 16369, 16372, 16375, 16379.
 
 * Slovenian translations for glibc messages have been contributed by the
   Translation Project's Slovenian team of translators.
index baebdd7e4e1e224056bfd8dae2cf0e5a66e294b5..50936ee7eb5edb93a0be890dfc9d621c01908449 100644 (file)
@@ -180,9 +180,10 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
                    int e;
                    status = getfct.f (&data, buffer + buffilled,
                                       buflen - buffilled, &e);
-                   if (status == NSS_STATUS_RETURN)
-                     /* This was the last one for this group.  Look
-                        at next group if available.  */
+                   if (status == NSS_STATUS_RETURN
+                       || status == NSS_STATUS_NOTFOUND)
+                     /* This was either the last one for this group or the
+                        group was empty.  Look at next group if available.  */
                      break;
                    if (status == NSS_STATUS_SUCCESS)
                      {