Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2019-03-04 19:07:31 +0300
committerCorinna Vinschen <corinna@vinschen.de>2019-03-04 19:31:27 +0300
commit5c4ce731ac08d6615ae759121ab7e9e824024808 (patch)
treede2a44deabb2e5bcb6228da4e2f9bef74ef29308
parentfc5b248784f094c99bce02e6af580d3db5ebd93f (diff)
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 commit bcb33dc4f0552e749dcb6c44e1ef7815b5db75a1. This reverts commit dd3730ed9c1c78176f1aab1b429bb5a105d90a44. This reverts commit 8eee25241e86fc596acde25c7c53723b75afee30. This reverts commit 71b8777a7140b79942d6e5079818cad2c3f5f07f. 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>
-rw-r--r--winsup/cygwin/autoload.cc1
-rw-r--r--winsup/cygwin/cygheap.h8
-rw-r--r--winsup/cygwin/pinfo.cc1
-rw-r--r--winsup/cygwin/sec_auth.cc9
-rw-r--r--winsup/cygwin/security.h1
-rw-r--r--winsup/cygwin/syscalls.cc19
-rw-r--r--winsup/cygwin/uinfo.cc2
7 files changed, 3 insertions, 38 deletions
diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc
index c04e25c95..056fac7dc 100644
--- a/winsup/cygwin/autoload.cc
+++ b/winsup/cygwin/autoload.cc
@@ -699,7 +699,6 @@ LoadDLLfuncEx (CreateEnvironmentBlock, 12, userenv, 1)
LoadDLLfuncEx2 (CreateProfile, 16, userenv, 1, 1)
LoadDLLfunc (DestroyEnvironmentBlock, 4, userenv)
LoadDLLfunc (LoadUserProfileW, 8, userenv)
-LoadDLLfunc (UnloadUserProfile, 8, userenv)
LoadDLLfuncEx3 (waveInAddBuffer, 12, winmm, 1, 0, 1)
LoadDLLfuncEx3 (waveInClose, 4, winmm, 1, 0, 1)
diff --git a/winsup/cygwin/cygheap.h b/winsup/cygwin/cygheap.h
index 4d9feb072..8877cc358 100644
--- a/winsup/cygwin/cygheap.h
+++ b/winsup/cygwin/cygheap.h
@@ -106,9 +106,6 @@ public:
HANDLE curr_primary_token; /* Just a copy of external or internal token */
HANDLE curr_imp_token; /* impersonation token derived from primary
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 curr_token_is_restricted; /* curr_primary_token is restricted token */
bool setuid_to_restricted; /* switch to restricted token by setuid () */
@@ -193,11 +190,6 @@ public:
{
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);
};
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index e29c00746..064299e0c 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -224,7 +224,6 @@ pinfo::exit (DWORD n)
exitcode = ((exitcode & 0xff) << 8) | ((exitcode >> 8) & 0xff);
sigproc_printf ("Calling dlls.cleanup_forkables n %y, exitcode %y", n, exitcode);
dlls.cleanup_forkables ();
- cygheap->user.exit ();
sigproc_printf ("Calling ExitProcess n %y, exitcode %y", n, exitcode);
if (!TerminateProcess (GetCurrentProcess (), exitcode))
system_printf ("TerminateProcess failed, %E");
diff --git a/winsup/cygwin/sec_auth.cc b/winsup/cygwin/sec_auth.cc
index 36874b63e..195d20ca9 100644
--- a/winsup/cygwin/sec_auth.cc
+++ b/winsup/cygwin/sec_auth.cc
@@ -316,15 +316,6 @@ load_user_profile (HANDLE token, struct passwd *pw, cygpsid &usersid)
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
lsa_open_policy (PWCHAR server, ACCESS_MASK access)
{
diff --git a/winsup/cygwin/security.h b/winsup/cygwin/security.h
index 0ce7e8d7a..483a527e7 100644
--- a/winsup/cygwin/security.h
+++ b/winsup/cygwin/security.h
@@ -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. */
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);
void lsa_close_policy (HANDLE lsa);
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index a73af6748..172b7c4f6 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -3603,21 +3603,8 @@ seteuid32 (uid_t uid)
{
NTSTATUS status;
- if (!request_restricted_uid_switch
- && new_token != cygheap->user.imp_profile_token)
- {
- 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);
- }
- }
+ if (!request_restricted_uid_switch)
+ load_user_profile (new_token, pw_new, usersid);
/* Try setting owner to same value as user. */
status = NtSetInformationToken (new_token, TokenOwner,
@@ -3647,7 +3634,7 @@ seteuid32 (uid_t uid)
issamesid = (usersid == cygheap->user.sid ());
cygheap->user.set_sid (usersid);
cygheap->user.curr_primary_token = new_token == hProcToken ? NO_IMPERSONATION
- : new_token;
+ : new_token;
cygheap->user.curr_token_is_restricted = false;
cygheap->user.setuid_to_restricted = false;
if (cygheap->user.curr_imp_token != NO_IMPERSONATION)
diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc
index 49614cb45..bfcce00da 100644
--- a/winsup/cygwin/uinfo.cc
+++ b/winsup/cygwin/uinfo.cc
@@ -239,8 +239,6 @@ uinfo_init ()
cygheap->user.internal_token = NO_IMPERSONATION;
cygheap->user.curr_primary_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.curr_token_is_restricted = false;
cygheap->user.setuid_to_restricted = false;