mirror of
https://github.com/reactos/reactos.git
synced 2025-08-01 18:23:42 +00:00
[MSV1_0]
AppendRidToSid: Copy the whole source SID into the destination SID. svn path=/trunk/; revision=59014
This commit is contained in:
parent
ebe3a779b1
commit
48107c0124
1 changed files with 11 additions and 7 deletions
|
@ -227,22 +227,20 @@ AppendRidToSid(PSID SrcSid,
|
|||
{
|
||||
PSID DstSid = NULL;
|
||||
UCHAR RidCount;
|
||||
ULONG Size;
|
||||
ULONG i;
|
||||
|
||||
RidCount = *RtlSubAuthorityCountSid(SrcSid);
|
||||
if (RidCount >= 8)
|
||||
return NULL;
|
||||
|
||||
Size = RtlLengthRequiredSid(RidCount + 1);
|
||||
|
||||
DstSid = DispatchTable.AllocateLsaHeap(Size);
|
||||
DstSid = DispatchTable.AllocateLsaHeap(RtlLengthRequiredSid(RidCount + 1));
|
||||
if (DstSid == NULL)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < RidCount; i++)
|
||||
*RtlSubAuthoritySid(DstSid, i) = *RtlSubAuthoritySid(SrcSid, i);
|
||||
RtlCopyMemory(DstSid,
|
||||
SrcSid,
|
||||
RtlLengthRequiredSid(RidCount));
|
||||
|
||||
*RtlSubAuthorityCountSid(DstSid) = RidCount + 1;
|
||||
*RtlSubAuthoritySid(DstSid, RidCount) = Rid;
|
||||
|
||||
return DstSid;
|
||||
|
@ -256,6 +254,12 @@ BuildTokenUser(OUT PTOKEN_USER User,
|
|||
{
|
||||
User->User.Sid = AppendRidToSid(AccountDomainSid,
|
||||
RelativeId);
|
||||
if (User->User.Sid == NULL)
|
||||
{
|
||||
ERR("Could not create the user SID\n");
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
User->User.Attributes = 0;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue