server-Inherited_ACLs: One more small fix to ensure we don't dereference a NULL pointer.

This commit is contained in:
Sebastian Lackner 2014-09-06 04:07:11 +02:00
parent 1d0979cb9b
commit 41b4bc29a0

View File

@ -1,4 +1,4 @@
From 426cab848d0577238d08463e2e1b4e5f4a06ef45 Mon Sep 17 00:00:00 2001
From cf51d788cce57b6c5f99bfc15e81790fb5d449c4 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Fri, 18 Apr 2014 14:10:49 -0600
Subject: server: Inherit security attributes from parent directories on
@ -146,7 +146,7 @@ index e3b722c..e6ec90a 100644
if (orig->inode)
diff --git a/server/file.c b/server/file.c
index 431b8a1..9299132 100644
index 431b8a1..a5d2de3 100644
--- a/server/file.c
+++ b/server/file.c
@@ -329,6 +329,106 @@ struct security_descriptor *inherit_sd( const struct security_descriptor *parent
@ -201,8 +201,8 @@ index 431b8a1..9299132 100644
+ /* Fill in the security descriptor so that it is compatible with our DACL */
+ user = (const SID *)(old_sd + 1);
+ group = (const SID *)((char *)(old_sd + 1) + old_sd->owner_len);
+ sd = mem_alloc( sizeof(struct security_descriptor) + sd->owner_len
+ + sd->group_len + dacl_size );
+ sd = mem_alloc( sizeof(struct security_descriptor) + old_sd->owner_len
+ + old_sd->group_len + dacl_size );
+ if (!sd) return sd;
+ sd->control = SE_DACL_PRESENT;
+ sd->owner_len = old_sd->owner_len;