[v2 1/3] ntdll: fix alloc obj attributes security descriptor handling

Jonathan Doron jond at wizery.com
Tue Sep 12 07:03:00 CDT 2017


Owner and Group might be present regardless of the SE_OWNER_DEFAULTED
or SE_GROUP_DEFAULTED flags.

Signed-off-by: Jonathan Doron <jond at wizery.com>
---
 dlls/ntdll/sync.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
index cfb5cbc..22796d2 100644
--- a/dlls/ntdll/sync.c
+++ b/dlls/ntdll/sync.c
@@ -77,9 +77,9 @@ NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_a
                                   data_size_t *ret_len )
 {
     unsigned int len = sizeof(**ret);
-    PSID owner, group;
+    PSID owner = NULL, group = NULL;
     ACL *dacl, *sacl;
-    BOOLEAN owner_present, group_present, dacl_present, sacl_present, defaulted;
+    BOOLEAN owner_defaulted, group_defaulted, dacl_present, sacl_present, defaulted;
     PSECURITY_DESCRIPTOR sd;
     NTSTATUS status;
 
@@ -94,12 +94,12 @@ NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_a
     {
         len += sizeof(struct security_descriptor);
 
-        if ((status = RtlGetOwnerSecurityDescriptor( sd, &owner, &owner_present ))) return status;
-        if ((status = RtlGetGroupSecurityDescriptor( sd, &group, &group_present ))) return status;
+        if ((status = RtlGetOwnerSecurityDescriptor( sd, &owner, &owner_defaulted))) return status;
+        if ((status = RtlGetGroupSecurityDescriptor( sd, &group, &group_defaulted))) return status;
         if ((status = RtlGetSaclSecurityDescriptor( sd, &sacl_present, &sacl, &defaulted ))) return status;
         if ((status = RtlGetDaclSecurityDescriptor( sd, &dacl_present, &dacl, &defaulted ))) return status;
-        if (owner_present) len += RtlLengthSid( owner );
-        if (group_present) len += RtlLengthSid( group );
+        if (owner) len += RtlLengthSid( owner );
+        if (group) len += RtlLengthSid( group );
         if (sacl_present && sacl) len += sacl->AclSize;
         if (dacl_present && dacl) len += dacl->AclSize;
 
@@ -126,8 +126,8 @@ NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_a
         unsigned char *ptr = (unsigned char *)(descr + 1);
 
         descr->control = ((SECURITY_DESCRIPTOR *)sd)->Control & ~SE_SELF_RELATIVE;
-        if (owner_present) descr->owner_len = RtlLengthSid( owner );
-        if (group_present) descr->group_len = RtlLengthSid( group );
+        if (owner) descr->owner_len = RtlLengthSid( owner );
+        if (group) descr->group_len = RtlLengthSid( group );
         if (sacl_present && sacl) descr->sacl_len = sacl->AclSize;
         if (dacl_present && dacl) descr->dacl_len = dacl->AclSize;
 
-- 
2.9.4




More information about the wine-patches mailing list