diff options
author | Pierre Humblet <phumblet@phumblet.no-ip.org> | 2004-11-20 19:09:19 +0000 |
---|---|---|
committer | Pierre Humblet <phumblet@phumblet.no-ip.org> | 2004-11-20 19:09:19 +0000 |
commit | e70bea195b50a129b90a2706d9d7225bc8b68107 (patch) | |
tree | b5f82c0146d36c583753fb2bac2dd1c3a2e373e3 /winsup/cygwin/syscalls.cc | |
parent | 0f0fcb042a8e8a80433d7b372cf5a1a3b603d55f (diff) | |
download | cygnal-e70bea195b50a129b90a2706d9d7225bc8b68107.tar.gz cygnal-e70bea195b50a129b90a2706d9d7225bc8b68107.tar.bz2 cygnal-e70bea195b50a129b90a2706d9d7225bc8b68107.zip |
2004-11-20 Pierre Humblet <pierre.humblet@ieee.org>
* cygheap.h (cygheap_user::get_windows_id): New method.
* registry.h (get_registry_hive_path): Change argument type.
(load_registry_hive): Ditto.
* registry.cc (get_registry_hive_path): Change argument type and take
Win9x keys into account.
(load_registry_hive): Ditto.
* uinfo.cc (cygheap_user::env_userprofile): Use get_windows_id, even
for SYSTEM.
* shared.cc (user_shared_initialize): Use get_windows_id.
* syscalls.cc (seteuid32): Load the registry hive and reload the user
shared also on Win9x.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r-- | winsup/cygwin/syscalls.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 619eda382..fded062f8 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -2008,13 +2008,16 @@ seteuid32 (__uid32_t uid) user_groups &groups = cygheap->user.groups; HANDLE ptok, new_token = INVALID_HANDLE_VALUE; struct passwd * pw_new; - bool token_is_internal, issamesid; + bool token_is_internal, issamesid = false; char dacl_buf[MAX_DACL_LEN (5)]; TOKEN_DEFAULT_DACL tdacl = {}; pw_new = internal_getpwuid (uid); if (!wincap.has_security () && pw_new) + { + load_registry_hive (pw_new->pw_name); goto success_9x; + } if (!usersid.getfrompw (pw_new)) { set_errno (EINVAL); @@ -2082,7 +2085,8 @@ seteuid32 (__uid32_t uid) if (new_token != ptok) { /* Avoid having HKCU use default user */ - load_registry_hive (usersid); + char name[128]; + load_registry_hive (usersid.string (name)); /* Try setting owner to same value as user. */ if (!SetTokenInformation (new_token, TokenOwner, @@ -2106,16 +2110,17 @@ seteuid32 (__uid32_t uid) cygheap->user.set_sid (usersid); cygheap->user.current_token = new_token == ptok ? NO_IMPERSONATION : new_token; - if (!issamesid) /* MS KB 199190 */ - RegCloseKey (HKEY_CURRENT_USER); cygheap->user.reimpersonate (); - if (!issamesid) - user_shared_initialize (true); success_9x: cygheap->user.set_name (pw_new->pw_name); myself->uid = uid; groups.ischanged = FALSE; + if (!issamesid) /* MS KB 199190 */ + { + RegCloseKey (HKEY_CURRENT_USER); + user_shared_initialize (true); + } return 0; failed: |