mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 13:06:34 +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;
|
PSID DstSid = NULL;
|
||||||
UCHAR RidCount;
|
UCHAR RidCount;
|
||||||
ULONG Size;
|
|
||||||
ULONG i;
|
|
||||||
|
|
||||||
RidCount = *RtlSubAuthorityCountSid(SrcSid);
|
RidCount = *RtlSubAuthorityCountSid(SrcSid);
|
||||||
if (RidCount >= 8)
|
if (RidCount >= 8)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
Size = RtlLengthRequiredSid(RidCount + 1);
|
DstSid = DispatchTable.AllocateLsaHeap(RtlLengthRequiredSid(RidCount + 1));
|
||||||
|
|
||||||
DstSid = DispatchTable.AllocateLsaHeap(Size);
|
|
||||||
if (DstSid == NULL)
|
if (DstSid == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = 0; i < RidCount; i++)
|
RtlCopyMemory(DstSid,
|
||||||
*RtlSubAuthoritySid(DstSid, i) = *RtlSubAuthoritySid(SrcSid, i);
|
SrcSid,
|
||||||
|
RtlLengthRequiredSid(RidCount));
|
||||||
|
|
||||||
|
*RtlSubAuthorityCountSid(DstSid) = RidCount + 1;
|
||||||
*RtlSubAuthoritySid(DstSid, RidCount) = Rid;
|
*RtlSubAuthoritySid(DstSid, RidCount) = Rid;
|
||||||
|
|
||||||
return DstSid;
|
return DstSid;
|
||||||
|
@ -256,6 +254,12 @@ BuildTokenUser(OUT PTOKEN_USER User,
|
||||||
{
|
{
|
||||||
User->User.Sid = AppendRidToSid(AccountDomainSid,
|
User->User.Sid = AppendRidToSid(AccountDomainSid,
|
||||||
RelativeId);
|
RelativeId);
|
||||||
|
if (User->User.Sid == NULL)
|
||||||
|
{
|
||||||
|
ERR("Could not create the user SID\n");
|
||||||
|
return STATUS_UNSUCCESSFUL;
|
||||||
|
}
|
||||||
|
|
||||||
User->User.Attributes = 0;
|
User->User.Attributes = 0;
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue