mirror of
https://github.com/reactos/reactos.git
synced 2025-04-29 18:48:53 +00:00
[NTOS/SE]
- Do not fail when setting the same primary token for a process. - Fake equality of tokens when both of them are (not) restricted. CORE-8554 #resolve #comment JRE-7u65 now installs fine svn path=/trunk/; revision=64545
This commit is contained in:
parent
75f20f9f0c
commit
5550a89326
1 changed files with 26 additions and 1 deletions
|
@ -108,6 +108,8 @@ SepCompareTokens(IN PTOKEN FirstToken,
|
|||
}
|
||||
|
||||
/* FIXME: Check if every privilege that is present in either token is also present in the other one */
|
||||
DPRINT1("FIXME: Pretending tokens are equal!\n");
|
||||
IsEqual = TRUE;
|
||||
}
|
||||
|
||||
*Equal = IsEqual;
|
||||
|
@ -231,7 +233,30 @@ SeExchangePrimaryToken(PEPROCESS Process,
|
|||
PAGED_CODE();
|
||||
|
||||
if (NewToken->TokenType != TokenPrimary) return(STATUS_BAD_TOKEN_TYPE);
|
||||
if (NewToken->TokenInUse) return(STATUS_TOKEN_ALREADY_IN_USE);
|
||||
if (NewToken->TokenInUse)
|
||||
{
|
||||
BOOLEAN IsEqual;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Maybe we're trying to set the same token */
|
||||
OldToken = PsReferencePrimaryToken(Process);
|
||||
if (OldToken == NewToken)
|
||||
{
|
||||
/* So it's a nop. */
|
||||
PsDereferencePrimaryToken(OldToken);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
Status = SepCompareTokens(OldToken, NewToken, &IsEqual);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
PsDereferencePrimaryToken(OldToken);
|
||||
return Status;
|
||||
}
|
||||
|
||||
PsDereferencePrimaryToken(OldToken);
|
||||
return IsEqual ? STATUS_SUCCESS : STATUS_TOKEN_ALREADY_IN_USE;
|
||||
}
|
||||
|
||||
/* Mark new token in use */
|
||||
NewToken->TokenInUse = 1;
|
||||
|
|
Loading…
Reference in a new issue