* autoload.cc: Add LoadDLLinitfunc for secur32.dll.
Add LoadDLLfuncEx statements for AllocateLocallyUniqueId@4, DuplicateTokenEx@24, LsaNtStatusToWinError@4, LsaDeregisterLogonProcess@4, LsaFreeReturnBuffer@4, LsaLogonUser@56, LsaLookupAuthenticationPackage@12, LsaRegisterLogonProcess@12, * environ.cc: Add extern declaration for `subauth_id'. (subauth_id_init): New function for setting `subauth_id'. (struct parse_thing): Add entry for `subauth_id'. * fork.cc (fork_parent): Call `RevertToSelf' and `ImpersonateLoggedOnUser' instead of `seteuid'. * security.cc: Define global variable `subauth_id'. (extract_nt_dom_user): New function. (cygwin_logon_user): Call `extract_nt_dom_user' now. (str2lsa): New static function. (str2buf2lsa): Ditto. (str2buf2uni): Ditto. (subauth): Ditto. * security.h: Add prototype for `subauth'. * spawn.cc (spawn_guts): Use cygheap->user.token only if impersonated. Use `cygsid' type. Remove impersonation before allowing access to workstation/desktop to everyone. Call `RevertToSelf' and `ImpersonateLoggedOnUser' instead of `seteuid'. * syscalls.cc (seteuid): Rearranged to allow using subauthentication to retrieve user tokens when needed.
This commit is contained in:
@ -436,7 +436,7 @@ fork_parent (void *stack_here, HANDLE& hParent, dll *&first_dll,
|
||||
uid_t uid;
|
||||
uid = geteuid();
|
||||
if (cygheap->user.impersonated && cygheap->user.token != INVALID_HANDLE_VALUE)
|
||||
seteuid (cygheap->user.orig_uid);
|
||||
RevertToSelf ();
|
||||
|
||||
ch.parent = hParent;
|
||||
ch.cygheap = cygheap;
|
||||
@ -484,7 +484,7 @@ out:
|
||||
/* Restore impersonation */
|
||||
if (cygheap->user.impersonated
|
||||
&& cygheap->user.token != INVALID_HANDLE_VALUE)
|
||||
seteuid (uid);
|
||||
ImpersonateLoggedOnUser (cygheap->user.token);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -508,7 +508,7 @@ out:
|
||||
|
||||
/* Restore impersonation */
|
||||
if (cygheap->user.impersonated && cygheap->user.token != INVALID_HANDLE_VALUE)
|
||||
seteuid (uid);
|
||||
ImpersonateLoggedOnUser (cygheap->user.token);
|
||||
|
||||
ProtectHandle (pi.hThread);
|
||||
/* Protect the handle but name it similarly to the way it will
|
||||
|
Reference in New Issue
Block a user