Author: jgardou
Date: Sun Oct 5 14:20:08 2014
New Revision: 64545
URL:
http://svn.reactos.org/svn/reactos?rev=64545&view=rev
Log:
[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
Modified:
trunk/reactos/ntoskrnl/se/token.c
Modified: trunk/reactos/ntoskrnl/se/token.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/token.c?rev=64…
==============================================================================
--- trunk/reactos/ntoskrnl/se/token.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/se/token.c [iso-8859-1] Sun Oct 5 14:20:08 2014
@@ -108,6 +108,8 @@
}
/* 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 @@
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;