mirror of
https://github.com/reactos/reactos.git
synced 2024-10-15 13:45:58 +00:00
Added RtlCopySecurityDescriptor
svn path=/trunk/; revision=29837
This commit is contained in:
parent
d68e72bf84
commit
f1546e5b22
|
@ -361,7 +361,7 @@ RtlConvertUlongToLargeInteger@4
|
||||||
RtlCopyLuid@8
|
RtlCopyLuid@8
|
||||||
RtlCopyLuidAndAttributesArray@12
|
RtlCopyLuidAndAttributesArray@12
|
||||||
RtlCopyRangeList@8
|
RtlCopyRangeList@8
|
||||||
;RtlCopySecurityDescriptor
|
RtlCopySecurityDescriptor@8
|
||||||
RtlCopySid@12
|
RtlCopySid@12
|
||||||
RtlCopySidAndAttributesArray@28
|
RtlCopySidAndAttributesArray@28
|
||||||
RtlCopyString@8
|
RtlCopyString@8
|
||||||
|
|
|
@ -908,6 +908,14 @@ RtlCreateSecurityDescriptorRelative(
|
||||||
IN ULONG Revision
|
IN ULONG Revision
|
||||||
);
|
);
|
||||||
|
|
||||||
|
NTSYSAPI
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
RtlCopySecurityDescriptor(
|
||||||
|
IN PSECURITY_DESCRIPTOR pSourceSecurityDescriptor,
|
||||||
|
OUT PSECURITY_DESCRIPTOR pDestinationSecurityDescriptor
|
||||||
|
);
|
||||||
|
|
||||||
NTSYSAPI
|
NTSYSAPI
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
|
|
|
@ -131,6 +131,93 @@ RtlCreateSecurityDescriptor(OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
NTSTATUS NTAPI
|
||||||
|
RtlCopySecurityDescriptor(IN PSECURITY_DESCRIPTOR pSourceSecurityDescriptor,
|
||||||
|
OUT PSECURITY_DESCRIPTOR pDestinationSecurityDescriptor)
|
||||||
|
{
|
||||||
|
PSID Owner, Group;
|
||||||
|
PACL Dacl, Sacl;
|
||||||
|
BOOLEAN Defaulted, Present;
|
||||||
|
DWORD OwnerLength, GroupLength;
|
||||||
|
PSECURITY_DESCRIPTOR srcSD = pSourceSecurityDescriptor;
|
||||||
|
PSECURITY_DESCRIPTOR destSD = pDestinationSecurityDescriptor;
|
||||||
|
|
||||||
|
if (srcSD->Revision != SECURITY_DESCRIPTOR_REVISION)
|
||||||
|
return STATUS_UNKNOWN_REVISION;
|
||||||
|
|
||||||
|
/* Copy non relative dependent data */
|
||||||
|
destSD->Revision = srcSD->Revision;
|
||||||
|
destSD->Sbz1 = srcSD->Sbz1;
|
||||||
|
destSD->Control = srcSD->Control;
|
||||||
|
|
||||||
|
/* Read relative data */
|
||||||
|
RtlGetOwnerSecurityDescriptor(srcSD, &Owner, &Defaulted);
|
||||||
|
OwnerLength = RtlLengthSid(Owner);
|
||||||
|
RtlGetGroupSecurityDescriptor(srcSD, &Group, &Defaulted);
|
||||||
|
GroupLength = RtlLengthSid(Group);
|
||||||
|
RtlGetDaclSecurityDescriptor(srcSD, &Present, &Dacl, &Defaulted);
|
||||||
|
RtlGetSaclSecurityDescriptor(srcSD, &Present, &Sacl, &Defaulted);
|
||||||
|
|
||||||
|
if (srcSD->Control & SE_SELF_RELATIVE)
|
||||||
|
{
|
||||||
|
destSD->Owner = srcSD->Owner;
|
||||||
|
RtlCopySid(OwnerLength, (LPBYTE)destSD + (DWORD_PTR)destSD->Owner, Owner);
|
||||||
|
|
||||||
|
destSD->Group = srcSD->Group;
|
||||||
|
RtlCopySid(GroupLength, (LPBYTE)destSD + (DWORD_PTR)destSD->Group, Group);
|
||||||
|
|
||||||
|
if (srcSD->Control & SE_DACL_PRESENT)
|
||||||
|
{
|
||||||
|
destSD->Dacl = srcSD->Dacl;
|
||||||
|
|
||||||
|
if(srcSD->Dacl != NULL && RtlValidAcl(srcSD->Dacl))
|
||||||
|
{
|
||||||
|
RtlCopyMemory(((LPBYTE)destSD + (DWORD_PTR)destSD->Dacl), Dacl, Dacl->AclSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (srcSD->Control & SE_SACL_PRESENT)
|
||||||
|
{
|
||||||
|
destSD->Sacl = srcSD->Sacl;
|
||||||
|
|
||||||
|
if(srcSD->Sacl != NULL && RtlValidAcl(srcSD->Sacl))
|
||||||
|
{
|
||||||
|
RtlCopyMemory(((LPBYTE)destSD + (DWORD_PTR)destSD->Sacl), Sacl, Sacl->AclSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RtlCopySid(OwnerLength, destSD->Owner, Owner);
|
||||||
|
RtlCopySid(GroupLength, destSD->Group, Group);
|
||||||
|
|
||||||
|
if (srcSD->Control & SE_DACL_PRESENT)
|
||||||
|
{
|
||||||
|
destSD->Dacl = RtlAllocateHeap(RtlGetProcessHeap(), 0, Dacl->AclSize);
|
||||||
|
|
||||||
|
if(srcSD->Dacl != NULL && RtlValidAcl(srcSD->Dacl))
|
||||||
|
{
|
||||||
|
RtlCopyMemory(destSD->Dacl, Dacl, Dacl->AclSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (srcSD->Control & SE_SACL_PRESENT)
|
||||||
|
{
|
||||||
|
destSD->Sacl = RtlAllocateHeap(RtlGetProcessHeap(), 0, Sacl->AclSize);
|
||||||
|
|
||||||
|
if(srcSD->Sacl != NULL && RtlValidAcl(srcSD->Sacl))
|
||||||
|
{
|
||||||
|
RtlCopyMemory(destSD->Sacl, Sacl, Sacl->AclSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
RtlCreateSecurityDescriptorRelative (OUT PISECURITY_DESCRIPTOR_RELATIVE SecurityDescriptor,
|
RtlCreateSecurityDescriptorRelative (OUT PISECURITY_DESCRIPTOR_RELATIVE SecurityDescriptor,
|
||||||
|
|
Loading…
Reference in a new issue