mirror of
				https://github.com/winfsp/winfsp.git
				synced 2025-10-30 19:48:38 -05:00 
			
		
		
		
	dll: CreateSelfRelativeSecurityDescriptor now supports self relative security descriptors as input
This commit is contained in:
		| @@ -31,6 +31,8 @@ static NTSTATUS CreateSelfRelativeSecurityDescriptor(PSECURITY_DESCRIPTOR Securi | |||||||
|     BOOLEAN Success; |     BOOLEAN Success; | ||||||
|     PSECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor = 0; |     PSECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor = 0; | ||||||
|     DWORD SelfRelativeSecurityDescriptorSize; |     DWORD SelfRelativeSecurityDescriptorSize; | ||||||
|  |     SECURITY_DESCRIPTOR_CONTROL SecurityDescriptorControl; | ||||||
|  |     DWORD SecurityDescriptorRevision; | ||||||
|     SECURITY_DESCRIPTOR SecurityDescriptorStruct; |     SECURITY_DESCRIPTOR SecurityDescriptorStruct; | ||||||
|     PTOKEN_USER User = 0; |     PTOKEN_USER User = 0; | ||||||
|     PACL Acl = 0; |     PACL Acl = 0; | ||||||
| @@ -64,12 +66,29 @@ static NTSTATUS CreateSelfRelativeSecurityDescriptor(PSECURITY_DESCRIPTOR Securi | |||||||
|         SecurityDescriptor = &SecurityDescriptorStruct; |         SecurityDescriptor = &SecurityDescriptorStruct; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     SelfRelativeSecurityDescriptorSize = 0; |     if (!GetSecurityDescriptorControl(SecurityDescriptor, | ||||||
|     Success = |         &SecurityDescriptorControl, &SecurityDescriptorRevision)) | ||||||
|         (MakeSelfRelativeSD(SecurityDescriptor, 0, &SelfRelativeSecurityDescriptorSize) || |     { | ||||||
|             ERROR_INSUFFICIENT_BUFFER == GetLastError()) && |         Result = FspNtStatusFromWin32(GetLastError()); | ||||||
|         (SelfRelativeSecurityDescriptor = Malloc(SelfRelativeSecurityDescriptorSize)) && |         goto exit; | ||||||
|         (MakeSelfRelativeSD(SecurityDescriptor, SelfRelativeSecurityDescriptor, &SelfRelativeSecurityDescriptorSize)); |     } | ||||||
|  |  | ||||||
|  |     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) |     if (!Success) | ||||||
|     { |     { | ||||||
|         Result = FspNtStatusFromWin32(GetLastError()); |         Result = FspNtStatusFromWin32(GetLastError()); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user