diff options
author | Pierre Humblet <phumblet@phumblet.no-ip.org> | 2004-10-28 01:46:01 +0000 |
---|---|---|
committer | Pierre Humblet <phumblet@phumblet.no-ip.org> | 2004-10-28 01:46:01 +0000 |
commit | 531979231dd850a920af0a65bc70d5178ae14fec (patch) | |
tree | cedf7460fe072dba7976a95693dd5aab3ca4fc5f /winsup/cygwin/syscalls.cc | |
parent | 39055108341fae0ca71ef503267d8f619e59a047 (diff) | |
download | cygnal-531979231dd850a920af0a65bc70d5178ae14fec.tar.gz cygnal-531979231dd850a920af0a65bc70d5178ae14fec.tar.bz2 cygnal-531979231dd850a920af0a65bc70d5178ae14fec.zip |
2004-10-28 Pierre Humblet <pierre.humblet@ieee.org>
* path.cc (mount_info::from_registry): Deimpersonate while
accessing HKLM.
(mount_info::read_cygdrive_info_from_registry): Ditto.
* cygheap.h: Define NO_IMPERSONATION.
(cygheap_user::issetuid): Replace INVALID_HANDLE_VALUE by
NO_IMPERSONATION.
(cygheap_user::has_impersonation_tokens): Ditto.
(cygheap_user::close_impersonation_tokens): Ditto.
* uinfo.cc (uinfo_init): Ditto.
* syscalls.cc (seteuid32): Ditto.
* security.cc (set_impersonation_token): Ditto.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r-- | winsup/cygwin/syscalls.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 0aec7098e..619eda382 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -2032,17 +2032,17 @@ seteuid32 (__uid32_t uid) if (verify_token (ptok, usersid, groups)) new_token = ptok; /* Verify if the external token is suitable */ - else if (cygheap->user.external_token != INVALID_HANDLE_VALUE + else if (cygheap->user.external_token != NO_IMPERSONATION && verify_token (cygheap->user.external_token, usersid, groups)) new_token = cygheap->user.external_token; /* Verify if the current token (internal or former external) is suitable */ - else if (cygheap->user.current_token != INVALID_HANDLE_VALUE + else if (cygheap->user.current_token != NO_IMPERSONATION && cygheap->user.current_token != cygheap->user.external_token && verify_token (cygheap->user.current_token, usersid, groups, &token_is_internal)) new_token = cygheap->user.current_token; /* Verify if the internal token is suitable */ - else if (cygheap->user.internal_token != INVALID_HANDLE_VALUE + else if (cygheap->user.internal_token != NO_IMPERSONATION && cygheap->user.internal_token != cygheap->user.current_token && verify_token (cygheap->user.internal_token, usersid, groups, &token_is_internal)) @@ -2074,10 +2074,11 @@ seteuid32 (__uid32_t uid) goto failed; } /* Keep at most one internal token */ - if (cygheap->user.internal_token != INVALID_HANDLE_VALUE) + if (cygheap->user.internal_token != NO_IMPERSONATION) CloseHandle (cygheap->user.internal_token); cygheap->user.internal_token = new_token; } + if (new_token != ptok) { /* Avoid having HKCU use default user */ @@ -2103,7 +2104,7 @@ seteuid32 (__uid32_t uid) CloseHandle (ptok); issamesid = (usersid == cygheap->user.sid ()); cygheap->user.set_sid (usersid); - cygheap->user.current_token = new_token == ptok ? INVALID_HANDLE_VALUE + cygheap->user.current_token = new_token == ptok ? NO_IMPERSONATION : new_token; if (!issamesid) /* MS KB 199190 */ RegCloseKey (HKEY_CURRENT_USER); |