mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-25 01:42:24 -05:00
dll: CreateSelfRelativeSecurityDescriptor now supports self relative security descriptors as input
This commit is contained in:
parent
2298a6f7c6
commit
763d4666a7
@ -31,6 +31,8 @@ static NTSTATUS CreateSelfRelativeSecurityDescriptor(PSECURITY_DESCRIPTOR Securi
|
||||
BOOLEAN Success;
|
||||
PSECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor = 0;
|
||||
DWORD SelfRelativeSecurityDescriptorSize;
|
||||
SECURITY_DESCRIPTOR_CONTROL SecurityDescriptorControl;
|
||||
DWORD SecurityDescriptorRevision;
|
||||
SECURITY_DESCRIPTOR SecurityDescriptorStruct;
|
||||
PTOKEN_USER User = 0;
|
||||
PACL Acl = 0;
|
||||
@ -64,12 +66,29 @@ static NTSTATUS CreateSelfRelativeSecurityDescriptor(PSECURITY_DESCRIPTOR Securi
|
||||
SecurityDescriptor = &SecurityDescriptorStruct;
|
||||
}
|
||||
|
||||
SelfRelativeSecurityDescriptorSize = 0;
|
||||
Success =
|
||||
(MakeSelfRelativeSD(SecurityDescriptor, 0, &SelfRelativeSecurityDescriptorSize) ||
|
||||
ERROR_INSUFFICIENT_BUFFER == GetLastError()) &&
|
||||
(SelfRelativeSecurityDescriptor = Malloc(SelfRelativeSecurityDescriptorSize)) &&
|
||||
(MakeSelfRelativeSD(SecurityDescriptor, SelfRelativeSecurityDescriptor, &SelfRelativeSecurityDescriptorSize));
|
||||
if (!GetSecurityDescriptorControl(SecurityDescriptor,
|
||||
&SecurityDescriptorControl, &SecurityDescriptorRevision))
|
||||
{
|
||||
Result = FspNtStatusFromWin32(GetLastError());
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (SecurityDescriptorControl & SE_SELF_RELATIVE)
|
||||
{
|
||||
SelfRelativeSecurityDescriptorSize = GetSecurityDescriptorLength(SecurityDescriptor);
|
||||
Success =
|
||||
(SelfRelativeSecurityDescriptor = Malloc(SelfRelativeSecurityDescriptorSize)) &&
|
||||
memcpy(SelfRelativeSecurityDescriptor, SecurityDescriptor, SelfRelativeSecurityDescriptorSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
SelfRelativeSecurityDescriptorSize = 0;
|
||||
Success =
|
||||
(MakeSelfRelativeSD(SecurityDescriptor, 0, &SelfRelativeSecurityDescriptorSize) ||
|
||||
ERROR_INSUFFICIENT_BUFFER == GetLastError()) &&
|
||||
(SelfRelativeSecurityDescriptor = Malloc(SelfRelativeSecurityDescriptorSize)) &&
|
||||
(MakeSelfRelativeSD(SecurityDescriptor, SelfRelativeSecurityDescriptor, &SelfRelativeSecurityDescriptorSize));
|
||||
}
|
||||
if (!Success)
|
||||
{
|
||||
Result = FspNtStatusFromWin32(GetLastError());
|
||||
|
Loading…
x
Reference in New Issue
Block a user