Author: ekohl Date: Mon May 13 13:47:33 2013 New Revision: 59014
URL: http://svn.reactos.org/svn/reactos?rev=59014&view=rev Log: [MSV1_0] AppendRidToSid: Copy the whole source SID into the destination SID.
Modified: trunk/reactos/dll/win32/msv1_0/msv1_0.c
Modified: trunk/reactos/dll/win32/msv1_0/msv1_0.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msv1_0/msv1_0.c?r... ============================================================================== --- trunk/reactos/dll/win32/msv1_0/msv1_0.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msv1_0/msv1_0.c [iso-8859-1] Mon May 13 13:47:33 2013 @@ -227,22 +227,20 @@ { 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 @@ { 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;