From 2a770b2a6f38678409b7f5cc1d56f786ba1e7bf3 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 21 Jun 2005 20:38:05 +0000 Subject: [PATCH] * security.cc (get_initgroups_sidlist): Drop special_pgrp parameter. (get_setgroups_sidlist): Avoid duplicate groups in group list. (create_token): Remove special_pgrp local variable. Accomodate change to get_initgroups_sidlist call. --- winsup/cygwin/ChangeLog | 7 +++++++ winsup/cygwin/security.cc | 16 +++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index a3fe9a3b9..fef61697c 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +2005-06-21 Corinna Vinschen + + * security.cc (get_initgroups_sidlist): Drop special_pgrp parameter. + (get_setgroups_sidlist): Avoid duplicate groups in group list. + (create_token): Remove special_pgrp local variable. Accomodate + change to get_initgroups_sidlist call. + 2005-06-21 Corinna Vinschen * uinfo.cc (uinfo_init): Call reimpersonate to set the main thread's diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc index c589513ae..fce6eb074 100644 --- a/winsup/cygwin/security.cc +++ b/winsup/cygwin/security.cc @@ -582,20 +582,19 @@ get_server_groups (cygsidlist &grp_list, PSID usersid, struct passwd *pw) static bool get_initgroups_sidlist (cygsidlist &grp_list, PSID usersid, PSID pgrpsid, struct passwd *pw, - PTOKEN_GROUPS my_grps, LUID auth_luid, int &auth_pos, - bool &special_pgrp) + PTOKEN_GROUPS my_grps, LUID auth_luid, int &auth_pos) { grp_list += well_known_world_sid; grp_list += well_known_authenticated_users_sid; if (well_known_system_sid == usersid) auth_pos = -1; - else - get_token_group_sidlist (grp_list, my_grps, auth_luid, auth_pos); + else + get_token_group_sidlist (grp_list, my_grps, auth_luid, auth_pos); if (!get_server_groups (grp_list, usersid, pw)) return false; /* special_pgrp true if pgrpsid is not in normal groups */ - if ((special_pgrp = !grp_list.contains (pgrpsid))) + if (!grp_list.contains (pgrpsid)) grp_list += pgrpsid; return true; } @@ -609,7 +608,8 @@ get_setgroups_sidlist (cygsidlist &tmp_list, PTOKEN_GROUPS my_grps, tmp_list += well_known_authenticated_users_sid; get_token_group_sidlist (tmp_list, my_grps, auth_luid, auth_pos); for (int gidx = 0; gidx < groups.sgsids.count; gidx++) - tmp_list += groups.sgsids.sids[gidx]; + if (!tmp_list.contains (groups.sgsids.sids[gidx])) + tmp_list += groups.sgsids.sids[gidx]; if (!groups.sgsids.contains (pgpsid)) tmp_list += pgpsid; } @@ -851,7 +851,6 @@ create_token (cygsid &usersid, user_groups &new_groups, struct passwd *pw) SECURITY_QUALITY_OF_SERVICE sqos = { sizeof sqos, SecurityImpersonation, SECURITY_STATIC_TRACKING, FALSE }; OBJECT_ATTRIBUTES oa = { sizeof oa, 0, 0, 0, 0, &sqos }; - bool special_pgrp = false; LUID auth_luid = SYSTEM_LUID; LARGE_INTEGER exp = { QuadPart:INT64_MAX }; @@ -920,8 +919,7 @@ create_token (cygsid &usersid, user_groups &new_groups, struct passwd *pw) get_setgroups_sidlist (tmp_gsids, my_tok_gsids, new_groups, auth_luid, auth_pos); else if (!get_initgroups_sidlist (tmp_gsids, usersid, new_groups.pgsid, pw, - my_tok_gsids, auth_luid, auth_pos, - special_pgrp)) + my_tok_gsids, auth_luid, auth_pos)) goto out; /* Primary group. */