mirror of
https://github.com/reactos/reactos.git
synced 2026-05-22 15:20:29 +08:00
[RTL] Improve usage of absolte vs self-relative security descriptors
- RtlpQuerySecurityDescriptor: Change argument type of first parameter from PISECURITY_DESCRIPTOR to PSECURITY_DESCRIPTOR, since it handles both absolute and self-relative SDs. - RtlMakeSelfRelativeSD: rename first parameter from AbsoluteSD to SecurityDescriptor, since it handles both absolute and self-relative SDs. - SepGetGroupFromDescriptor/SepGetOwnerFromDescriptor/SepGetDaclFromDescriptor/SepGetSaclFromDescriptor: Change parameter type from PVOID to PSECURITY_DESCRIPTOR for clarity.
This commit is contained in:
@@ -87,7 +87,7 @@ typedef struct _TOKEN_AUDIT_POLICY_INFORMATION
|
||||
FORCEINLINE
|
||||
PSID
|
||||
SepGetGroupFromDescriptor(
|
||||
_Inout_ PVOID _Descriptor)
|
||||
_Inout_ PSECURITY_DESCRIPTOR _Descriptor)
|
||||
{
|
||||
PISECURITY_DESCRIPTOR Descriptor = (PISECURITY_DESCRIPTOR)_Descriptor;
|
||||
PISECURITY_DESCRIPTOR_RELATIVE SdRel;
|
||||
@@ -107,7 +107,7 @@ SepGetGroupFromDescriptor(
|
||||
FORCEINLINE
|
||||
PSID
|
||||
SepGetOwnerFromDescriptor(
|
||||
_Inout_ PVOID _Descriptor)
|
||||
_Inout_ PSECURITY_DESCRIPTOR _Descriptor)
|
||||
{
|
||||
PISECURITY_DESCRIPTOR Descriptor = (PISECURITY_DESCRIPTOR)_Descriptor;
|
||||
PISECURITY_DESCRIPTOR_RELATIVE SdRel;
|
||||
@@ -127,7 +127,7 @@ SepGetOwnerFromDescriptor(
|
||||
FORCEINLINE
|
||||
PACL
|
||||
SepGetDaclFromDescriptor(
|
||||
_Inout_ PVOID _Descriptor)
|
||||
_Inout_ PSECURITY_DESCRIPTOR _Descriptor)
|
||||
{
|
||||
PISECURITY_DESCRIPTOR Descriptor = (PISECURITY_DESCRIPTOR)_Descriptor;
|
||||
PISECURITY_DESCRIPTOR_RELATIVE SdRel;
|
||||
@@ -149,7 +149,7 @@ SepGetDaclFromDescriptor(
|
||||
FORCEINLINE
|
||||
PACL
|
||||
SepGetSaclFromDescriptor(
|
||||
_Inout_ PVOID _Descriptor)
|
||||
_Inout_ PSECURITY_DESCRIPTOR _Descriptor)
|
||||
{
|
||||
PISECURITY_DESCRIPTOR Descriptor = (PISECURITY_DESCRIPTOR)_Descriptor;
|
||||
PISECURITY_DESCRIPTOR_RELATIVE SdRel;
|
||||
|
||||
@@ -42,7 +42,7 @@ RtlpValidateSDOffsetAndSize(IN ULONG Offset,
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
RtlpQuerySecurityDescriptor(IN PISECURITY_DESCRIPTOR SecurityDescriptor,
|
||||
RtlpQuerySecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||
OUT PSID *Owner,
|
||||
OUT PULONG OwnerSize,
|
||||
OUT PSID *PrimaryGroup,
|
||||
@@ -644,7 +644,7 @@ RtlAbsoluteToSelfRelativeSD(IN PSECURITY_DESCRIPTOR AbsoluteSecurityDescriptor,
|
||||
*/
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
RtlMakeSelfRelativeSD(IN PSECURITY_DESCRIPTOR AbsoluteSD,
|
||||
RtlMakeSelfRelativeSD(IN PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||
OUT PSECURITY_DESCRIPTOR SelfRelativeSD,
|
||||
IN OUT PULONG BufferLength)
|
||||
{
|
||||
@@ -652,12 +652,11 @@ RtlMakeSelfRelativeSD(IN PSECURITY_DESCRIPTOR AbsoluteSD,
|
||||
PACL Sacl, Dacl;
|
||||
ULONG OwnerLength, GroupLength, SaclLength, DaclLength, TotalLength;
|
||||
ULONG_PTR Current;
|
||||
PISECURITY_DESCRIPTOR Sd = (PISECURITY_DESCRIPTOR)AbsoluteSD;
|
||||
PISECURITY_DESCRIPTOR_RELATIVE RelSd = (PISECURITY_DESCRIPTOR_RELATIVE)SelfRelativeSD;
|
||||
PAGED_CODE_RTL();
|
||||
|
||||
/* Query all components */
|
||||
RtlpQuerySecurityDescriptor(Sd,
|
||||
RtlpQuerySecurityDescriptor(SecurityDescriptor,
|
||||
&Owner,
|
||||
&OwnerLength,
|
||||
&Group,
|
||||
@@ -687,7 +686,7 @@ RtlMakeSelfRelativeSD(IN PSECURITY_DESCRIPTOR AbsoluteSD,
|
||||
|
||||
/* Copy the header fields */
|
||||
RtlCopyMemory(RelSd,
|
||||
Sd,
|
||||
SecurityDescriptor,
|
||||
FIELD_OFFSET(SECURITY_DESCRIPTOR_RELATIVE, Owner));
|
||||
|
||||
/* Set the current copy pointer */
|
||||
|
||||
Reference in New Issue
Block a user