From 7dfec561d9c86ba9b96879c713f216f45d713988 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 25 Jan 2009 10:49:07 +0100 Subject: [PATCH] Avoided to store deleted ACL as attribute with empty value --- doc/susp_aaip_0_2.txt | 3 +++ libisofs/libisofs.h | 6 ++++++ libisofs/node.c | 17 +++++++++++++---- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/doc/susp_aaip_0_2.txt b/doc/susp_aaip_0_2.txt index e482627..a2959bb 100644 --- a/doc/susp_aaip_0_2.txt +++ b/doc/susp_aaip_0_2.txt @@ -344,6 +344,9 @@ Pending considerations: - shall "AA" be fixely defined as signature ? +- shall an "ER" be issued at all ? + >>> look into SUSP 1.12 for ES + - shall the tag types ACL_USER and ACL_GROUP with non-numeric qualifier be revoked ? diff --git a/libisofs/libisofs.h b/libisofs/libisofs.h index 6712dbf..9a26136 100644 --- a/libisofs/libisofs.h +++ b/libisofs/libisofs.h @@ -4232,6 +4232,12 @@ int iso_node_get_acl_text(IsoNode *node, char **text, int flag); /* ts A90119 */ /** * Set the ACL of the given node to the list in parameter text or delete it. + * + * The POSIX permission bits get updated according to the new ACL if neither + * bit0 nor bit1 of parameter flag are set nor parameter text is NULL. + * Note that S_IRWXG permission bits correspond to ACL mask permissions + * if a "mask::" entry exists in the ACL. Only if there is no "mask::" then + * the "group::" entry corresponds to to S_IRWXG. * * @param node * The node that is to be manipulated. diff --git a/libisofs/node.c b/libisofs/node.c index 3d44f1f..2ec3cd2 100644 --- a/libisofs/node.c +++ b/libisofs/node.c @@ -1601,7 +1601,7 @@ int iso_node_set_acl_text(IsoNode *node, char *acl_text, int flag) #ifdef Libisofs_with_aaiP - size_t num_attrs = 0, *value_lengths = NULL, i, consumed; + size_t num_attrs = 0, *value_lengths = NULL, i, j, consumed; size_t a_text_fill = 0, d_text_fill = 0; size_t v_len, acl_len= 0; char **names = NULL, **values = NULL, *a_text = NULL, *d_text = NULL; @@ -1688,9 +1688,18 @@ int iso_node_set_acl_text(IsoNode *node, char *acl_text, int flag) /* replace variable value */; if (values[i] != NULL) free(values[i]); - values[i] = (char *) acl; - acl = NULL; - value_lengths[i] = acl_len; + if(acl == NULL) { /* delete whole ACL attribute */ + for (j = i + 1; j < num_attrs; j++) { + names[j - 1] = names[j]; + value_lengths[j - 1] = value_lengths[j]; + values[j - 1] = values[j]; + } + num_attrs--; + } else { + values[i] = (char *) acl; + acl = NULL; + value_lengths[i] = acl_len; + } /* Encode attributes and attach to node */ ret = iso_node_set_attrs(node, num_attrs, names, value_lengths, values,