diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 8c8e068ff..7c89307d5 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2015-02-23 Corinna Vinschen + + * grp.cc (internal_getgroups): Check for group attributes and + Everyone sid before calling internal_getgrsid. + 2015-02-23 Corinna Vinschen * cygwait.h (enum cw_wait_mask): Add cw_sig_restart. Add comments diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc index 070202958..ba6584c8e 100644 --- a/winsup/cygwin/grp.cc +++ b/winsup/cygwin/grp.cc @@ -538,18 +538,17 @@ internal_getgroups (int gidsetsize, gid_t *grouplist, cyg_ldap *pldap, for (DWORD pg = 0; pg < groups->GroupCount; ++pg) { cygpsid sid = groups->Groups[pg].Sid; + if ((groups->Groups[pg].Attributes + & (SE_GROUP_ENABLED | SE_GROUP_INTEGRITY_ENABLED)) == 0 + || sid == well_known_world_sid) + continue; if ((grp = internal_getgrsid (sid, pldap))) { - if ((groups->Groups[pg].Attributes - & (SE_GROUP_ENABLED | SE_GROUP_INTEGRITY_ENABLED)) - && sid != well_known_world_sid) - { - if (cnt < gidsetsize) - grouplist[cnt] = grp->gr_gid; - ++cnt; - if (gidsetsize && cnt > gidsetsize) - goto error; - } + if (cnt < gidsetsize) + grouplist[cnt] = grp->gr_gid; + ++cnt; + if (gidsetsize && cnt > gidsetsize) + goto error; } if (timeout_ns && GetTickCount_ns () - t0 >= timeout_ns) break;