summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/grp.cc19
2 files changed, 14 insertions, 10 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 8c8e068ff..7c89307d5 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,10 @@
2015-02-23 Corinna Vinschen <corinna@vinschen.de>
+ * grp.cc (internal_getgroups): Check for group attributes and
+ Everyone sid before calling internal_getgrsid.
+
+2015-02-23 Corinna Vinschen <corinna@vinschen.de>
+
* cygwait.h (enum cw_wait_mask): Add cw_sig_restart. Add comments
to explain the meaning of the possible values.
* cygwait.cc (is_cw_sig_restart): Define.
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;