]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Don't add input group during initgroups_dyn in hesiod
authorSiddhesh Poyarekar <siddhesh@redhat.com>
Thu, 28 Mar 2013 06:15:47 +0000 (11:45 +0530)
committerSiddhesh Poyarekar <siddhesh@redhat.com>
Thu, 28 Mar 2013 06:15:47 +0000 (11:45 +0530)
Fixes BZ #15304.

The *initgroups_dyn functions are called with a group argument.  This
group gid is usually skipped while populating the grouplist since the
caller adds that group id in advance.

The hesiod initgroups_dyn implementation however adds the group gid to
the list if it does not already exist.  While it works fine for the
usual initgroups, it breaks nscd since it calls initgroups_dyn with -1
as the gid (to have all groups included).

ChangeLog
NEWS
hesiod/nss_hesiod/hesiod-grp.c

index 9a8bab64500eb803ace7224ac6dc1041360cc6da..7c1543cd507d543460474a9069e805e0b3d3d178 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2013-03-28  Siddhesh Poyarekar  <siddhesh@redhat.com>
 
+       [BZ #15304]
+       * hesiod/nss_hesiod/hesiod-grp.c (_nss_hesiod_initgroups_dyn):
+       Don't add gid passed as argument.
+
        * sysdeps/ieee-754/dbl-64/e_atan2.c: Reformat.
 
 2013-03-27  Joseph Myers  <joseph@codesourcery.com>
diff --git a/NEWS b/NEWS
index 11c79bb488358f13c6368e677d390719af3e096a..0902478638c091dfc82efe3a7e908f0b0a19dd20 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -12,7 +12,7 @@ Version 2.18
   11120, 11561, 12723, 13550, 13889, 13951, 14142, 14176, 14200, 14317,
   14327, 14496, 14812, 14920, 14964, 14981, 14982, 14985, 14994, 14996,
   15003, 15006, 15020, 15023, 15036, 15054, 15055, 15062, 15078, 15160,
-  15232, 15234, 15283, 15285, 15287, 15307.
+  15232, 15234, 15283, 15285, 15287, 15304, 15307.
 
 * Add support for calling C++11 thread_local object destructors on thread
   and program exit.  This needs compiler support for offloading C++11
index c2ae16612d96926c4130863d9f4a7b81004f1d32..b11952fadfe258f0cd1b78134e4eda8a88101842 100644 (file)
@@ -191,33 +191,6 @@ _nss_hesiod_initgroups_dyn (const char *user, gid_t group, long int *start,
       return errno == ENOENT ? NSS_STATUS_NOTFOUND : NSS_STATUS_UNAVAIL;
     }
 
-  if (!internal_gid_in_list (groups, group, *start))
-    {
-      if (__builtin_expect (*start == *size, 0))
-       {
-         /* Need a bigger buffer.  */
-         gid_t *newgroups;
-         long int newsize;
-
-         if (limit > 0 && *size == limit)
-           /* We reached the maximum.  */
-           goto done;
-
-         if (limit <= 0)
-           newsize = 2 * *size;
-         else
-           newsize = MIN (limit, 2 * *size);
-
-         newgroups = realloc (groups, newsize * sizeof (*groups));
-         if (newgroups == NULL)
-           goto done;
-         *groupsp = groups = newgroups;
-         *size = newsize;
-       }
-
-      groups[(*start)++] = group;
-    }
-
   save_errno = errno;
 
   p = *list;