diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2000-07-02 10:17:44 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2000-07-02 10:17:44 +0000 |
commit | 0c4d2abd9966366b5e215ae64ce3b620efca9335 (patch) | |
tree | 62f506a304925c9d2707c73ce5c340daedff8338 /winsup/cygwin/spawn.cc | |
parent | c570d680fb3ffcfc973d13e56eabd143b0940cb3 (diff) | |
download | cygnal-0c4d2abd9966366b5e215ae64ce3b620efca9335.tar.gz cygnal-0c4d2abd9966366b5e215ae64ce3b620efca9335.tar.bz2 cygnal-0c4d2abd9966366b5e215ae64ce3b620efca9335.zip |
* winsup.h: Define MAX_SID_LEN and new MAX_HOST_NAME.
* fork.cc (fork): Use above defines instead of numerical constants.
* shared.cc (sec_user): Ditto.
* shared.h (class pinfo): Ditto.
* syscall.cc (seteuid): Ditto.
* spawn.cc (_spawnve): Ditto. Eliminate conditional.
(spawn_guts): Set child->uid = USHRT_MAX when user context will be
changed in child process.
* uinfo.cc (uinfo_init): Check for myself->uid instead of myself->psid
to avoid reloading of /etc/passwd on process startup if ntsec is off.
Use above defines instead of numerical constants.
* security.cc: Move define for MAX_SID_LEN to winsup.h.
Diffstat (limited to 'winsup/cygwin/spawn.cc')
-rw-r--r-- | winsup/cygwin/spawn.cc | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 425094677..734d2d2bf 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -543,8 +543,9 @@ 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. */ + /* Set child->uid to USHRT_MAX to force calling internal_getlogin() + from child process. Set psid to NULL to play it safe. */ + child->uid = USHRT_MAX; child->psid = NULL; /* Load users registry hive. */ @@ -844,15 +845,12 @@ _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; - if (!hToken && !myself->token) - { - memcpy (child->username, myself->username, MAX_USER_NAME); - memcpy (child->sidbuf, myself->sidbuf, 40); - if (myself->psid) - child->psid = child->sidbuf; - memcpy (child->logsrv, myself->logsrv, 256); - memcpy (child->domain, myself->domain, MAX_COMPUTERNAME_LENGTH+1); - } + memcpy (child->username, myself->username, MAX_USER_NAME); + memcpy (child->sidbuf, myself->sidbuf, MAX_SID_LEN); + if (myself->psid) + child->psid = child->sidbuf; + memcpy (child->logsrv, myself->logsrv, MAX_HOST_NAME); + memcpy (child->domain, myself->domain, MAX_COMPUTERNAME_LENGTH+1); subproc_init (); ret = spawn_guts (hToken, path, argv, envp, child, mode); if (ret == -1) |