Updating st_mode permission bits in iso_node_set_acl_text()

This commit is contained in:
Thomas Schmitt 2009-01-24 17:45:22 +01:00
parent bd9b49714f
commit dc26d8eefc
1 changed files with 15 additions and 2 deletions

View File

@ -19,6 +19,7 @@
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <limits.h> #include <limits.h>
#include <stdio.h>
struct dir_iter_data struct dir_iter_data
{ {
@ -1666,7 +1667,7 @@ int iso_node_set_acl_text(IsoNode *node, char *acl_text, int flag)
free(*tpt); free(*tpt);
*tpt = NULL; *tpt = NULL;
} }
if (acl_text != 0) { if (acl_text != NULL) {
*tpt = calloc(strlen(acl_text) + 1, 1); *tpt = calloc(strlen(acl_text) + 1, 1);
if (*tpt == NULL) { if (*tpt == NULL) {
ret = ISO_OUT_OF_MEM; ret = ISO_OUT_OF_MEM;
@ -1694,7 +1695,9 @@ int iso_node_set_acl_text(IsoNode *node, char *acl_text, int flag)
/* 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,
0); 0);
goto ex; if (ret <= 0)
goto ex;
goto update_perms;
} }
/* There is no ACL yet */ /* There is no ACL yet */
@ -1752,6 +1755,16 @@ int iso_node_set_acl_text(IsoNode *node, char *acl_text, int flag)
if (ret < 0) if (ret < 0)
goto ex; goto ex;
update_perms:;
if(acl_text != NULL && !(flag & (1 | 2))) {
/* Update node permissions by acl_text */
st_mode = iso_node_get_permissions(node);
ret = aaip_cleanout_st_mode(acl_text, &st_mode, 4);
if (ret < 0)
goto bad_decode;
iso_node_set_permissions(node, st_mode);
}
ret = 1; ret = 1;
ex:; ex:;
iso_node_get_attrs(node, &num_attrs, &names, iso_node_get_attrs(node, &num_attrs, &names,