* autoload.cc (CreateEnvironmentBlock): Import.
(DestroyEnvironmentBlock): Import. * environ.cc (env_compare): New static bsearch comparison function. (build_env): Add parameter taking a user token. If token is non-NULL, fetch user's default Windows environment and merge it into the resulting environment. Explain what we do in preceeding comment. * environ,h (build_env): Align prototype to above change. * external.cc (create_winenv): Call build_env with NULL token. * spawn.cc (child_info_spawn::worker): When spawning new process under another user account, call build_env with new token to allow merging user's default Windows environment. * winlean.h (_USERENV_): Define to override dllimport.
This commit is contained in:
@@ -531,8 +531,14 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
|
||||
if (!real_path.iscygexec())
|
||||
::cygheap->fdtab.set_file_pointers_for_exec ();
|
||||
|
||||
/* If we switch the user, merge the user's Windows environment. */
|
||||
bool switch_user = ::cygheap->user.issetuid ()
|
||||
&& (::cygheap->user.saved_uid
|
||||
!= ::cygheap->user.real_uid);
|
||||
moreinfo->envp = build_env (envp, envblock, moreinfo->envc,
|
||||
real_path.iscygexec ());
|
||||
real_path.iscygexec (),
|
||||
switch_user ? ::cygheap->user.primary_token ()
|
||||
: NULL);
|
||||
if (!moreinfo->envp || !envblock)
|
||||
{
|
||||
set_errno (E2BIG);
|
||||
|
Reference in New Issue
Block a user