Fix a build failure on MacOS caused by using of strndup in the server-Inherited_ACLs patchset.

This commit is contained in:
Sebastian Lackner
2015-03-17 01:06:45 +01:00
parent 17a3d8c2ea
commit 20286952db
3 changed files with 24 additions and 22 deletions

View File

@@ -1,4 +1,4 @@
From 220f1650f507194fedd2102e7672c56563bbfa36 Mon Sep 17 00:00:00 2001
From c7ee69405e7f18058ca0b1c05e8dfa7ee669df13 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Fri, 18 Apr 2014 15:21:00 -0600
Subject: server: Add compatibility code for handling the old method of storing
@@ -9,7 +9,7 @@ Subject: server: Add compatibility code for handling the old method of storing
1 file changed, 164 insertions(+), 3 deletions(-)
diff --git a/server/file.c b/server/file.c
index 431b8a1..f86da49 100644
index 146ea68..4c72775 100644
--- a/server/file.c
+++ b/server/file.c
@@ -72,6 +72,7 @@ struct file
@@ -20,15 +20,15 @@ index 431b8a1..f86da49 100644
static void file_dump( struct object *obj, int verbose );
static struct fd *file_get_fd( struct object *obj );
@@ -336,6 +337,7 @@ static struct security_descriptor *file_get_parent_sd( struct fd *root, const ch
@@ -440,6 +441,7 @@ static struct security_descriptor *file_get_parent_sd( struct fd *root, const ch
mode_t parent_mode = 0555;
char *p, *parent_name;
struct fd *parent_fd;
+ struct stat st;
int unix_fd;
parent_name = strndup( child_name, child_len );
@@ -367,6 +369,9 @@ static struct security_descriptor *file_get_parent_sd( struct fd *root, const ch
if (!(parent_name = mem_alloc( child_len + 1 ))) return NULL;
@@ -472,6 +474,9 @@ static struct security_descriptor *file_get_parent_sd( struct fd *root, const ch
if (unix_fd != -1)
{
parent_sd = get_xattr_sd( unix_fd );
@@ -38,7 +38,7 @@ index 431b8a1..f86da49 100644
if (parent_sd)
{
sd = inherit_sd( parent_sd, is_dir );
@@ -654,6 +659,160 @@ struct security_descriptor *get_xattr_sd( int fd )
@@ -759,6 +764,160 @@ struct security_descriptor *get_xattr_sd( int fd )
return sd;
}
@@ -199,7 +199,7 @@ index 431b8a1..f86da49 100644
/* Convert generic rights into standard access rights */
void convert_generic_sd( struct security_descriptor *sd )
{
@@ -681,6 +840,7 @@ struct security_descriptor *get_file_sd( struct object *obj, struct fd *fd, mode
@@ -786,6 +945,7 @@ struct security_descriptor *get_file_sd( struct object *obj, struct fd *fd, mode
int unix_fd = get_unix_fd( fd );
struct stat st;
struct security_descriptor *sd;
@@ -207,7 +207,7 @@ index 431b8a1..f86da49 100644
if (unix_fd == -1 || fstat( unix_fd, &st ) == -1)
return obj->sd;
@@ -690,11 +850,12 @@ struct security_descriptor *get_file_sd( struct object *obj, struct fd *fd, mode
@@ -795,11 +955,12 @@ struct security_descriptor *get_file_sd( struct object *obj, struct fd *fd, mode
(st.st_uid == *uid))
return obj->sd;
@@ -224,5 +224,5 @@ index 431b8a1..f86da49 100644
*mode = st.st_mode;
--
2.1.0
2.3.2