From e219a2bdf05f480fff06c6f4866a79bab784450d Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 19 Jun 2000 17:36:30 +0000 Subject: * dcrt0.cc: Add load statements for `GetSidIdentifierAuthority' and `RegLoadKeyA'. * registry.cc (get_registry_hive_path): New function. (load_registry_hive): Ditto. * security.cc (convert_sid_to_string_sid): New function. (get_ssid): Renamed to `convert_string_sid_to_sid'. (get_pw_sid): Call `convert_string_sid_to_sid' instead of `get_ssid'. (get_gr_sid): Ditto. (get_admin_sid): Ditto. (get_system_sid): Ditto. (get_creator_owner_sid): Ditto. (get_world_sid): Ditto. * shared.h: New prototypes for `get_registry_hive_path' and `load_registry_hive'. * spawn.cc (spawn_guts): Set child->psid to NULL to force calling `internal_getlogin' from child process in case of changing user context. Call `load_registry_hive' in case of changing user context. (_spawnve): Copy user infos only if user context remains the same. * uinfo.cc: Add load statement for `NetUserGetInfo'. Remove load statement for `NetGetDCName'. (internal_getlogin): Rewrite to speed up process startup and to correct user environment in case user context changes. (uinfo_init): Call internal_getlogin only if myself->psid is NULL, that is user context changes. * winsup.h: Add prototypes for `convert_sid_to_string_sid', `convert_string_sid_to_sid' and `get_pw_sid'. --- winsup/cygwin/spawn.cc | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'winsup/cygwin/spawn.cc') diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 65e3bd665..7225c5377 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -543,6 +543,13 @@ skip_arg_parsing: if (myself->impersonated && myself->token != INVALID_HANDLE_VALUE) seteuid (myself->orig_uid); + /* Set child->psid to NULL to force calling internal_getlogin() + from child process. */ + child->psid = NULL; + + /* Load users registry hive. */ + load_registry_hive (sid); + rc = CreateProcessAsUser (hToken, real_path, /* image name - with full path */ one_line.buf, /* what was passed to exec */ @@ -837,11 +844,14 @@ _spawnve (HANDLE hToken, int mode, const char *path, const char *const *argv, child->ctty = myself->ctty; child->umask = myself->umask; child->process_state |= PID_INITIALIZING; - memcpy (child->username, myself->username, MAX_USER_NAME); - child->psid = myself->psid; - memcpy (child->sidbuf, myself->sidbuf, 40); - memcpy (child->logsrv, myself->logsrv, 256); - memcpy (child->domain, myself->domain, MAX_COMPUTERNAME_LENGTH+1); + if (!hToken && !myself->token) + { + memcpy (child->username, myself->username, MAX_USER_NAME); + child->psid = myself->psid; + memcpy (child->sidbuf, myself->sidbuf, 40); + memcpy (child->logsrv, myself->logsrv, 256); + memcpy (child->domain, myself->domain, MAX_COMPUTERNAME_LENGTH+1); + } subproc_init (); ret = spawn_guts (hToken, path, argv, envp, child, mode); if (ret == -1) -- cgit v1.2.3