ReactOS 0.4.16-dev-401-g45b008d
|
#include <ntoskrnl.h>
#include <debug.h>
Go to the source code of this file.
Macros | |
#define | NDEBUG |
Functions | |
NTSTATUS | SepCreateTokenLock (_Inout_ PTOKEN Token) |
Creates a lock for the token. | |
VOID | SepDeleteTokenLock (_Inout_ PTOKEN Token) |
Deletes a lock of a token. | |
static BOOLEAN | SepCompareSidAndAttributesFromTokens (_In_ PSID_AND_ATTRIBUTES SidArrayToken1, _In_ ULONG CountSidArray1, _In_ PSID_AND_ATTRIBUTES SidArrayToken2, _In_ ULONG CountSidArray2) |
Compares the elements of SID arrays provided by tokens. The elements that are being compared for equality are the SIDs and their attributes. | |
static BOOLEAN | SepComparePrivilegeAndAttributesFromTokens (_In_ PLUID_AND_ATTRIBUTES PrivArrayToken1, _In_ ULONG CountPrivArray1, _In_ PLUID_AND_ATTRIBUTES PrivArrayToken2, _In_ ULONG CountPrivArray2) |
Compares the elements of privilege arrays provided by tokens. The elements that are being compared for equality are the privileges and their attributes. | |
static NTSTATUS | SepCompareTokens (_In_ PTOKEN FirstToken, _In_ PTOKEN SecondToken, _Out_ PBOOLEAN Equal) |
Compares tokens if they're equal based on all the following properties. If all of the said conditions are met then the tokens are deemed as equal. | |
static NTSTATUS | SepImpersonateAnonymousToken (_In_ PETHREAD Thread, _In_ KPROCESSOR_MODE PreviousMode) |
Private function that impersonates the system's anonymous logon token. The major bulk of the impersonation procedure is done here. | |
VOID | SepUpdateSinglePrivilegeFlagToken (_Inout_ PTOKEN Token, _In_ ULONG Index) |
Updates the token's flags based upon the privilege that the token has been granted. The flag can either be taken out or given to the token if the attributes of the specified privilege is enabled or not. | |
BOOLEAN NTAPI | SepTokenIsOwner (_In_ PACCESS_TOKEN _Token, _In_ PSECURITY_DESCRIPTOR SecurityDescriptor, _In_ BOOLEAN TokenLocked) |
Checks if a token belongs to the main user, being the owner. | |
VOID | SepUpdatePrivilegeFlagsToken (_Inout_ PTOKEN Token) |
Updates the token's flags based upon the privilege that the token has been granted. The function uses the private helper, SepUpdateSinglePrivilegeFlagToken, in order to update the flags of a token. | |
VOID | SepRemovePrivilegeToken (_Inout_ PTOKEN Token, _In_ ULONG Index) |
Removes a privilege from the token. | |
VOID | SepRemoveUserGroupToken (_Inout_ PTOKEN Token, _In_ ULONG Index) |
Removes a group from the token. | |
ULONG | SepComputeAvailableDynamicSpace (_In_ ULONG DynamicCharged, _In_ PSID PrimaryGroup, _In_opt_ PACL DefaultDacl) |
Computes the exact available dynamic area of an access token whilst querying token statistics. | |
NTSTATUS | SepRebuildDynamicPartOfToken (_Inout_ PTOKEN AccessToken, _In_ ULONG NewDynamicPartSize) |
Re-builds the dynamic part area of an access token during an a default DACL or primary group replacement within the said token if the said dynamic area can't hold the new security content. | |
VOID NTAPI | SepFreeProxyData (_Inout_ PVOID ProxyData) |
Frees (de-allocates) the proxy data memory block of a token. | |
NTSTATUS NTAPI | SepCopyProxyData (_Out_ PVOID *Dest, _In_ PVOID Src) |
Copies the proxy data from the source into the destination of a token. | |
NTSTATUS NTAPI | SeExchangePrimaryToken (_In_ PEPROCESS Process, _In_ PACCESS_TOKEN NewAccessToken, _Out_ PACCESS_TOKEN *OldAccessToken) |
Replaces the old access token of a process (pointed by the EPROCESS kernel structure) with a new access token. The new access token must be a primary token for use. | |
VOID NTAPI | SeDeassignPrimaryToken (_Inout_ PEPROCESS Process) |
Removes the primary token of a process. | |
ULONG | RtlLengthSidAndAttributes (_In_ ULONG Count, _In_ PSID_AND_ATTRIBUTES Src) |
Computes the length size of a SID. | |
NTSTATUS | SepFindPrimaryGroupAndDefaultOwner (_In_ PTOKEN Token, _In_ PSID PrimaryGroup, _In_opt_ PSID DefaultOwner, _Out_opt_ PULONG PrimaryGroupIndex, _Out_opt_ PULONG DefaultOwnerIndex) |
Finds the primary group and default owner entity based on the submitted primary group instance and an access token. | |
static NTSTATUS | SepOpenThreadToken (_In_ PETHREAD Thread, _In_ HANDLE ThreadHandle, _In_ PTOKEN ThreadToken, _In_ ACCESS_MASK DesiredAccess, _In_ ULONG HandleAttributes, _In_ BOOLEAN EffectiveOnly, _In_ BOOLEAN CopyOnOpen, _In_ SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, _In_ KPROCESSOR_MODE PreviousMode, _Out_ PHANDLE OpenedTokenHandle) |
Internal private function that returns an opened handle of an access token associated with a thread. | |
NTSTATUS NTAPI | SeSubProcessToken (_In_ PTOKEN ParentToken, _Out_ PTOKEN *Token, _In_ BOOLEAN InUse, _In_ ULONG SessionId) |
Subtracts a token in exchange of duplicating a new one. | |
NTSTATUS NTAPI | SeIsTokenChild (_In_ PTOKEN Token, _Out_ PBOOLEAN IsChild) |
Checks if the token is a child of the other token of the current process that the calling thread is invoking this function. | |
NTSTATUS NTAPI | SeIsTokenSibling (_In_ PTOKEN Token, _Out_ PBOOLEAN IsSibling) |
Checks if the token is a sibling of the other token of the current process that the calling thread is invoking this function. | |
NTSTATUS NTAPI | SeCopyClientToken (_In_ PACCESS_TOKEN Token, _In_ SECURITY_IMPERSONATION_LEVEL Level, _In_ KPROCESSOR_MODE PreviousMode, _Out_ PACCESS_TOKEN *NewToken) |
Copies an existing access token (technically duplicating a new one). | |
BOOLEAN NTAPI | SeTokenIsInert (_In_ PTOKEN Token) |
Determines if a token is a sandbox inert token or not, based upon the token flags. | |
VOID NTAPI | SepDeleteToken (_In_ PVOID ObjectBody) |
Internal function that deals with access token object destruction and deletion. The function is used solely by the object manager mechanism that handles the life management of a token object. | |
VOID NTAPI | SepInitializeTokenImplementation (VOID) |
Internal function that initializes critical kernel data for access token implementation in SRM. | |
VOID NTAPI | SeAssignPrimaryToken (_In_ PEPROCESS Process, _In_ PTOKEN Token) |
Assigns a primary access token to a given process. | |
VOID NTAPI | SeGetTokenControlInformation (_In_ PACCESS_TOKEN _Token, _Out_ PTOKEN_CONTROL TokenControl) |
Retrieves token control information. | |
PTOKEN NTAPI | SepCreateSystemProcessToken (VOID) |
Creates the system process token. | |
PTOKEN | SepCreateSystemAnonymousLogonToken (VOID) |
Creates the anonymous logon token for the system. The difference between this token and the other one is the inclusion of everyone SID group (being SeWorldSid). The other token lacks such group. | |
PTOKEN | SepCreateSystemAnonymousLogonTokenNoEveryone (VOID) |
Creates the anonymous logon token for the system. This kind of token doesn't include the everyone SID group (being SeWorldSid). | |
NTSTATUS NTAPI | SeQuerySessionIdToken (_In_ PACCESS_TOKEN Token, _Out_ PULONG pSessionId) |
Queries the session ID of an access token. | |
NTSTATUS NTAPI | SeQueryAuthenticationIdToken (_In_ PACCESS_TOKEN Token, _Out_ PLUID LogonId) |
Queries the authentication ID of an access token. | |
SECURITY_IMPERSONATION_LEVEL NTAPI | SeTokenImpersonationLevel (_In_ PACCESS_TOKEN Token) |
Gathers the security impersonation level of an access token. | |
TOKEN_TYPE NTAPI | SeTokenType (_In_ PACCESS_TOKEN Token) |
Gathers the token type of an access token. A token ca be either a primary token or impersonation token. | |
BOOLEAN NTAPI | SeTokenIsAdmin (_In_ PACCESS_TOKEN Token) |
Determines if a token is either an admin token or not. Such condition is checked based upon TOKEN_HAS_ADMIN_GROUP flag, which means if the respective access token belongs to an administrator group or not. | |
BOOLEAN NTAPI | SeTokenIsRestricted (_In_ PACCESS_TOKEN Token) |
Determines if a token is restricted or not, based upon the token flags. | |
BOOLEAN NTAPI | SeTokenIsWriteRestricted (_In_ PACCESS_TOKEN Token) |
Determines if a token is write restricted, that is, nobody can write anything to it. | |
BOOLEAN NTAPI | SeTokenCanImpersonate (_In_ PTOKEN ProcessToken, _In_ PTOKEN TokenToImpersonate, _In_ SECURITY_IMPERSONATION_LEVEL ImpersonationLevel) |
Determines whether the server is allowed to impersonate on behalf of a client or not. For further details, see Remarks. | |
NTSTATUS NTAPI | NtOpenThreadTokenEx (_In_ HANDLE ThreadHandle, _In_ ACCESS_MASK DesiredAccess, _In_ BOOLEAN OpenAsSelf, _In_ ULONG HandleAttributes, _Out_ PHANDLE TokenHandle) |
Opens a token that is tied to a thread handle. | |
NTSTATUS NTAPI | NtOpenThreadToken (_In_ HANDLE ThreadHandle, _In_ ACCESS_MASK DesiredAccess, _In_ BOOLEAN OpenAsSelf, _Out_ PHANDLE TokenHandle) |
Opens a token that is tied to a thread handle. | |
NTSTATUS NTAPI | NtCompareTokens (_In_ HANDLE FirstTokenHandle, _In_ HANDLE SecondTokenHandle, _Out_ PBOOLEAN Equal) |
Compares tokens if they're equal or not. | |
NTSTATUS NTAPI | NtImpersonateAnonymousToken (_In_ HANDLE ThreadHandle) |
Allows the calling thread to impersonate the system's anonymous logon token. | |
Variables | |
POBJECT_TYPE | SeTokenObjectType = NULL |
TOKEN_SOURCE | SeSystemTokenSource = {"*SYSTEM*", {0}} |
LUID | SeSystemAuthenticationId = SYSTEM_LUID |
LUID | SeAnonymousAuthenticationId = ANONYMOUS_LOGON_LUID |
static GENERIC_MAPPING | SepTokenMapping |
NTSTATUS NTAPI NtCompareTokens | ( | _In_ HANDLE | FirstTokenHandle, |
_In_ HANDLE | SecondTokenHandle, | ||
_Out_ PBOOLEAN | Equal | ||
) |
Compares tokens if they're equal or not.
[in] | FirstToken | The first token. |
[in] | SecondToken | The second token. |
[out] | Equal | The retrieved value which determines if the tokens are equal or not. |
Definition at line 2503 of file token.c.
Referenced by START_TEST().
Allows the calling thread to impersonate the system's anonymous logon token.
[in] | ThreadHandle | A handle to the thread to start the procedure of logon token impersonation. The thread must have the THREAD_IMPERSONATE access right. |
Definition at line 2612 of file token.c.
Referenced by ImpersonateAnonymousToken(), and START_TEST().
NTSTATUS NTAPI NtOpenThreadToken | ( | _In_ HANDLE | ThreadHandle, |
_In_ ACCESS_MASK | DesiredAccess, | ||
_In_ BOOLEAN | OpenAsSelf, | ||
_Out_ PHANDLE | TokenHandle | ||
) |
Opens a token that is tied to a thread handle.
[out] | ThreadHandle | Thread handle where the token is about to be opened. |
[in] | DesiredAccess | The request access right for the token. |
[in] | OpenAsSelf | If set to TRUE, the access check will be made with the security context of the process of the calling thread (opening as self). Otherwise the access check will be made with the security context of the calling thread instead. |
[out] | TokenHandle | The opened token handle returned to the caller for use. |
Definition at line 2474 of file token.c.
Referenced by BaseGetNamedObjectDirectory(), CheckTokenMembership(), CreateProcessAsUserCommon(), CsrGetProcessLuid(), GetCallerLuid(), LsarSetSecurityObject(), NetpGetClientLogonId(), NpGetUserNamep(), OpenThreadToken(), RSetServiceObjectSecurity(), RtlDefaultNpAcl(), RtlNewSecurityGrantedAccess(), RtlpGetImpersonationToken(), and START_TEST().
NTSTATUS NTAPI NtOpenThreadTokenEx | ( | _In_ HANDLE | ThreadHandle, |
_In_ ACCESS_MASK | DesiredAccess, | ||
_In_ BOOLEAN | OpenAsSelf, | ||
_In_ ULONG | HandleAttributes, | ||
_Out_ PHANDLE | TokenHandle | ||
) |
Opens a token that is tied to a thread handle.
[out] | ThreadHandle | Thread handle where the token is about to be opened. |
[in] | DesiredAccess | The request access right for the token. |
[in] | OpenAsSelf | If set to TRUE, the access check will be made with the security context of the process of the calling thread (opening as self). Otherwise the access check will be made with the security context of the calling thread instead. |
[in] | HandleAttributes | Handle attributes for the opened thread token handle. |
[out] | TokenHandle | The opened token handle returned to the caller for use. |
Definition at line 2331 of file token.c.
Referenced by NtOpenThreadToken(), and START_TEST().
ULONG RtlLengthSidAndAttributes | ( | _In_ ULONG | Count, |
_In_ PSID_AND_ATTRIBUTES | Src | ||
) |
Computes the length size of a SID.
[in] | Count | Total count of entries that have SIDs in them (that being PSID_AND_ATTRIBUTES in this context). |
[in] | Src | Source that points to the attributes and SID entry structure. |
Definition at line 965 of file token.c.
Referenced by NtQueryInformationToken(), SepPerformTokenFiltering(), and SeQueryInformationToken().
Assigns a primary access token to a given process.
[in] | Process | Process where the token is about to be assigned. |
[in] | Token | The token to be assigned. |
Definition at line 1686 of file token.c.
NTSTATUS NTAPI SeCopyClientToken | ( | _In_ PACCESS_TOKEN | Token, |
_In_ SECURITY_IMPERSONATION_LEVEL | Level, | ||
_In_ KPROCESSOR_MODE | PreviousMode, | ||
_Out_ PACCESS_TOKEN * | NewToken | ||
) |
Copies an existing access token (technically duplicating a new one).
[in] | Token | Token to copy. |
[in] | Level | Impersonation security level to assign to the newly copied token. |
[in] | PreviousMode | Processor request level mode. |
[out] | NewToken | The newly copied token. |
Definition at line 1542 of file token.c.
Referenced by PsImpersonateClient(), and SepCreateClientSecurity().
Removes the primary token of a process.
[in,out] | Process | The process instance with the access token to be removed. |
Definition at line 936 of file token.c.
Referenced by PspDeleteProcessSecurity(), and SeAssignPrimaryToken().
NTSTATUS NTAPI SeExchangePrimaryToken | ( | _In_ PEPROCESS | Process, |
_In_ PACCESS_TOKEN | NewAccessToken, | ||
_Out_ PACCESS_TOKEN * | OldAccessToken | ||
) |
Replaces the old access token of a process (pointed by the EPROCESS kernel structure) with a new access token. The new access token must be a primary token for use.
[in] | Process | The process instance where its access token is about to be replaced. |
[in] | NewAccessToken | The new token that it's going to replace the old one. |
[out] | OldAccessToken | The returned old token that's been replaced, which the caller can do anything. |
Definition at line 846 of file token.c.
Referenced by PspAssignPrimaryToken().
VOID NTAPI SeGetTokenControlInformation | ( | _In_ PACCESS_TOKEN | _Token, |
_Out_ PTOKEN_CONTROL | TokenControl | ||
) |
Retrieves token control information.
[in] | _Token | A valid token object. |
[out] | SecurityDescriptor | The returned token control information. |
Definition at line 1720 of file token.c.
Referenced by SepCreateClientSecurity().
Checks if the token is a child of the other token of the current process that the calling thread is invoking this function.
[in] | Token | An access token to determine if it's a child or not. |
[out] | IsChild | The returned boolean result. |
Definition at line 1433 of file token.c.
Referenced by PspSetPrimaryToken().
Checks if the token is a sibling of the other token of the current process that the calling thread is invoking this function.
[in] | Token | An access token to determine if it's a sibling or not. |
[out] | IsSibling | The returned boolean result. |
Definition at line 1482 of file token.c.
Referenced by PspSetPrimaryToken().
|
static |
Compares the elements of privilege arrays provided by tokens. The elements that are being compared for equality are the privileges and their attributes.
[in] | PrivArrayToken1 | Privilege array from the first token. |
[in] | CountPrivArray1 | Privilege count array from the first token. |
[in] | PrivArrayToken2 | Privilege array from the second token. |
[in] | CountPrivArray2 | Privilege count array from the second token. |
Definition at line 174 of file token.c.
Referenced by SepCompareTokens().
|
static |
Compares the elements of SID arrays provided by tokens. The elements that are being compared for equality are the SIDs and their attributes.
[in] | SidArrayToken1 | SID array from the first token. |
[in] | CountSidArray1 | SID count array from the first token. |
[in] | SidArrayToken2 | SID array from the second token. |
[in] | CountSidArray2 | SID count array from the second token. |
Definition at line 107 of file token.c.
Referenced by SepCompareTokens().
|
static |
Compares tokens if they're equal based on all the following properties. If all of the said conditions are met then the tokens are deemed as equal.
[in] | FirstToken | The first token. |
[in] | SecondToken | The second token. |
[out] | Equal | The retrieved value which determines if the tokens are equal or not. |
Definition at line 243 of file token.c.
Referenced by NtCompareTokens(), and SeExchangePrimaryToken().
ULONG SepComputeAvailableDynamicSpace | ( | _In_ ULONG | DynamicCharged, |
_In_ PSID | PrimaryGroup, | ||
_In_opt_ PACL | DefaultDacl | ||
) |
Computes the exact available dynamic area of an access token whilst querying token statistics.
[in] | DynamicCharged | The current charged dynamic area of an access token. This must not be 0! |
[in] | PrimaryGroup | A pointer to a primary group SID. |
[in] | DefaultDacl | If provided, this pointer points to a default DACL of an access token. |
Definition at line 659 of file token.c.
Referenced by NtQueryInformationToken(), and SeQueryInformationToken().
Copies the proxy data from the source into the destination of a token.
@unimplemented
[out] | Dest | The destination path where the proxy data is to be copied to. |
[in] | Src | The source path where the proxy data is be copied from. |
Creates the anonymous logon token for the system. The difference between this token and the other one is the inclusion of everyone SID group (being SeWorldSid). The other token lacks such group.
Definition at line 1868 of file token.c.
Referenced by SepInitializationPhase0().
Creates the anonymous logon token for the system. This kind of token doesn't include the everyone SID group (being SeWorldSid).
Definition at line 1938 of file token.c.
Referenced by SepInitializationPhase0().
Creates the system process token.
Definition at line 1753 of file token.c.
Referenced by SepInitializationPhase0().
Creates a lock for the token.
Definition at line 45 of file token.c.
Referenced by SepCreateToken(), SepDuplicateToken(), and SepPerformTokenFiltering().
Internal function that deals with access token object destruction and deletion. The function is used solely by the object manager mechanism that handles the life management of a token object.
[in] | ObjectBody | The object body that represents an access token object. |
Definition at line 1605 of file token.c.
Referenced by SepInitializeTokenImplementation().
Deletes a lock of a token.
Definition at line 74 of file token.c.
Referenced by SepDeleteToken().
NTSTATUS SepFindPrimaryGroupAndDefaultOwner | ( | _In_ PTOKEN | Token, |
_In_ PSID | PrimaryGroup, | ||
_In_opt_ PSID | DefaultOwner, | ||
_Out_opt_ PULONG | PrimaryGroupIndex, | ||
_Out_opt_ PULONG | DefaultOwnerIndex | ||
) |
Finds the primary group and default owner entity based on the submitted primary group instance and an access token.
[in] | Token | Access token to begin the search query of primary group and default owner. |
[in] | PrimaryGroup | A primary group SID to be used for search query, determining if user & groups of a token and the submitted primary group do match. |
[in] | DefaultOwner | The default owner. If specified, it's used to determine if the token belongs to the actual user, that is, being the owner himself. |
[out] | PrimaryGroupIndex | Returns the primary group index. |
[out] | DefaultOwnerIndex | Returns the default owner index. |
Definition at line 1011 of file token.c.
Referenced by NtSetInformationToken(), SepCreateToken(), SepDuplicateToken(), and SepPerformTokenFiltering().
Frees (de-allocates) the proxy data memory block of a token.
@unimplemented
[in,out] | ProxyData | The proxy data to be freed. |
|
static |
Private function that impersonates the system's anonymous logon token. The major bulk of the impersonation procedure is done here.
[in] | Thread | The executive thread object that is to impersonate the client. |
[in] | PreviousMode | The access processor mode, indicating if the call is executed in kernel or user mode. |
Definition at line 334 of file token.c.
Referenced by NtImpersonateAnonymousToken().
Internal function that initializes critical kernel data for access token implementation in SRM.
Definition at line 1649 of file token.c.
Referenced by SepInitializationPhase0().
|
static |
Internal private function that returns an opened handle of an access token associated with a thread.
[in] | Thread | A pointer to a Executive thread. This parameter is used to validate that the newly obtained thread in this function hasn't diverged. This could potentially lead to a scenario that we might get an access token from a different token which is not what we want. The validation is performed if the token has to copied and can't be opened directly. |
[in] | ThreadHandle | A handle to a thread, of which an access token is to be opened and given from that thread. |
[in] | ThreadToken | A pointer to an access token associated with the specific thread. The function assumes that the token is an impersonation one prior the calling of this function. |
[in] | DesiredAccess | The desired access rights for the access token. |
[in] | HandleAttributes | Handle attributes of which they are used for the newly creation of the opened thread token. The function assumes that they have been validated prior the calling of this function. |
[in] | EffectiveOnly | If set to TRUE, the function will copy a new access token with privileges and groups that are effectively enabled. Any disabled privilege or group is removed from the copied token. Otherwise if set to FALSE, the function retains all the enabled and disabled privielges and groups. |
[in] | CopyOnOpen | If set to TRUE, it tells the function that the access token cannot be directly opened due to the security impersonation info of the associated thread being enforced. In this case the function will make a copy of the said token by duplicating it. Otherwise if set to FALSE, the function will just open the access token directly. |
[in] | ImpersonationLevel | The security impersonation level, at which it is allowed to access the token. |
[in] | PreviousMode | The processor request level mode. |
[out] | OpenedTokenHandle | A pointer to an opened access token handle associated with the specific thread, returned to the caller. Initially this parameter is set to NULL and if the function fails to open the thread's token, it will stay NULL. |
Definition at line 1170 of file token.c.
Referenced by NtOpenThreadTokenEx().
Re-builds the dynamic part area of an access token during an a default DACL or primary group replacement within the said token if the said dynamic area can't hold the new security content.
[in] | AccessToken | A pointer to an access token where its dynamic part is to be re-built and expanded based upon the new dynamic part size provided by the caller. Dynamic part expansion is not always guaranteed. See Remarks for further information. |
[in] | NewDynamicPartSize | The new dynamic part size. |
Definition at line 715 of file token.c.
Removes a privilege from the token.
[in,out] | Token | The token where the privilege is to be removed. |
[in] | Index | The index count which represents the number position of the privilege we want to remove. |
Definition at line 582 of file token.c.
Referenced by SepAdjustPrivileges(), SepDuplicateToken(), and SepPerformTokenFiltering().
Removes a group from the token.
[in,out] | Token | The token where the group is to be removed. |
[in] | Index | The index count which represents the number position of the group we want to remove. |
Definition at line 618 of file token.c.
Referenced by SepDuplicateToken().
BOOLEAN NTAPI SepTokenIsOwner | ( | _In_ PACCESS_TOKEN | _Token, |
_In_ PSECURITY_DESCRIPTOR | SecurityDescriptor, | ||
_In_ BOOLEAN | TokenLocked | ||
) |
Checks if a token belongs to the main user, being the owner.
[in] | _Token | A valid token object. |
[in] | SecurityDescriptor | A security descriptor where the owner is to be found. |
[in] | TokenLocked | If set to TRUE, the token has been already locked and there's no need to lock it again. Otherwise the function will acquire the lock. |
Definition at line 511 of file token.c.
Referenced by SeAccessCheck(), and SepAccessCheck().
Updates the token's flags based upon the privilege that the token has been granted. The function uses the private helper, SepUpdateSinglePrivilegeFlagToken, in order to update the flags of a token.
[in,out] | Token | The token where the flags are to be changed. |
Definition at line 554 of file token.c.
Referenced by SepCreateToken().
Updates the token's flags based upon the privilege that the token has been granted. The flag can either be taken out or given to the token if the attributes of the specified privilege is enabled or not.
[in,out] | Token | The token where the flags are to be changed. |
[in] | Index | The index count which represents the total sum of privileges. The count in question MUST NOT exceed the expected privileges count of the token. |
Definition at line 442 of file token.c.
Referenced by SepAdjustPrivileges(), SepPerformTokenFiltering(), and SepUpdatePrivilegeFlagsToken().
Queries the authentication ID of an access token.
[in] | Token | A valid access token where the authentication ID has to be gathered. |
[out] | pSessionId | The returned pointer to an authentication ID to the caller. |
Definition at line 2036 of file token.c.
Referenced by GetProcessLuid(), KsecGetKeyData(), nfs41_GetLUID(), NtSetUuidSeed(), ObpReferenceDeviceMap(), ObpSetCurrentProcessDeviceMap(), RxGetUid(), and RxInitializeVNetRootParameters().
Queries the session ID of an access token.
[in] | Token | A valid access token where the session ID has to be gathered. |
[out] | pSessionId | The returned pointer to a session ID to the caller. |
Definition at line 2004 of file token.c.
Referenced by NtQueryInformationToken(), RxGetSessionId(), RxInitializeVNetRootParameters(), and SeQueryInformationToken().
NTSTATUS NTAPI SeSubProcessToken | ( | _In_ PTOKEN | ParentToken, |
_Out_ PTOKEN * | Token, | ||
_In_ BOOLEAN | InUse, | ||
_In_ ULONG | SessionId | ||
) |
Subtracts a token in exchange of duplicating a new one.
[in] | ParentToken | The parent access token for duplication. |
[out] | Token | The new duplicated token. |
[in] | InUse | Set this to TRUE if the token is about to be used immediately after the call execution of this function, FALSE otherwise. |
[in] | SessionId | Session ID for the token to be assigned. |
Definition at line 1373 of file token.c.
Referenced by PspInitializeProcessSecurity().
BOOLEAN NTAPI SeTokenCanImpersonate | ( | _In_ PTOKEN | ProcessToken, |
_In_ PTOKEN | TokenToImpersonate, | ||
_In_ SECURITY_IMPERSONATION_LEVEL | ImpersonationLevel | ||
) |
Determines whether the server is allowed to impersonate on behalf of a client or not. For further details, see Remarks.
[in] | ProcessToken | A pointer to the primary access token of the server process that requests impersonation of the client target. |
[in] | TokenToImpersonate | A pointer to an access token that represents a client that is to be impersonated. |
[in] | ImpersonationLevel | The requested impersonation level. |
If the associated access token that represents the security properties of the server is granted the SeImpersonatePrivilege privilege the server is given immediate impersonation, regardless of the conditions above. If the client in question is associated with an anonymous token then the server is given immediate impersonation. Or if the server simply doesn't ask for impersonation but instead it wants to get the security identification of a client, the server is given immediate impersonation.
Definition at line 2207 of file token.c.
Referenced by PsImpersonateClient().
SECURITY_IMPERSONATION_LEVEL NTAPI SeTokenImpersonationLevel | ( | _In_ PACCESS_TOKEN | Token | ) |
Gathers the security impersonation level of an access token.
Definition at line 2059 of file token.c.
Referenced by PsAssignImpersonationToken().
BOOLEAN NTAPI SeTokenIsAdmin | ( | _In_ PACCESS_TOKEN | Token | ) |
Determines if a token is either an admin token or not. Such condition is checked based upon TOKEN_HAS_ADMIN_GROUP flag, which means if the respective access token belongs to an administrator group or not.
Definition at line 2103 of file token.c.
Referenced by PsImpersonateClient(), and SepAccessCheckWorker().
Determines if a token is a sandbox inert token or not, based upon the token flags.
Definition at line 1583 of file token.c.
Referenced by NtQueryInformationToken().
BOOLEAN NTAPI SeTokenIsRestricted | ( | _In_ PACCESS_TOKEN | Token | ) |
Determines if a token is restricted or not, based upon the token flags.
Definition at line 2126 of file token.c.
Referenced by NtQueryInformationToken(), PsImpersonateClient(), RxInitializeVNetRootParameters(), SepAccessCheckWorker(), SepCompareTokens(), SepDumpTokenDebugInfo(), SepImpersonateAnonymousToken(), and SeTokenCanImpersonate().
BOOLEAN NTAPI SeTokenIsWriteRestricted | ( | _In_ PACCESS_TOKEN | Token | ) |
Determines if a token is write restricted, that is, nobody can write anything to it.
Definition at line 2151 of file token.c.
TOKEN_TYPE NTAPI SeTokenType | ( | _In_ PACCESS_TOKEN | Token | ) |
Gathers the token type of an access token. A token ca be either a primary token or impersonation token.
LUID SeAnonymousAuthenticationId = ANONYMOUS_LOGON_LUID |
Definition at line 21 of file token.c.
Referenced by SepCreateSystemAnonymousLogonToken(), SepCreateSystemAnonymousLogonTokenNoEveryone(), SepRmDeleteLogonSession(), SeRmInitPhase0(), and SeTokenCanImpersonate().
|
static |
Definition at line 23 of file token.c.
Referenced by SepInitializeTokenImplementation().
LUID SeSystemAuthenticationId = SYSTEM_LUID |
Definition at line 20 of file token.c.
Referenced by SepCreateSystemProcessToken(), SepRmDeleteLogonSession(), and SeRmInitPhase0().
TOKEN_SOURCE SeSystemTokenSource = {"*SYSTEM*", {0}} |
Definition at line 19 of file token.c.
Referenced by SepCreateSystemAnonymousLogonToken(), SepCreateSystemAnonymousLogonTokenNoEveryone(), and SepCreateSystemProcessToken().
POBJECT_TYPE SeTokenObjectType = NULL |
Definition at line 17 of file token.c.
Referenced by NtAdjustGroupsToken(), NtAdjustPrivilegesToken(), NtCompareTokens(), NtDuplicateToken(), NtFilterToken(), NtOpenObjectAuditAlarm(), NtOpenProcessTokenEx(), NtPrivilegeCheck(), NtPrivilegedServiceAuditAlarm(), NtQueryInformationToken(), NtSetInformationToken(), PsAssignImpersonationToken(), PspAssignPrimaryToken(), PspSetPrimaryToken(), SepAccessCheck(), SepAccessCheckAndAuditAlarm(), SepCreateToken(), SepDuplicateToken(), SepImpersonateAnonymousToken(), SepInitializeTokenImplementation(), SepOpenThreadToken(), SepPerformTokenFiltering(), and TestObjectTypes().