Cygwin: Revert attempting to unload user profile after use
Revert "Cywin: user profile: unload impersonation user profile on exit" Revert "Cygwin: seteuid: allow inheriting impersonation user profile handle" Revert "Cygwin: user profile: add debug output to unload_user_profile" Revert "Cygwin: user profile: Make an effort to unload unused user profiles" This reverts commitbcb33dc4f0
. This reverts commitdd3730ed9c
. This reverts commit8eee25241e
. This reverts commit71b8777a71
. This patchset actually results in the following problem: - After a couple of ssh logon/logoff attempts, an interactive session of the same user loging in, is broken. Apparently UnloadUserProfile manages to unload the user's profile even while a parallel interactive session still uses the user's profile. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
fc5b248784
commit
5c4ce731ac
|
@ -699,7 +699,6 @@ LoadDLLfuncEx (CreateEnvironmentBlock, 12, userenv, 1)
|
||||||
LoadDLLfuncEx2 (CreateProfile, 16, userenv, 1, 1)
|
LoadDLLfuncEx2 (CreateProfile, 16, userenv, 1, 1)
|
||||||
LoadDLLfunc (DestroyEnvironmentBlock, 4, userenv)
|
LoadDLLfunc (DestroyEnvironmentBlock, 4, userenv)
|
||||||
LoadDLLfunc (LoadUserProfileW, 8, userenv)
|
LoadDLLfunc (LoadUserProfileW, 8, userenv)
|
||||||
LoadDLLfunc (UnloadUserProfile, 8, userenv)
|
|
||||||
|
|
||||||
LoadDLLfuncEx3 (waveInAddBuffer, 12, winmm, 1, 0, 1)
|
LoadDLLfuncEx3 (waveInAddBuffer, 12, winmm, 1, 0, 1)
|
||||||
LoadDLLfuncEx3 (waveInClose, 4, winmm, 1, 0, 1)
|
LoadDLLfuncEx3 (waveInClose, 4, winmm, 1, 0, 1)
|
||||||
|
|
|
@ -106,9 +106,6 @@ public:
|
||||||
HANDLE curr_primary_token; /* Just a copy of external or internal token */
|
HANDLE curr_primary_token; /* Just a copy of external or internal token */
|
||||||
HANDLE curr_imp_token; /* impersonation token derived from primary
|
HANDLE curr_imp_token; /* impersonation token derived from primary
|
||||||
token */
|
token */
|
||||||
HANDLE imp_profile_token; /* Handle to the token used to load the
|
|
||||||
user profile in "imp_profile" */
|
|
||||||
HANDLE imp_profile; /* Handle to the user profile */
|
|
||||||
bool ext_token_is_restricted; /* external_token is restricted token */
|
bool ext_token_is_restricted; /* external_token is restricted token */
|
||||||
bool curr_token_is_restricted; /* curr_primary_token is restricted token */
|
bool curr_token_is_restricted; /* curr_primary_token is restricted token */
|
||||||
bool setuid_to_restricted; /* switch to restricted token by setuid () */
|
bool setuid_to_restricted; /* switch to restricted token by setuid () */
|
||||||
|
@ -193,11 +190,6 @@ public:
|
||||||
{
|
{
|
||||||
return effec_cygsid.string (buf);
|
return effec_cygsid.string (buf);
|
||||||
}
|
}
|
||||||
void exit ()
|
|
||||||
{
|
|
||||||
if (imp_profile_token && imp_profile)
|
|
||||||
unload_user_profile (imp_profile_token, imp_profile);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char __reg3 *test_uid (char *&, const char *, size_t);
|
const char __reg3 *test_uid (char *&, const char *, size_t);
|
||||||
};
|
};
|
||||||
|
|
|
@ -224,7 +224,6 @@ pinfo::exit (DWORD n)
|
||||||
exitcode = ((exitcode & 0xff) << 8) | ((exitcode >> 8) & 0xff);
|
exitcode = ((exitcode & 0xff) << 8) | ((exitcode >> 8) & 0xff);
|
||||||
sigproc_printf ("Calling dlls.cleanup_forkables n %y, exitcode %y", n, exitcode);
|
sigproc_printf ("Calling dlls.cleanup_forkables n %y, exitcode %y", n, exitcode);
|
||||||
dlls.cleanup_forkables ();
|
dlls.cleanup_forkables ();
|
||||||
cygheap->user.exit ();
|
|
||||||
sigproc_printf ("Calling ExitProcess n %y, exitcode %y", n, exitcode);
|
sigproc_printf ("Calling ExitProcess n %y, exitcode %y", n, exitcode);
|
||||||
if (!TerminateProcess (GetCurrentProcess (), exitcode))
|
if (!TerminateProcess (GetCurrentProcess (), exitcode))
|
||||||
system_printf ("TerminateProcess failed, %E");
|
system_printf ("TerminateProcess failed, %E");
|
||||||
|
|
|
@ -316,15 +316,6 @@ load_user_profile (HANDLE token, struct passwd *pw, cygpsid &usersid)
|
||||||
return pi.hProfile;
|
return pi.hProfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
unload_user_profile (HANDLE token, HANDLE profile)
|
|
||||||
{
|
|
||||||
bool ret = UnloadUserProfile (token, profile);
|
|
||||||
if (!ret)
|
|
||||||
debug_printf ("UnloadUserProfile, %E");
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
HANDLE
|
HANDLE
|
||||||
lsa_open_policy (PWCHAR server, ACCESS_MASK access)
|
lsa_open_policy (PWCHAR server, ACCESS_MASK access)
|
||||||
{
|
{
|
||||||
|
|
|
@ -502,7 +502,6 @@ PWCHAR get_user_profile_directory (PCWSTR sidstr, PWCHAR path, SIZE_T path_len);
|
||||||
|
|
||||||
/* Load user profile if it's not already loaded. */
|
/* Load user profile if it's not already loaded. */
|
||||||
HANDLE load_user_profile (HANDLE token, struct passwd *pw, cygpsid &sid);
|
HANDLE load_user_profile (HANDLE token, struct passwd *pw, cygpsid &sid);
|
||||||
bool unload_user_profile (HANDLE token, HANDLE profile);
|
|
||||||
|
|
||||||
HANDLE lsa_open_policy (PWCHAR server, ACCESS_MASK access);
|
HANDLE lsa_open_policy (PWCHAR server, ACCESS_MASK access);
|
||||||
void lsa_close_policy (HANDLE lsa);
|
void lsa_close_policy (HANDLE lsa);
|
||||||
|
|
|
@ -3603,21 +3603,8 @@ seteuid32 (uid_t uid)
|
||||||
{
|
{
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
|
||||||
if (!request_restricted_uid_switch
|
if (!request_restricted_uid_switch)
|
||||||
&& new_token != cygheap->user.imp_profile_token)
|
load_user_profile (new_token, pw_new, usersid);
|
||||||
{
|
|
||||||
if (cygheap->user.imp_profile_token && cygheap->user.imp_profile)
|
|
||||||
unload_user_profile (cygheap->user.imp_profile_token,
|
|
||||||
cygheap->user.imp_profile);
|
|
||||||
cygheap->user.imp_profile = load_user_profile (new_token, pw_new,
|
|
||||||
usersid);
|
|
||||||
if (cygheap->user.imp_profile)
|
|
||||||
{
|
|
||||||
cygheap->user.imp_profile_token = new_token;
|
|
||||||
SetHandleInformation (cygheap->user.imp_profile,
|
|
||||||
HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Try setting owner to same value as user. */
|
/* Try setting owner to same value as user. */
|
||||||
status = NtSetInformationToken (new_token, TokenOwner,
|
status = NtSetInformationToken (new_token, TokenOwner,
|
||||||
|
|
|
@ -239,8 +239,6 @@ uinfo_init ()
|
||||||
cygheap->user.internal_token = NO_IMPERSONATION;
|
cygheap->user.internal_token = NO_IMPERSONATION;
|
||||||
cygheap->user.curr_primary_token = NO_IMPERSONATION;
|
cygheap->user.curr_primary_token = NO_IMPERSONATION;
|
||||||
cygheap->user.curr_imp_token = NO_IMPERSONATION;
|
cygheap->user.curr_imp_token = NO_IMPERSONATION;
|
||||||
cygheap->user.imp_profile_token = NO_IMPERSONATION;
|
|
||||||
cygheap->user.imp_profile = NULL;
|
|
||||||
cygheap->user.ext_token_is_restricted = false;
|
cygheap->user.ext_token_is_restricted = false;
|
||||||
cygheap->user.curr_token_is_restricted = false;
|
cygheap->user.curr_token_is_restricted = false;
|
||||||
cygheap->user.setuid_to_restricted = false;
|
cygheap->user.setuid_to_restricted = false;
|
||||||
|
|
Loading…
Reference in New Issue