When we get into auth_unix_gid at the second time, groups_len
is not 0 and ngroups variable leave as 0. Then we use ngroups
in getgrouplist that fails in this case. This patch fixes it.
Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru>
Signed-off-by: Steve Dickson <steved@redhat.com>
static gid_t *groups = NULL;
static int groups_len = 0;
gid_t *more_groups;
- int ngroups = 0;
+ int ngroups;
int rv, i;
char *cp;
if (!groups)
return;
- groups_len = ngroups = INITIAL_MANAGED_GROUPS;
+ groups_len = INITIAL_MANAGED_GROUPS;
}
+ ngroups = groups_len;
+
if (readline(fileno(f), &lbuf, &lbuflen) != 1)
return;