From 2b0a111fcf0a2e7276f9c0f1cb9e56dc5d14361c Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 15 May 2001 19:23:31 +0000 Subject: * fork.cc (fork): Eliminate superfluous call to getuid(). * security.h: New define `NO_SID'. Remove declarations of functions moved to methods into class cygsid. (class cygsid): Declare new methods `getfromstr', `get_sid', `getfrompw', `getfromgr', `get_rid', `get_uid', `get_gid', `string' and new constructors and operators =, == and !=. Declare new global cygsids `well_known_XXX_sid' substituting the corresponding `get_XXX_sid' functions. Remove declarations of these functions. * sec_helper.cc (well_known_admin_sid): New global variable. (well_known_system_sid): Ditto (well_known_creator_owner_sid): Ditto (well_known_world_sid): Ditto (cygsid::string): New method, substituting `convert_sid_to_string_sid'. (cygsid::get_sid): New method, substituting `get_sid'. (cygsid::getfromstr): New method, substituting `convert_string_sid_to_sid'. (cygsid::getfrompw): New method, substituting `get_pw_sid'. (cygsid::getfromgr): New method, substituting `get_gr_sid'. (cygsid::get_id): New method, substituting `get_id_from_sid'. (get_admin_sid): Eliminated. (get_system_sid): Ditto. (get_creator_owner_sid): Ditto. (get_world_sid): Ditto. * grp.cc: Use new cygsid methods and well known sids throughout. * registry.cc: Ditto. * sec_acl.cc: Ditto. * security.cc: Ditto. * shared.cc: Ditto. * syscalls.cc (seteuid): Ditto. Eliminate redundant conditional. * uinfo.cc (internal_getlogin): Ditto. * spawn.cc (spawn_guts) Revert previous patch. --- winsup/cygwin/spawn.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'winsup/cygwin/spawn.cc') diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index f67fa626a..b49e0f8f4 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -612,10 +612,9 @@ skip_arg_parsing: DWORD ret_len; if (!GetTokenInformation (hToken, TokenUser, &sid, sizeof sid, &ret_len)) { - sid = NULL; + sid = NO_SID; system_printf ("GetTokenInformation: %E"); } - /* Retrieve security attributes before setting psid to NULL since it's value is needed by `sec_user'. */ PSECURITY_ATTRIBUTES sec_attribs = allow_ntsec && sid @@ -623,9 +622,10 @@ skip_arg_parsing: : &sec_all_nih; /* Remove impersonation */ + uid_t uid = geteuid (); if (cygheap->user.impersonated && cygheap->user.token != INVALID_HANDLE_VALUE) - RevertToSelf (); + seteuid (cygheap->user.orig_uid); /* Load users registry hive. */ load_registry_hive (sid); @@ -664,7 +664,7 @@ skip_arg_parsing: if (mode != _P_OVERLAY && mode != _P_VFORK && cygheap->user.impersonated && cygheap->user.token != INVALID_HANDLE_VALUE) - ImpersonateLoggedOnUser (cygheap->user.token); + seteuid (uid); } MALLOC_CHECK; -- cgit v1.2.3