mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-18 23:12:15 +08:00
2005-01-08 Pierre Humblet <pierre.humblet@ieee.org>
* syscalls.cc (seteuid32): Only change the default dacl when seteuid succeeds. Do not close HKCU.
This commit is contained in:
parent
fcab88fec6
commit
a6888c92d9
@ -1,3 +1,8 @@
|
|||||||
|
2005-01-08 Pierre Humblet <pierre.humblet@ieee.org>
|
||||||
|
|
||||||
|
* syscalls.cc (seteuid32): Only change the default dacl when
|
||||||
|
seteuid succeeds. Do not close HKCU.
|
||||||
|
|
||||||
2005-01-06 Corinna Vinschen <corinna@vinschen.de>
|
2005-01-06 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* fhandler_process.cc: Use strcasematch instead of strcasecmp
|
* fhandler_process.cc: Use strcasematch instead of strcasecmp
|
||||||
|
@ -2066,7 +2066,7 @@ seteuid32 (__uid32_t uid)
|
|||||||
if (!wincap.has_security () && pw_new)
|
if (!wincap.has_security () && pw_new)
|
||||||
{
|
{
|
||||||
load_registry_hive (pw_new->pw_name);
|
load_registry_hive (pw_new->pw_name);
|
||||||
goto success_9x;
|
goto success_9x;
|
||||||
}
|
}
|
||||||
if (!usersid.getfrompw (pw_new))
|
if (!usersid.getfrompw (pw_new))
|
||||||
{
|
{
|
||||||
@ -2103,16 +2103,6 @@ seteuid32 (__uid32_t uid)
|
|||||||
|
|
||||||
debug_printf ("Found token %d", new_token);
|
debug_printf ("Found token %d", new_token);
|
||||||
|
|
||||||
/* Set process def dacl to allow access to impersonated token */
|
|
||||||
if (sec_acl ((PACL) dacl_buf, true, true, usersid))
|
|
||||||
{
|
|
||||||
tdacl.DefaultDacl = (PACL) dacl_buf;
|
|
||||||
if (!SetTokenInformation (ptok, TokenDefaultDacl,
|
|
||||||
&tdacl, sizeof dacl_buf))
|
|
||||||
debug_printf ("SetTokenInformation"
|
|
||||||
"(TokenDefaultDacl), %E");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If no impersonation token is available, try to
|
/* If no impersonation token is available, try to
|
||||||
authenticate using NtCreateToken () or subauthentication. */
|
authenticate using NtCreateToken () or subauthentication. */
|
||||||
if (new_token == INVALID_HANDLE_VALUE)
|
if (new_token == INVALID_HANDLE_VALUE)
|
||||||
@ -2132,6 +2122,16 @@ seteuid32 (__uid32_t uid)
|
|||||||
cygheap->user.internal_token = new_token;
|
cygheap->user.internal_token = new_token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set process def dacl to allow access to impersonated token */
|
||||||
|
if (sec_acl ((PACL) dacl_buf, true, true, usersid))
|
||||||
|
{
|
||||||
|
tdacl.DefaultDacl = (PACL) dacl_buf;
|
||||||
|
if (!SetTokenInformation (ptok, TokenDefaultDacl,
|
||||||
|
&tdacl, sizeof dacl_buf))
|
||||||
|
debug_printf ("SetTokenInformation"
|
||||||
|
"(TokenDefaultDacl), %E");
|
||||||
|
}
|
||||||
|
|
||||||
if (new_token != ptok)
|
if (new_token != ptok)
|
||||||
{
|
{
|
||||||
/* Avoid having HKCU use default user */
|
/* Avoid having HKCU use default user */
|
||||||
@ -2166,11 +2166,8 @@ success_9x:
|
|||||||
cygheap->user.set_name (pw_new->pw_name);
|
cygheap->user.set_name (pw_new->pw_name);
|
||||||
myself->uid = uid;
|
myself->uid = uid;
|
||||||
groups.ischanged = FALSE;
|
groups.ischanged = FALSE;
|
||||||
if (!issamesid) /* MS KB 199190 */
|
if (!issamesid)
|
||||||
{
|
user_shared_initialize (true);
|
||||||
RegCloseKey (HKEY_CURRENT_USER);
|
|
||||||
user_shared_initialize (true);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
failed:
|
failed:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user