ntdll: Support TokenLogonSid in NtQueryInformationToken.
Based on a patch by Andrew Wesie. Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8ce7f782cc
commit
4bbbc261d1
|
@ -1843,11 +1843,11 @@ static void test_token_attr(void)
|
||||||
todo_wine win_skip("TokenLogonSid not supported. Skipping tests\n");
|
todo_wine win_skip("TokenLogonSid not supported. Skipping tests\n");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
todo_wine ok(!ret && (GetLastError() == ERROR_INSUFFICIENT_BUFFER),
|
ok(!ret && (GetLastError() == ERROR_INSUFFICIENT_BUFFER),
|
||||||
"GetTokenInformation(TokenLogonSid) failed with error %d\n", GetLastError());
|
"GetTokenInformation(TokenLogonSid) failed with error %d\n", GetLastError());
|
||||||
Groups = HeapAlloc(GetProcessHeap(), 0, Size);
|
Groups = HeapAlloc(GetProcessHeap(), 0, Size);
|
||||||
ret = GetTokenInformation(Token, TokenLogonSid, Groups, Size, &Size);
|
ret = GetTokenInformation(Token, TokenLogonSid, Groups, Size, &Size);
|
||||||
todo_wine ok(ret,
|
ok(ret,
|
||||||
"GetTokenInformation(TokenLogonSid) failed with error %d\n", GetLastError());
|
"GetTokenInformation(TokenLogonSid) failed with error %d\n", GetLastError());
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
|
|
|
@ -552,6 +552,27 @@ NTSTATUS WINAPI NtQueryInformationToken(
|
||||||
*(DWORD*)tokeninfo = 0;
|
*(DWORD*)tokeninfo = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case TokenLogonSid:
|
||||||
|
SERVER_START_REQ( get_token_sid )
|
||||||
|
{
|
||||||
|
TOKEN_GROUPS * groups = tokeninfo;
|
||||||
|
PSID sid = groups + 1;
|
||||||
|
DWORD sid_len = tokeninfolength < sizeof(TOKEN_GROUPS) ? 0 : tokeninfolength - sizeof(TOKEN_GROUPS);
|
||||||
|
|
||||||
|
req->handle = wine_server_obj_handle( token );
|
||||||
|
req->which_sid = tokeninfoclass;
|
||||||
|
wine_server_set_reply( req, sid, sid_len );
|
||||||
|
status = wine_server_call( req );
|
||||||
|
if (retlen) *retlen = reply->sid_len + sizeof(TOKEN_GROUPS);
|
||||||
|
if (status == STATUS_SUCCESS)
|
||||||
|
{
|
||||||
|
groups->GroupCount = 1;
|
||||||
|
groups->Groups[0].Sid = sid;
|
||||||
|
groups->Groups[0].Attributes = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SERVER_END_REQ;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
ERR("Unhandled Token Information class %d!\n", tokeninfoclass);
|
ERR("Unhandled Token Information class %d!\n", tokeninfoclass);
|
||||||
|
|
|
@ -92,6 +92,13 @@ static const struct /* same fields as struct SID */
|
||||||
SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
|
SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
|
||||||
DWORD SubAuthority[2];
|
DWORD SubAuthority[2];
|
||||||
} builtin_users_sid = { SID_REVISION, 2, { SECURITY_NT_AUTHORITY }, { SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_USERS } };
|
} builtin_users_sid = { SID_REVISION, 2, { SECURITY_NT_AUTHORITY }, { SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_USERS } };
|
||||||
|
static const struct /* same fields as struct SID */
|
||||||
|
{
|
||||||
|
BYTE Revision;
|
||||||
|
BYTE SubAuthorityCount;
|
||||||
|
SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
|
||||||
|
DWORD SubAuthority[SECURITY_LOGON_IDS_RID_COUNT];
|
||||||
|
} builtin_logon_sid = { SID_REVISION, SECURITY_LOGON_IDS_RID_COUNT, {SECURITY_NT_AUTHORITY}, {SECURITY_LOGON_IDS_RID, 0, 0} };
|
||||||
|
|
||||||
const PSID security_world_sid = (PSID)&world_sid;
|
const PSID security_world_sid = (PSID)&world_sid;
|
||||||
static const PSID security_local_sid = (PSID)&local_sid;
|
static const PSID security_local_sid = (PSID)&local_sid;
|
||||||
|
@ -1436,6 +1443,9 @@ DECL_HANDLER(get_token_sid)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case TokenLogonSid:
|
||||||
|
sid = (const SID *)&builtin_logon_sid;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
set_error( STATUS_INVALID_PARAMETER );
|
set_error( STATUS_INVALID_PARAMETER );
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue