https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fdb4205061f83c16ff679…
commit fdb4205061f83c16ff679e0b8f3714edffaca969
Author: George Bișoc <george.bisoc(a)reactos.org>
AuthorDate: Sat Oct 23 17:55:12 2021 +0200
Commit: George Bișoc <george.bisoc(a)reactos.org>
CommitDate: Sat Oct 23 17:55:12 2021 +0200
[NTOS:SE] Minor cleanup on SepDuplicateToken
The current code that searches for the primary group of token upon duplication is OK
as is, remove whatever rest that's no longer needed.
---
ntoskrnl/se/token.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/ntoskrnl/se/token.c b/ntoskrnl/se/token.c
index 9c8492edfcc..061c907957a 100644
--- a/ntoskrnl/se/token.c
+++ b/ntoskrnl/se/token.c
@@ -1004,6 +1004,7 @@ SepDuplicateToken(
NTSTATUS Status;
PTOKEN AccessToken;
PVOID EndMem;
+ ULONG PrimaryGroupIndex;
ULONG VariableLength;
ULONG TotalSize;
ULONG PrivilegesIndex, GroupsIndex;
@@ -1133,10 +1134,6 @@ SepDuplicateToken(
}
}
-#if 1
- {
- ULONG PrimaryGroupIndex;
-
/* Find the token primary group */
Status = SepFindPrimaryGroupAndDefaultOwner(AccessToken,
Token->PrimaryGroup,
@@ -1148,11 +1145,8 @@ SepDuplicateToken(
DPRINT1("SepFindPrimaryGroupAndDefaultOwner failed (Status 0x%lx)\n",
Status);
goto Quit;
}
+
AccessToken->PrimaryGroup = AccessToken->UserAndGroups[PrimaryGroupIndex].Sid;
- }
-#else
- AccessToken->PrimaryGroup = (PVOID)((ULONG_PTR)AccessToken +
(ULONG_PTR)Token->PrimaryGroup - (ULONG_PTR)Token->UserAndGroups);
-#endif
AccessToken->DefaultOwnerIndex = Token->DefaultOwnerIndex;
/* Copy the restricted SIDs */