Avoided to store deleted ACL as attribute with empty value

This commit is contained in:
Thomas Schmitt 2009-01-25 10:49:07 +01:00
parent dc26d8eefc
commit 7dfec561d9
3 changed files with 22 additions and 4 deletions

View File

@ -344,6 +344,9 @@ Pending considerations:
- shall "AA" be fixely defined as signature ? - 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 - shall the tag types ACL_USER and ACL_GROUP with non-numeric qualifier be
revoked ? revoked ?

View File

@ -4232,6 +4232,12 @@ int iso_node_get_acl_text(IsoNode *node, char **text, int flag);
/* ts A90119 */ /* ts A90119 */
/** /**
* Set the ACL of the given node to the list in parameter text or delete it. * 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 * @param node
* The node that is to be manipulated. * The node that is to be manipulated.

View File

@ -1601,7 +1601,7 @@ int iso_node_set_acl_text(IsoNode *node, char *acl_text, int flag)
#ifdef Libisofs_with_aaiP #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 a_text_fill = 0, d_text_fill = 0;
size_t v_len, acl_len= 0; size_t v_len, acl_len= 0;
char **names = NULL, **values = NULL, *a_text = NULL, *d_text = NULL; 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 */; /* replace variable value */;
if (values[i] != NULL) if (values[i] != NULL)
free(values[i]); free(values[i]);
values[i] = (char *) acl; if(acl == NULL) { /* delete whole ACL attribute */
acl = NULL; for (j = i + 1; j < num_attrs; j++) {
value_lengths[i] = acl_len; 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 */ /* Encode attributes and attach to node */
ret = iso_node_set_attrs(node, num_attrs, names, value_lengths, values, ret = iso_node_set_attrs(node, num_attrs, names, value_lengths, values,