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

@ -488,7 +488,6 @@ sid_in_token_groups (PTOKEN_GROUPS grps, cygpsid sid)
return false;
}
#if 0 && S4U_RUNS_FINE
static void
get_token_group_sidlist (cygsidlist &grp_list, PTOKEN_GROUPS my_grps)
{
@ -524,7 +523,6 @@ get_token_group_sidlist (cygsidlist &grp_list, PTOKEN_GROUPS my_grps)
grp_list *= well_known_users_sid;
}
}
#endif
bool
get_server_groups (cygsidlist &grp_list, PSID usersid,
@ -558,7 +556,6 @@ get_server_groups (cygsidlist &grp_list, PSID usersid,
&& sid_sub_auth (usersid, 0) == SECURITY_NT_NON_UNIQUE
&& get_logon_server (domain, server, DS_IS_FLAT_NAME))
{
#if 0 && S4U_RUNS_FINE
if (check_account_disabled == CHK_DISABLED)
{
NET_API_STATUS napi_stat;
@ -577,14 +574,12 @@ get_server_groups (cygsidlist &grp_list, PSID usersid,
return false;
}
}
#endif
get_user_groups (server, grp_list, user, domain);
get_user_local_groups (server, domain, grp_list, user);
}
return true;
}
#if 0 && S4U_RUNS_FINE
static bool
get_initgroups_sidlist (cygsidlist &grp_list, PSID usersid, PSID pgrpsid,
PTOKEN_GROUPS my_grps)
@ -762,7 +757,6 @@ get_priv_list (LSA_HANDLE lsa, cygsid &usersid, cygsidlist &grp_list,
}
return privs;
}
#endif
/* Accept a token if
- the requested usersid matches the TokenUser and
@ -906,7 +900,6 @@ account_restriction (NTSTATUS status)
return type;
}
#if 0 && S4U_RUNS_FINE
HANDLE
create_token (cygsid &usersid, user_groups &new_groups)
{
@ -1061,6 +1054,7 @@ out:
return primary_token;
}
#if 0 && S4U_RUNS_FINE
HANDLE
lsaauth (cygsid &usersid, user_groups &new_groups)
{
@ -1434,7 +1428,7 @@ typedef struct _MSV1_0_S4U_LOGON
} MSV1_0_S4U_LOGON, *PMSV1_0_S4U_LOGON;
HANDLE
s4uauth (struct passwd *pw)
s4uauth (struct passwd *pw, NTSTATUS &ret_status)
{
LSA_STRING name;
HANDLE lsa_hdl = NULL;
@ -1614,5 +1608,6 @@ out:
LsaFreeReturnBuffer (profile);
pop_self_privilege ();
ret_status = status;
return token;
}