From 2ba54fafe7123ec55a82cbbb54bdc563c29ed91f Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 23 Aug 2011 12:40:09 +0200 Subject: [PATCH] New optional tolerance towards failure to restore "default" ACLS on FreeBSD. --- libisofs/aaip-os-freebsd.c | 20 +++++++++++--------- libisofs/aaip-os-linux.c | 12 +++++++++++- libisofs/fs_local.c | 2 +- libisofs/libisofs.h | 5 ++++- 4 files changed, 27 insertions(+), 12 deletions(-) diff --git a/libisofs/aaip-os-freebsd.c b/libisofs/aaip-os-freebsd.c index 08b3ab6..34d26f9 100644 --- a/libisofs/aaip-os-freebsd.c +++ b/libisofs/aaip-os-freebsd.c @@ -648,9 +648,13 @@ ex:; @param flag Bitfield for control purposes bit0= set default ACL rather than access ACL bit5= in case of symbolic link: manipulate link target + bit6= tolerate inappropriate presence or absence of + directory default ACL @return > 0 ok + 0 no suitable ACL manipulation adapter available -1 failure of system ACL service (see errno) - -2 ACL support not enabled at compile time + -2 attempt to manipulate ACL of a symbolic link + without bit5 resp. with no suitable link target */ int aaip_set_acl_text(char *path, char *text, int flag) { @@ -691,7 +695,7 @@ ex: #else /* Libisofs_with_aaip_acL */ - return(-2); + return(0); #endif /* ! Libisofs_with_aaip_acL */ @@ -739,7 +743,9 @@ static int aaip_extattr_delete_names(char *path, int attrnamespace, bit3= do not ignore eventual non-user attributes. I.e. those with a name which does not begin by "user." - bit5= in case of symbolic link: manipulate link target + bit5= in case of symbolic link: manipulate link target + bit6= tolerate inappropriate presence or absence of + directory default ACL @return 1 success -1 error memory allocation -2 error with decoding of ACL @@ -852,19 +858,15 @@ int aaip_set_attr_list(char *path, size_t num_attrs, char **names, has_default_acl= (ret == 2); #ifdef Libisofs_with_aaip_acL - ret= aaip_set_acl_text(path, acl_text, flag & 32); + ret= aaip_set_acl_text(path, acl_text, flag & (32 | 64)); if(ret <= 0) {ret= -3; goto ex;} #else {ret= -7; goto ex;} #endif - if(has_default_acl) { - - /* >>> EXTATTR : Give opportunity to ignore default ACLs */; - + if(has_default_acl && !(flag & 64)) {ret= -3; goto ex;} - } ret= 1; ex:; diff --git a/libisofs/aaip-os-linux.c b/libisofs/aaip-os-linux.c index 7cf6303..c631d58 100644 --- a/libisofs/aaip-os-linux.c +++ b/libisofs/aaip-os-linux.c @@ -423,7 +423,9 @@ ex: bit3= do not ignore eventual non-user attributes. I.e. those with a name which does not begin by "user." - bit5= in case of symbolic link: manipulate link target + bit5= in case of symbolic link: manipulate link target + bit6= tolerate inappropriate presence or absense of + directory default ACL @return 1 success -1 error memory allocation -2 error with decoding of ACL @@ -557,6 +559,14 @@ int aaip_set_attr_list(char *path, size_t num_attrs, char **names, ret= aaip_set_acl_text(path, acl_text, 1 | (flag & 32)); if(ret <= 0) {ret= -3; goto ex;} + } else { + if(!(flag & 64)) { + + /* >>> ??? take offense from missing default ACL ? + ??? does Linux demand a default ACL for directories with access ACL ? + */; + + } } ret= 1; ex:; diff --git a/libisofs/fs_local.c b/libisofs/fs_local.c index 483ca39..cb30ed1 100644 --- a/libisofs/fs_local.c +++ b/libisofs/fs_local.c @@ -868,7 +868,7 @@ int iso_local_set_attrs(char *disk_path, size_t num_attrs, char **names, int ret; ret = aaip_set_attr_list(disk_path, num_attrs, names, value_lengths, - values, (flag & (8 | 32)) | !(flag & 1)); + values, (flag & (8 | 32 | 64)) | !(flag & 1)); if (ret <= 0) { if (ret == -1) return ISO_OUT_OF_MEM; diff --git a/libisofs/libisofs.h b/libisofs/libisofs.h index 18aa685..ff46681 100644 --- a/libisofs/libisofs.h +++ b/libisofs/libisofs.h @@ -5858,7 +5858,7 @@ int iso_local_get_acl_text(char *disk_path, char **text, int flag); * bit5= in case of symbolic link: manipulate link target * @return * > 0 ok - * 0 no ACL manipulation adapter available + * 0 no ACL manipulation adapter available for desired ACL type * -1 failure of system ACL service (see errno) * -2 attempt to manipulate ACL of a symbolic link without bit5 * resp. with no suitable link target @@ -5947,6 +5947,9 @@ int iso_local_get_attrs(char *disk_path, size_t *num_attrs, char ***names, * bit3= do not ignore eventual non-user attributes. * I.e. those with a name which does not begin by "user." * bit5= in case of symbolic link: manipulate link target + * bit6= @since 1.1.6 + tolerate inappropriate presence or absence of + * directory "default" ACL * @return * 1 = ok * < 0 = error