Mikolaj Zalewski : advapi32/ntdll: GetSecurityDescriptorOwner/ Group should fill isDefaulted also for NULL sids.

Alexandre Julliard julliard at winehq.org
Fri Sep 28 06:45:58 CDT 2007


Module: wine
Branch: master
Commit: 611f57bc20bc4acc2dc6ff902eeffc2d9f5ff2bb
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=611f57bc20bc4acc2dc6ff902eeffc2d9f5ff2bb

Author: Mikolaj Zalewski <mikolajz at google.com>
Date:   Thu Sep 27 10:36:58 2007 -0700

advapi32/ntdll: GetSecurityDescriptorOwner/Group should fill isDefaulted also for NULL sids.

---

 dlls/advapi32/tests/security.c |    6 +++---
 dlls/ntdll/sec.c               |   19 ++++++++++---------
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index 2e671df..15fc86e 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -1460,7 +1460,7 @@ static void test_security_descriptor(void)
     InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION);
     ok(GetSecurityDescriptorOwner(&sd, &psid, &isDefault), "GetSecurityDescriptorOwner failed\n");
     expect_eq(psid, NULL, PSID, "%p");
-    todo_wine expect_eq(isDefault, FALSE, BOOL, "%d");
+    expect_eq(isDefault, FALSE, BOOL, "%d");
     sd.Control |= SE_DACL_PRESENT | SE_SACL_PRESENT;
 
     SetLastError(0xdeadbeef);
@@ -1473,10 +1473,10 @@ static void test_security_descriptor(void)
         expect_eq(MakeSelfRelativeSD(&sd, buf, &size), TRUE, BOOL, "%d");
         ok(GetSecurityDescriptorOwner(&sd, &psid, &isDefault), "GetSecurityDescriptorOwner failed\n");
         expect_eq(psid, NULL, PSID, "%p");
-        todo_wine expect_eq(isDefault, FALSE, BOOL, "%d");
+        expect_eq(isDefault, FALSE, BOOL, "%d");
         ok(GetSecurityDescriptorGroup(&sd, &psid, &isDefault), "GetSecurityDescriptorOwner failed\n");
         expect_eq(psid, NULL, PSID, "%p");
-        todo_wine expect_eq(isDefault, FALSE, BOOL, "%d");
+        expect_eq(isDefault, FALSE, BOOL, "%d");
         ok(GetSecurityDescriptorDacl(&sd, &isPresent, &pacl, &isDefault), "GetSecurityDescriptorOwner failed\n");
         expect_eq(isPresent, TRUE, BOOL, "%d");
         expect_eq(psid, NULL, PSID, "%p");
diff --git a/dlls/ntdll/sec.c b/dlls/ntdll/sec.c
index 38ab402..e827efa 100644
--- a/dlls/ntdll/sec.c
+++ b/dlls/ntdll/sec.c
@@ -713,6 +713,11 @@ NTSTATUS WINAPI RtlGetOwnerSecurityDescriptor(
 	if ( !lpsd  || !Owner || !OwnerDefaulted )
 		return STATUS_INVALID_PARAMETER;
 
+        if ( lpsd->Control & SE_OWNER_DEFAULTED )
+            *OwnerDefaulted = TRUE;
+        else
+            *OwnerDefaulted = FALSE;
+
 	if (lpsd->Owner != NULL)
 	{
             if (lpsd->Control & SE_SELF_RELATIVE)
@@ -720,10 +725,6 @@ NTSTATUS WINAPI RtlGetOwnerSecurityDescriptor(
             else
                 *Owner = lpsd->Owner;
 
-            if ( lpsd->Control & SE_OWNER_DEFAULTED )
-                *OwnerDefaulted = TRUE;
-            else
-                *OwnerDefaulted = FALSE;
         }
 	else
 	    *Owner = NULL;
@@ -790,17 +791,17 @@ NTSTATUS WINAPI RtlGetGroupSecurityDescriptor(
 	if ( !lpsd || !Group || !GroupDefaulted )
 		return STATUS_INVALID_PARAMETER;
 
+        if ( lpsd->Control & SE_GROUP_DEFAULTED )
+            *GroupDefaulted = TRUE;
+        else
+            *GroupDefaulted = FALSE;
+
 	if (lpsd->Group != NULL)
 	{
             if (lpsd->Control & SE_SELF_RELATIVE)
                 *Group = (PSID)((LPBYTE)lpsd + (ULONG_PTR)lpsd->Group);
             else
                 *Group = lpsd->Group;
-
-            if ( lpsd->Control & SE_GROUP_DEFAULTED )
-                *GroupDefaulted = TRUE;
-            else
-                *GroupDefaulted = FALSE;
 	}
 	else
 	    *Group = NULL;




More information about the wine-cvs mailing list