Piotr Caban : advapi32: Handle NULL DACL in SetSecurityInfo.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Apr 3 07:14:59 CDT 2015
Module: wine
Branch: master
Commit: 52df833a726f3a8132fbdaab00d82dc2b142f005
URL: http://source.winehq.org/git/wine.git/?a=commit;h=52df833a726f3a8132fbdaab00d82dc2b142f005
Author: Piotr Caban <piotr at codeweavers.com>
Date: Fri Apr 3 10:04:03 2015 +0200
advapi32: Handle NULL DACL in SetSecurityInfo.
---
dlls/advapi32/security.c | 2 +-
dlls/advapi32/tests/security.c | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c
index 71a8c92..2cd3f74 100644
--- a/dlls/advapi32/security.c
+++ b/dlls/advapi32/security.c
@@ -5743,7 +5743,7 @@ DWORD WINAPI SetSecurityInfo(HANDLE handle, SE_OBJECT_TYPE ObjectType,
SetSecurityDescriptorGroup(&sd, psidGroup, FALSE);
if (SecurityInfo & DACL_SECURITY_INFORMATION)
{
- if (ObjectType == SE_FILE_OBJECT)
+ if (ObjectType == SE_FILE_OBJECT && pDacl)
{
SECURITY_DESCRIPTOR_CONTROL control;
PSECURITY_DESCRIPTOR psd;
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index 3789d72..466100d 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -3633,6 +3633,22 @@ static void test_GetNamedSecurityInfoA(void)
ok(h != INVALID_HANDLE_VALUE, "CreateFile error %d\n", GetLastError());
CloseHandle(h);
+ /* test setting NULL DACL */
+ error = pSetNamedSecurityInfoA(tmpfile, SE_FILE_OBJECT,
+ DACL_SECURITY_INFORMATION, NULL, NULL, NULL, NULL);
+ ok(!error, "SetNamedSecurityInfoA failed with error %d\n", error);
+
+ error = pGetNamedSecurityInfoA(tmpfile, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION,
+ NULL, NULL, &pDacl, NULL, &pSD);
+ ok(!error, "GetNamedSecurityInfo failed with error %d\n", error);
+ todo_wine ok(!pDacl, "pDacl != NULL\n");
+ LocalFree(pSD);
+
+ h = CreateFileA(tmpfile, GENERIC_READ, FILE_SHARE_DELETE|FILE_SHARE_WRITE|FILE_SHARE_READ,
+ NULL, OPEN_EXISTING, 0, NULL);
+ ok(h != INVALID_HANDLE_VALUE, "CreateFile error %d\n", GetLastError());
+ CloseHandle(h);
+
/* NtSetSecurityObject doesn't inherit DACL entries */
pSD = sd+sizeof(void*)-((ULONG_PTR)sd)%sizeof(void*);
InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION);
More information about the wine-cvs
mailing list