More bug fixes about "default" ACL.
Made aaip_xinfo_func() available unconditionally.
This commit is contained in:
parent
b53ef57ac6
commit
6dee6e4c20
@ -498,16 +498,16 @@ int aaip_encode_both_acl(char *a_acl_text, char *d_acl_text, mode_t st_mode,
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
}
|
||||
if(a_acl == NULL) {
|
||||
if(a_acl == NULL || a_acl_len == 0) {
|
||||
acl= d_acl;
|
||||
d_acl= NULL;
|
||||
acl_len= d_acl_len;
|
||||
} else if (d_acl == NULL) {
|
||||
} else if (d_acl == NULL || d_acl_len == 0) {
|
||||
acl= a_acl;
|
||||
a_acl= NULL;
|
||||
acl_len= a_acl_len;
|
||||
} else {
|
||||
acl= calloc(a_acl_len + d_acl_len + 1, 1);
|
||||
acl= calloc(a_acl_len + d_acl_len, 1);
|
||||
if(acl == NULL)
|
||||
{ret = -1; goto ex;}
|
||||
memcpy(acl, a_acl, a_acl_len);
|
||||
@ -2007,7 +2007,7 @@ int aaip_decode_acl(unsigned char *data, size_t num_data, size_t *consumed,
|
||||
} else if(type == Aaip_SWITCH_MARK) {
|
||||
/* Indicate to caller: end of desired ACL type access/default */
|
||||
if((perm & Aaip_EXEC) ^ (!!(flag & 2)))
|
||||
return(2);
|
||||
{ret= 2; goto ex;}
|
||||
} else if(type == Aaip_ACL_USER_N) {
|
||||
/* determine username from uid */
|
||||
uid= 0;
|
||||
@ -2043,9 +2043,11 @@ int aaip_decode_acl(unsigned char *data, size_t num_data, size_t *consumed,
|
||||
if(ret <= 0)
|
||||
return(-2);
|
||||
}
|
||||
ret= 1;
|
||||
ex:;
|
||||
if(flag & 1)
|
||||
*acl_text_fill= w_size + 1;
|
||||
return(1);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
|
@ -4222,14 +4222,12 @@ void iso_stream_get_id(IsoStream *stream, unsigned int *fs_id, dev_t *dev_id,
|
||||
*/
|
||||
|
||||
|
||||
#ifdef Libisofs_with_aaiP
|
||||
|
||||
/* ts A90114 */
|
||||
/**
|
||||
* Function to identify and manage AA strings as xinfo of IsoNode
|
||||
*/
|
||||
int aaip_xinfo_func(void *data, int flag);
|
||||
|
||||
#endif /* Libisofs_with_aaiP */
|
||||
|
||||
/* ts A90116 */
|
||||
/**
|
||||
@ -4292,6 +4290,11 @@ int iso_node_set_acl_text(IsoNode *node, char *text, int flag);
|
||||
|
||||
|
||||
/* -------- This is an interface to the ACL of the local filesystem -------- */
|
||||
/**
|
||||
* libisofs has an internal system dependent adapter to ACL operations. For
|
||||
* the sake of completeness and simplicity it exposes this functionality to
|
||||
* its applications which might want to get and set ACLs from local files.
|
||||
*/
|
||||
|
||||
/* ts A90127 */
|
||||
/**
|
||||
|
@ -277,6 +277,33 @@ const char *iso_node_get_name(const IsoNode *node)
|
||||
return node->name;
|
||||
}
|
||||
|
||||
/* ta A90128 */
|
||||
/**
|
||||
* See API function iso_node_set_permissions()
|
||||
*
|
||||
* @param flag bit0= do not adjust ACL
|
||||
* @return >0 success , <0 error
|
||||
*/
|
||||
static
|
||||
int iso_node_set_perms_internal(IsoNode *node, mode_t mode, int flag)
|
||||
{
|
||||
int ret;
|
||||
|
||||
node->mode = (node->mode & S_IFMT) | (mode & ~S_IFMT);
|
||||
|
||||
#ifdef Libisofs_with_aaiP
|
||||
/* ts A90119 */
|
||||
|
||||
/* If the node has ACL info : update ACL */
|
||||
ret = 1;
|
||||
if (!(flag & 1))
|
||||
ret = iso_node_set_acl_text(node, "", 2);
|
||||
|
||||
return ret;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the permissions for the node. This attribute is only useful when
|
||||
* Rock Ridge extensions are enabled.
|
||||
@ -288,18 +315,7 @@ const char *iso_node_get_name(const IsoNode *node)
|
||||
*/
|
||||
void iso_node_set_permissions(IsoNode *node, mode_t mode)
|
||||
{
|
||||
node->mode = (node->mode & S_IFMT) | (mode & ~S_IFMT);
|
||||
|
||||
#ifdef Libisofs_with_aaiP
|
||||
/* ts A90119 */
|
||||
|
||||
/* If the node has ACL info : update ACL */;
|
||||
iso_node_set_acl_text(node, "", 2);
|
||||
|
||||
/* >>> actually iso_node_set_permissions() would need a return value now */
|
||||
|
||||
#endif
|
||||
|
||||
iso_node_set_perms_internal(node, mode, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1481,12 +1497,13 @@ int iso_decode_acl(unsigned char *v_data, size_t v_len, size_t *consumed,
|
||||
{
|
||||
int ret;
|
||||
|
||||
*text= NULL;
|
||||
ret = aaip_decode_acl(v_data, v_len,
|
||||
consumed, NULL, (size_t) 0, text_fill, 1);
|
||||
if (ret <= 0)
|
||||
return 0;
|
||||
if (text_fill == 0)
|
||||
return 0;
|
||||
if (*text_fill == 0)
|
||||
return ret;
|
||||
*text = calloc(*text_fill + 42, 1); /* 42 for aaip_update_acl_st_mode */
|
||||
if (*text == NULL)
|
||||
return ISO_OUT_OF_MEM;
|
||||
@ -1494,6 +1511,7 @@ int iso_decode_acl(unsigned char *v_data, size_t v_len, size_t *consumed,
|
||||
consumed, *text, *text_fill, text_fill, 0);
|
||||
if (ret <= 0) {
|
||||
free(*text);
|
||||
*text= NULL;
|
||||
return 0;
|
||||
}
|
||||
return ret;
|
||||
@ -1773,7 +1791,7 @@ update_perms:;
|
||||
ret = aaip_cleanout_st_mode(acl_text, &st_mode, 4);
|
||||
if (ret < 0)
|
||||
goto bad_decode;
|
||||
iso_node_set_permissions(node, st_mode);
|
||||
iso_node_set_perms_internal(node, st_mode, 1);
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
|
@ -739,7 +739,6 @@ int susp_add_ES(Ecma119Image *t, struct susp_info *susp, int to_ce, int seqno)
|
||||
}
|
||||
|
||||
|
||||
#ifdef Libisofs_with_aaiP
|
||||
/* ts A90114 */
|
||||
|
||||
int aaip_xinfo_func(void *data, int flag)
|
||||
@ -750,8 +749,6 @@ int aaip_xinfo_func(void *data, int flag)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* Libisofs_with_aaiP */
|
||||
|
||||
|
||||
/* ts A90117 */
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user