2 setgroups(size, groups) changes egid on kfreebsd,
3 precisely groups[0] is the new egid
5 initgroups(user, gid) prepares the "groups" list
6 via internal_getgrouplist().
7 It puts supplied gid as the first entry in all but NSCD cases.
8 Fix the remaining NSCD case, see #698102, #699593.
11 --- a/nscd/nscd_initgroups.c
12 +++ b/nscd/nscd_initgroups.c
16 /* Check whether GROUP is part of the mix. If not, add it. */
17 + /* The GROUP have to be in the first entry */
23 for (cnt = 0; cnt < retval; ++cnt)
24 - if ((*groupsp)[cnt] == group)
26 + tg = (*groupsp)[cnt];
27 + (*groupsp)[cnt] = sg;
34 - (*groupsp)[retval++] = group;
35 + (*groupsp)[retval++] = sg;