From c4b881eb448ed0a35fdb359966f93df3354ba70f Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 19 Jul 2000 20:27:27 +0000 Subject: * spawn.cc (spawn_guts): Don't restore impersonation in case of _P_OVERLAY. Clean up slightly. Accomodate comments. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/spawn.cc | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'winsup/cygwin') diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index d6cf41ca8..f317f5302 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +Wed Jul 19 22:24:00 2000 Corinna Vinschen + + * spawn.cc (spawn_guts): Don't restore impersonation in case + of _P_OVERLAY. Clean up slightly. Accomodate comments. + Wed Jul 19 22:11:00 2000 Corinna Vinschen * shared.h (class pinfo): New members `root' and `rootlen'. diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 4c1c72c52..f9660d93d 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -525,9 +525,6 @@ skip_arg_parsing: strcat (wstname, "\\"); strcat (wstname, dskname); si.lpDesktop = wstname; - /* force the new process to reread /etc/passwd and /etc/group */ - child->uid = USHRT_MAX; - child->username[0] = '\0'; char tu[1024]; PSID sid = NULL; @@ -545,8 +542,9 @@ skip_arg_parsing: seteuid (myself->orig_uid); /* Set child->uid to USHRT_MAX to force calling internal_getlogin() - from child process. Set psid to NULL to play it safe. */ + from child process. Clear username and psid to play it safe. */ child->uid = USHRT_MAX; + child->username[0] = '\0'; child->psid = NULL; /* Load users registry hive. */ @@ -567,8 +565,10 @@ skip_arg_parsing: 0, /* use current drive/directory */ &si, &pi); - /* Restore impersonation */ - if (myself->impersonated && myself->token != INVALID_HANDLE_VALUE) + /* Restore impersonation. In case of _P_OVERLAY this isn't + allowed since it would overwrite child data. */ + if (mode != _P_OVERLAY + && myself->impersonated && myself->token != INVALID_HANDLE_VALUE) seteuid (uid); } else -- cgit v1.2.3