From 7a86be6e5f18ba99b25d75c555ce56fe1fcea325 Mon Sep 17 00:00:00 2001 From: Siddhesh Poyarekar Date: Thu, 28 Mar 2013 11:45:47 +0530 Subject: Don't add input group during initgroups_dyn in hesiod 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). --- hesiod/nss_hesiod/hesiod-grp.c | 27 --------------------------- 1 file changed, 27 deletions(-) (limited to 'hesiod') diff --git a/hesiod/nss_hesiod/hesiod-grp.c b/hesiod/nss_hesiod/hesiod-grp.c index c2ae16612d..b11952fadf 100644 --- a/hesiod/nss_hesiod/hesiod-grp.c +++ b/hesiod/nss_hesiod/hesiod-grp.c @@ -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; -- cgit 1.4.1