Cygwin: re-enable create_token for older systems

Under WOW64 on 64 bit Windows 7, MsV1_0S4ULogon appears to be
unimplemented, probably under Vista as well.  Re-enable
create_token method, to allow basic seteuid on W7 WOW64 and
Vista as well.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen
2019-02-18 21:00:59 +01:00
parent a96d68c5bd
commit e53373bbdb
5 changed files with 36 additions and 29 deletions

View File

@@ -3564,31 +3564,29 @@ seteuid32 (uid_t uid)
}
if (!new_token)
{
#if 1
NTSTATUS status;
debug_printf ("lsaprivkeyauth failed, try s4uauth.");
if (!(new_token = s4uauth (pw_new)))
if (!(new_token = s4uauth (pw_new, status)))
{
debug_printf ("s4uauth failed, bail out");
cygheap->user.reimpersonate ();
return -1;
}
#else
debug_printf ("lsaprivkeyauth failed, try lsaauth.");
if (!(new_token = lsaauth (usersid, groups)))
{
debug_printf ("lsaauth failed, try s4uauth.");
if (!(new_token = s4uauth (pw_new)))
if (status != STATUS_INVALID_PARAMETER)
{
debug_printf ("s4uauth failed, try create_token.");
if (!(new_token = create_token (usersid, groups)))
{
debug_printf ("create_token failed, bail out");
cygheap->user.reimpersonate ();
return -1;
}
debug_printf ("s4uauth failed, bail out");
cygheap->user.reimpersonate ();
return -1;
}
/* If s4uauth fails with status code STATUS_INVALID_PARAMETER,
we're running on a system not implementing MsV1_0S4ULogon
(Windows 7 WOW64, Vista?). Fall back to create_token in
this single case only. */
debug_printf ("s4uauth failed, try create_token.");
if (!(new_token = create_token (usersid, groups)))
{
debug_printf ("create_token failed, bail out");
cygheap->user.reimpersonate ();
return -1;
}
}
#endif
}
/* Keep at most one internal token */