[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.
This commit is contained in:
George Bișoc 2021-10-23 17:55:12 +02:00
parent 334ab0f2a5
commit fdb4205061
No known key found for this signature in database
GPG key ID: 688C4FBE25D7DEF6

View file

@ -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 */