[5/7] server: default_set_sd : allow the usage of a NULL security descriptor so that default_set_sd can be used to set the default values in this case.

Joris van der Wel joris at jorisvanderwel.com
Wed Jun 25 18:14:59 CDT 2014


default_set_sd : allow the usage of a NULL security descriptor so
 that default_set_sd can be used to set the default values in this case.

---
 server/object.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20140626/8130ca09/attachment-0001.html>
-------------- next part --------------
From 755f503bac2dc43dec6e08f7dd48b3e74f40dfea Mon Sep 17 00:00:00 2001
From: Joris van der Wel <joris at jorisvanderwel.com>
Date: Thu, 26 Jun 2014 00:27:43 +0200
Subject: default_set_sd : allow the usage of a NULL security descriptor so
 that default_set_sd can be used to set the default values in this case.

---
 server/object.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/server/object.c b/server/object.c
index 394183d..d13ca09 100644
--- a/server/object.c
+++ b/server/object.c
@@ -434,9 +434,9 @@ int default_set_sd( struct object *obj, const struct security_descriptor *sd,
 
     if (!set_info) return 1;
 
-    new_sd.control = sd->control & ~SE_SELF_RELATIVE;
+    new_sd.control = sd ? sd->control & ~SE_SELF_RELATIVE : 0;
 
-    owner = sd_get_owner( sd );
+    owner = sd ? sd_get_owner( sd ) : NULL;
     if (set_info & OWNER_SECURITY_INFORMATION && owner)
     {
         new_sd.owner_len = sd->owner_len;
@@ -456,7 +456,7 @@ int default_set_sd( struct object *obj, const struct security_descriptor *sd,
         }
     }
 
-    group = sd_get_group( sd );
+    group = sd ? sd_get_group( sd ) : NULL;
     if (set_info & GROUP_SECURITY_INFORMATION && group)
     {
         new_sd.group_len = sd->group_len;
@@ -476,14 +476,16 @@ int default_set_sd( struct object *obj, const struct security_descriptor *sd,
     }
 
     new_sd.control |= SE_SACL_PRESENT;
-    sacl = sd_get_sacl( sd, &present );
+    present = 0;
+    sacl = sd ? sd_get_sacl( sd, &present ) : NULL;
     if (set_info & SACL_SECURITY_INFORMATION && present)
         new_sd.sacl_len = sd->sacl_len;
     else
     {
-        if (obj->sd) sacl = sd_get_sacl( obj->sd, &present );
+        present = 0;
+        sacl = obj->sd ? sd_get_sacl( obj->sd, &present ) : NULL;
 
-        if (obj->sd && present)
+        if (present)
             new_sd.sacl_len = obj->sd->sacl_len;
         else
         {
@@ -492,14 +494,16 @@ int default_set_sd( struct object *obj, const struct security_descriptor *sd,
     }
 
     new_sd.control |= SE_DACL_PRESENT;
-    dacl = sd_get_dacl( sd, &present );
+    present = 0;
+    dacl = sd ? sd_get_dacl( sd, &present ) : NULL;
     if (set_info & DACL_SECURITY_INFORMATION && present)
         new_sd.dacl_len = sd->dacl_len;
     else
     {
-        if (obj->sd) dacl = sd_get_dacl( obj->sd, &present );
+        present = 0;
+        dacl = obj->sd ? sd_get_dacl( obj->sd, &present ) : NULL;
 
-        if (obj->sd && present)
+        if (present)
             new_sd.dacl_len = obj->sd->dacl_len;
         else
         {
-- 
1.8.1.msysgit.1



More information about the wine-patches mailing list