* grp.cc (get_groups): Don't add gid to list if it's ILLEGAL_GID.

(getgrouplist): Return number of groups, just like glibc.
This commit is contained in:
Corinna Vinschen 2014-02-20 13:55:57 +00:00
parent 23c0f21594
commit 7f57a4ea14
2 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2014-02-20 Corinna Vinschen <corinna@vinschen.de>
* grp.cc (get_groups): Don't add gid to list if it's ILLEGAL_GID.
(getgrouplist): Return number of groups, just like glibc.
2014-02-19 Corinna Vinschen <corinna@vinschen.de>
* passwd.cc (pg_ent::setent): Initialize cygheap domain info.

View File

@ -570,7 +570,7 @@ get_groups (const char *user, gid_t gid, cygsidlist &gsids)
cygsid usersid, grpsid;
if (usersid.getfrompw (pw))
get_server_groups (gsids, usersid, pw);
if (grpsid.getfromgr (grp))
if (gid != ILLEGAL_GID && grpsid.getfromgr (grp))
gsids += grpsid;
cygheap->user.reimpersonate ();
}
@ -626,7 +626,7 @@ getgrouplist (const char *user, gid_t gid, gid_t *groups, int *ngroups)
}
if (cnt > *ngroups)
ret = -1;
*ngroups = cnt;
ret = *ngroups = cnt;
syscall_printf ( "%d = getgrouplist(%s, %u, %p, %d)",
ret, user, gid, groups, *ngroups);