From b09dcd52466f7e717645115338001d8aa3c112be Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 9 Feb 2009 11:17:33 +0100 Subject: [PATCH] Fixed a bug about setting "default" ACL on Linux directories. --- libisofs/aaip-os-linux.c | 6 +++--- libisofs/libisofs.h | 1 + libisofs/node.c | 7 ++++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/libisofs/aaip-os-linux.c b/libisofs/aaip-os-linux.c index 0e4f69c..ea1c597 100644 --- a/libisofs/aaip-os-linux.c +++ b/libisofs/aaip-os-linux.c @@ -372,7 +372,7 @@ int aaip_set_attr_list(char *path, size_t num_attrs, char **names, size_t *value_lengths, char **values, int flag) { int ret, has_default_acl= 0; - size_t i, consumed, acl_text_fill, list_size= 0, acl_idx= 0; + size_t i, consumed, acl_text_fill, list_size= 0, acl_idx= 0, h_consumed; char *acl_text= NULL, *list= NULL; #ifdef Libisofs_with_aaip_xattR @@ -469,7 +469,7 @@ int aaip_set_attr_list(char *path, size_t num_attrs, char **names, free(acl_text); acl_text= NULL; ret= aaip_decode_acl((unsigned char *) (values[i] + consumed), - value_lengths[i] - consumed, &consumed, + value_lengths[i] - consumed, &h_consumed, NULL, 0, &acl_text_fill, 1); if(ret <= 0) {ret= -2; goto ex;} @@ -477,7 +477,7 @@ int aaip_set_attr_list(char *path, size_t num_attrs, char **names, if(acl_text == NULL) {ret= -1; goto ex;} ret= aaip_decode_acl((unsigned char *) (values[i] + consumed), - value_lengths[i] - consumed, &consumed, + value_lengths[i] - consumed, &h_consumed, acl_text, acl_text_fill, &acl_text_fill, 0); if(ret <= 0) {ret= -2; goto ex;} diff --git a/libisofs/libisofs.h b/libisofs/libisofs.h index e9f317a..ef9be84 100644 --- a/libisofs/libisofs.h +++ b/libisofs/libisofs.h @@ -4351,6 +4351,7 @@ int iso_node_set_acl_text(IsoNode *node, * Like iso_node_get_permissions but reflecting ACL entry "group::" in S_IRWXG * rather than ACL entry "mask::". This is necessary if the permissions of a * node with ACL shall be restored to a filesystem without restoring the ACL. + * The same mapping happens internally when the ACL of a node is deleted. * If the node has no ACL then the result is iso_node_get_permissions(node). * @param node * The node that is to be inquired. diff --git a/libisofs/node.c b/libisofs/node.c index 0905f67..4a006f4 100644 --- a/libisofs/node.c +++ b/libisofs/node.c @@ -2160,8 +2160,13 @@ int iso_local_set_attrs(char *disk_path, size_t num_attrs, char **names, ret = aaip_set_attr_list(disk_path, num_attrs, names, value_lengths, values, (flag & (8 | 32)) | !(flag & 1)); - if (ret <= 0) + if (ret <= 0) { + if (ret == -1) + return ISO_OUT_OF_MEM; + if (ret == -2) + return ISO_AAIP_BAD_AASTRING; return ISO_AAIP_NO_SET_LOCAL; + } return 1; #else /* Libisofs_with_aaiP */