diff --git a/patches/server-Inherited_ACLs/0002-server-Inherit-security-attributes-from-parent-direc.patch b/patches/server-Inherited_ACLs/0002-server-Inherit-security-attributes-from-parent-direc.patch index a8e4d264..d50576d1 100644 --- a/patches/server-Inherited_ACLs/0002-server-Inherit-security-attributes-from-parent-direc.patch +++ b/patches/server-Inherited_ACLs/0002-server-Inherit-security-attributes-from-parent-direc.patch @@ -1,15 +1,15 @@ -From 6a598ee04025242f900fdf2726a21afe93d018bd Mon Sep 17 00:00:00 2001 +From 6cf81a9d508316efad89b5a9a9b9995fcb3de297 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Fri, 18 Apr 2014 14:10:49 -0600 Subject: server: Inherit security attributes from parent directories on SetSecurityInfo. --- - dlls/advapi32/tests/security.c | 68 ++++++++++++++++++++++ - include/winnt.h | 7 ++- - server/fd.c | 13 ++++- - server/file.c | 126 +++++++++++++++++++++++++++++++++++++++- - server/file.h | 1 + + dlls/advapi32/tests/security.c | 68 ++++++++++++++++++++++ + include/winnt.h | 7 ++- + server/fd.c | 13 ++++- + server/file.c | 126 ++++++++++++++++++++++++++++++++++++++++- + server/file.h | 1 + 5 files changed, 207 insertions(+), 8 deletions(-) diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c @@ -115,7 +115,7 @@ index 709a93f..63882bb 100644 #define REG_OPTION_NON_VOLATILE 0x00000000 #define REG_OPTION_VOLATILE 0x00000001 diff --git a/server/fd.c b/server/fd.c -index e3b722c..7d50ab6 100644 +index e3b722c..e6ec90a 100644 --- a/server/fd.c +++ b/server/fd.c @@ -1634,6 +1634,16 @@ struct fd *alloc_pseudo_fd( const struct fd_ops *fd_user_ops, struct object *use @@ -125,7 +125,7 @@ index e3b722c..7d50ab6 100644 +char *fd_get_unix_name( struct fd *obj ) +{ + char *unix_name; -+ ++ if (!obj->unix_name) return NULL; + unix_name = mem_alloc( strlen(obj->unix_name) + 1 ); + if (!unix_name) return NULL; + strcpy( unix_name, obj->unix_name ); @@ -146,10 +146,10 @@ index e3b722c..7d50ab6 100644 if (orig->inode) diff --git a/server/file.c b/server/file.c -index 1414ee6..bbb9358 100644 +index 431b8a1..384cc66 100644 --- a/server/file.c +++ b/server/file.c -@@ -328,6 +328,105 @@ struct security_descriptor *inherit_sd( const struct security_descriptor *parent +@@ -329,6 +329,105 @@ struct security_descriptor *inherit_sd( const struct security_descriptor *parent return sd; } @@ -200,8 +200,8 @@ index 1414ee6..bbb9358 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) + security_sid_len( user ) -+ + security_sid_len( group ) + dacl_size ); ++ sd = mem_alloc( sizeof(struct security_descriptor) + sd->owner_len ++ + sd->group_len + dacl_size ); + if (!sd) return sd; + sd->control = SE_DACL_PRESENT; + sd->owner_len = old_sd->owner_len; @@ -230,7 +230,7 @@ index 1414ee6..bbb9358 100644 + ace->AceType = old_ace->AceType; + ace->AceFlags = old_ace->AceFlags; + ace->AceSize = old_ace->AceSize; -+ memcpy( ace + 1, old_ace + 1, old_ace->AceSize); ++ memcpy( ace + 1, old_ace + 1, old_ace->AceSize - sizeof(ACE_HEADER)); + ace = (ACE_HEADER *)ace_next( ace ); + } + } @@ -244,7 +244,7 @@ index 1414ee6..bbb9358 100644 + ace->AceType = old_ace->AceType; + ace->AceFlags = old_ace->AceFlags; + ace->AceSize = old_ace->AceSize; -+ memcpy( ace + 1, old_ace + 1, old_ace->AceSize); ++ memcpy( ace + 1, old_ace + 1, old_ace->AceSize - sizeof(ACE_HEADER)); + ace = (ACE_HEADER *)ace_next( ace ); + } + } @@ -255,7 +255,7 @@ index 1414ee6..bbb9358 100644 static struct security_descriptor *file_get_parent_sd( struct fd *root, const char *child_name, int child_len, int is_dir ) { -@@ -800,16 +899,33 @@ mode_t sd_to_mode( const struct security_descriptor *sd, const SID *owner ) +@@ -797,16 +896,33 @@ mode_t sd_to_mode( const struct security_descriptor *sd, const SID *owner ) return new_mode & ~denied_mode; } @@ -290,7 +290,7 @@ index 1414ee6..bbb9358 100644 if (set_info & OWNER_SECURITY_INFORMATION) { owner = sd_get_owner( sd ); -@@ -859,10 +975,14 @@ int set_file_sd( struct object *obj, struct fd *fd, const struct security_descri +@@ -856,10 +972,14 @@ int set_file_sd( struct object *obj, struct fd *fd, const struct security_descri if (((st.st_mode ^ mode) & (S_IRWXU|S_IRWXG|S_IRWXO)) && fchmod( unix_fd, mode ) == -1) { file_set_error(); @@ -308,10 +308,10 @@ index 1414ee6..bbb9358 100644 static int file_set_sd( struct object *obj, const struct security_descriptor *sd, diff --git a/server/file.h b/server/file.h -index 2f537cf..fa83001 100644 +index be25fb6..b43f329 100644 --- a/server/file.h +++ b/server/file.h -@@ -77,6 +77,7 @@ extern void allow_fd_caching( struct fd *fd ); +@@ -79,6 +79,7 @@ extern void allow_fd_caching( struct fd *fd ); extern void set_fd_signaled( struct fd *fd, int signaled ); extern int is_fd_signaled( struct fd *fd ); @@ -320,5 +320,5 @@ index 2f537cf..fa83001 100644 extern unsigned int default_fd_map_access( struct object *obj, unsigned int access ); extern int default_fd_get_poll_events( struct fd *fd ); -- -1.7.9.5 +2.1.0