Implement TokenOrigin class for GetTokenInformation

svn path=/trunk/; revision=10487
This commit is contained in:
Gé van Geldorp 2004-08-10 20:13:42 +00:00
parent 03d66eb75a
commit a696f85479
3 changed files with 75 additions and 4 deletions

View file

@ -176,7 +176,14 @@ typedef enum _TOKEN_INFORMATION_CLASS
TokenSource,
TokenType,
TokenImpersonationLevel,
TokenStatistics
TokenStatistics,
TokenRestrictedSids,
TokenSessionId,
TokenGroupsAndPrivileges,
TokenSessionReference,
TokenSandBoxInert,
TokenAuditPolicy,
TokenOrigin
} TOKEN_INFORMATION_CLASS;
typedef ULONG SECURITY_IMPERSONATION_LEVEL, *PSECURITY_IMPERSONATION_LEVEL;
@ -343,6 +350,10 @@ typedef struct _TOKEN_STATISTICS
LUID ModifiedId;
} TOKEN_STATISTICS, *PTOKEN_STATISTICS;
typedef struct _TOKEN_ORIGIN {
LUID OriginatingLogonSession;
} TOKEN_ORIGIN, *PTOKEN_ORIGIN;
typedef struct _GENERIC_MAPPING
{
ACCESS_MASK GenericRead;

View file

@ -1,4 +1,4 @@
/* $Id: token.c,v 1.38 2004/08/03 19:20:39 ion Exp $
/* $Id: token.c,v 1.39 2004/08/10 20:13:42 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -569,7 +569,7 @@ NtQueryInformationToken(IN HANDLE TokenHandle,
IN ULONG TokenInformationLength,
OUT PULONG ReturnLength)
{
NTSTATUS Status;
NTSTATUS Status, LengthStatus;
PVOID UnusedInfo;
PVOID EndMem;
PACCESS_TOKEN Token;
@ -807,6 +807,50 @@ NtQueryInformationToken(IN HANDLE TokenHandle,
Status = STATUS_SUCCESS;
}
break;
case TokenOrigin:
DPRINT1("NtQueryInformationToken(TokenOrigin)\n");
if (TokenInformationLength < sizeof(TOKEN_ORIGIN))
{
Status = STATUS_BUFFER_TOO_SMALL;
}
else
{
Status = MmCopyToCaller(&((PTOKEN_ORIGIN)TokenInformation)->OriginatingLogonSession,
&Token->AuthenticationId, sizeof(LUID));
}
Length = sizeof(TOKEN_ORIGIN);
LengthStatus = MmCopyToCaller(ReturnLength, &Length, sizeof(ULONG));
if (NT_SUCCESS(Status))
{
Status = LengthStatus;
}
break;
case TokenGroupsAndPrivileges:
DPRINT1("NtQueryInformationToken(TokenGroupsAndPrivileges) not implemented\n");
Status = STATUS_NOT_IMPLEMENTED;
break;
case TokenRestrictedSids:
DPRINT1("NtQueryInformationToken(TokenRestrictedSids) not implemented\n");
Status = STATUS_NOT_IMPLEMENTED;
break;
case TokenSandBoxInert:
DPRINT1("NtQueryInformationToken(TokenSandboxInert) not implemented\n");
Status = STATUS_NOT_IMPLEMENTED;
break;
case TokenSessionId:
DPRINT1("NtQueryInformationToken(TokenSessionId) not implemented\n");
Status = STATUS_NOT_IMPLEMENTED;
break;
default:
DPRINT1("NtQueryInformationToken(%d) invalid parameter\n");
Status = STATUS_INVALID_PARAMETER;
break;
}
ObDereferenceObject(Token);

View file

@ -2063,6 +2063,21 @@ typedef struct _TOKEN_GROUPS {
DWORD GroupCount;
SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
} TOKEN_GROUPS,*PTOKEN_GROUPS,*LPTOKEN_GROUPS;
typedef struct _TOKEN_GROUPS_AND_PRIVILEGES {
ULONG SidCount;
ULONG SidLength;
PSID_AND_ATTRIBUTES Sids;
ULONG RestrictedSidCount;
ULONG RestrictedSidLength;
PSID_AND_ATTRIBUTES RestrictedSids;
ULONG PrivilegeCount;
ULONG PrivilegeLength;
PLUID_AND_ATTRIBUTES Privileges;
LUID AuthenticationId;
} TOKEN_GROUPS_AND_PRIVILEGES, *PTOKEN_GROUPS_AND_PRIVILEGES;
typedef struct _TOKEN_ORIGIN {
LUID OriginatingLogonSession;
} TOKEN_ORIGIN, *PTOKEN_ORIGIN;
typedef struct _TOKEN_OWNER {
PSID Owner;
} TOKEN_OWNER,*PTOKEN_OWNER;
@ -2107,7 +2122,8 @@ typedef enum _TOKEN_INFORMATION_CLASS {
TokenUser=1,TokenGroups,TokenPrivileges,TokenOwner,
TokenPrimaryGroup,TokenDefaultDacl,TokenSource,TokenType,
TokenImpersonationLevel,TokenStatistics,TokenRestrictedSids,
TokenSessionId
TokenSessionId,TokenGroupsAndPrivileges,TokenSessionReference,
TokenSandBoxInert,TokenAuditPolicy,TokenOrigin,
} TOKEN_INFORMATION_CLASS;
typedef enum _SID_NAME_USE {
SidTypeUser=1,SidTypeGroup,SidTypeDomain,SidTypeAlias,