mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-23 00:43:00 -05:00
tst: winfsp-tests: stream_getsecurity_test
This commit is contained in:
parent
d85d36c94f
commit
59eb40fd9b
@ -1298,7 +1298,7 @@ static void stream_getsecurity_dotest(ULONG Flags, PWSTR Prefix, ULONG FileInfoT
|
|||||||
Prefix ? L"" : L"\\\\?\\GLOBALROOT", Prefix ? Prefix : memfs_volumename(memfs));
|
Prefix ? L"" : L"\\\\?\\GLOBALROOT", Prefix ? Prefix : memfs_volumename(memfs));
|
||||||
|
|
||||||
Handle = CreateFileW(FilePath,
|
Handle = CreateFileW(FilePath,
|
||||||
GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, 0);
|
GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
|
||||||
ASSERT(INVALID_HANDLE_VALUE != Handle);
|
ASSERT(INVALID_HANDLE_VALUE != Handle);
|
||||||
|
|
||||||
Success = GetKernelObjectSecurity(Handle, OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION,
|
Success = GetKernelObjectSecurity(Handle, OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION,
|
||||||
@ -1348,6 +1348,66 @@ static void stream_getsecurity_dotest(ULONG Flags, PWSTR Prefix, ULONG FileInfoT
|
|||||||
|
|
||||||
CloseHandle(Handle);
|
CloseHandle(Handle);
|
||||||
|
|
||||||
|
StringCbPrintfW(FilePath, sizeof FilePath, L"%s%s\\file0:foo",
|
||||||
|
Prefix ? L"" : L"\\\\?\\GLOBALROOT", Prefix ? Prefix : memfs_volumename(memfs));
|
||||||
|
|
||||||
|
Handle = CreateFileW(FilePath,
|
||||||
|
GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
|
||||||
|
ASSERT(INVALID_HANDLE_VALUE != Handle);
|
||||||
|
|
||||||
|
Success = GetKernelObjectSecurity(Handle, OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION,
|
||||||
|
0, 0, &Length);
|
||||||
|
ASSERT(!Success);
|
||||||
|
ASSERT(ERROR_INSUFFICIENT_BUFFER == GetLastError());
|
||||||
|
FileSecurityDescriptor = malloc(Length);
|
||||||
|
Success = GetKernelObjectSecurity(Handle, OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION,
|
||||||
|
FileSecurityDescriptor, Length, &Length);
|
||||||
|
ASSERT(Success);
|
||||||
|
Success = GetSecurityDescriptorOwner(FileSecurityDescriptor, &Owner, &OwnerDefaulted);
|
||||||
|
ASSERT(Success);
|
||||||
|
ASSERT(0 != Owner);
|
||||||
|
Success = GetSecurityDescriptorGroup(FileSecurityDescriptor, &Group, &GroupDefaulted);
|
||||||
|
ASSERT(Success);
|
||||||
|
ASSERT(0 != Group);
|
||||||
|
Success = GetSecurityDescriptorDacl(FileSecurityDescriptor, &DaclPresent, &Dacl, &DaclDefaulted);
|
||||||
|
ASSERT(Success);
|
||||||
|
ASSERT(!DaclPresent);
|
||||||
|
Success = GetSecurityDescriptorSacl(FileSecurityDescriptor, &SaclPresent, &Sacl, &SaclDefaulted);
|
||||||
|
ASSERT(Success);
|
||||||
|
ASSERT(!SaclPresent);
|
||||||
|
free(FileSecurityDescriptor);
|
||||||
|
|
||||||
|
Success = GetKernelObjectSecurity(Handle, DACL_SECURITY_INFORMATION,
|
||||||
|
0, 0, &Length);
|
||||||
|
ASSERT(!Success);
|
||||||
|
ASSERT(ERROR_INSUFFICIENT_BUFFER == GetLastError());
|
||||||
|
FileSecurityDescriptor = malloc(Length);
|
||||||
|
Success = GetKernelObjectSecurity(Handle, DACL_SECURITY_INFORMATION,
|
||||||
|
FileSecurityDescriptor, Length, &Length);
|
||||||
|
ASSERT(Success);
|
||||||
|
Success = GetSecurityDescriptorOwner(FileSecurityDescriptor, &Owner, &OwnerDefaulted);
|
||||||
|
ASSERT(Success);
|
||||||
|
ASSERT(0 == Owner);
|
||||||
|
Success = GetSecurityDescriptorGroup(FileSecurityDescriptor, &Group, &GroupDefaulted);
|
||||||
|
ASSERT(Success);
|
||||||
|
ASSERT(0 == Group);
|
||||||
|
Success = GetSecurityDescriptorDacl(FileSecurityDescriptor, &DaclPresent, &Dacl, &DaclDefaulted);
|
||||||
|
ASSERT(Success);
|
||||||
|
ASSERT(DaclPresent);
|
||||||
|
ASSERT(0 != Dacl);
|
||||||
|
Success = GetSecurityDescriptorSacl(FileSecurityDescriptor, &SaclPresent, &Sacl, &SaclDefaulted);
|
||||||
|
ASSERT(Success);
|
||||||
|
ASSERT(!SaclPresent);
|
||||||
|
free(FileSecurityDescriptor);
|
||||||
|
|
||||||
|
CloseHandle(Handle);
|
||||||
|
|
||||||
|
StringCbPrintfW(FilePath, sizeof FilePath, L"%s%s\\file0",
|
||||||
|
Prefix ? L"" : L"\\\\?\\GLOBALROOT", Prefix ? Prefix : memfs_volumename(memfs));
|
||||||
|
|
||||||
|
Success = DeleteFileW(FilePath);
|
||||||
|
ASSERT(Success);
|
||||||
|
|
||||||
LocalFree(SecurityDescriptor);
|
LocalFree(SecurityDescriptor);
|
||||||
|
|
||||||
memfs_stop(memfs);
|
memfs_stop(memfs);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user