diff --git a/libisofs/fs_image.c b/libisofs/fs_image.c index 87535e6..81546c5 100644 --- a/libisofs/fs_image.c +++ b/libisofs/fs_image.c @@ -1938,7 +1938,7 @@ int read_root_susp_entries(_ImageFsData *data, uint32_t block) if (SUSP_SIG(sue, 'E', 'R')) { -#ifndef Libisofs_with_aaiP +#ifndef Libisofs_with_aaiP_retro /* ts A90113 : this warning is not appropriate any more */ if (data->rr_version) { @@ -1951,7 +1951,7 @@ int read_root_susp_entries(_ImageFsData *data, uint32_t block) } } -#endif /* ! Libisofs_with_aaiP */ +#endif /* ! Libisofs_with_aaiP_retro */ /* * it seems that Rock Ridge can be identified with any diff --git a/libisofs/libisofs.h b/libisofs/libisofs.h index 42f36cd..1bce61d 100644 --- a/libisofs/libisofs.h +++ b/libisofs/libisofs.h @@ -4108,8 +4108,9 @@ void iso_stream_get_id(IsoStream *stream, unsigned int *fs_id, dev_t *dev_id, /* --------------------------------- AAIP --------------------------------- */ -/* ts A90112 : Enable experiments about EA and ACL */ +/* ts A90112 : Enable experiments about EA and ACL #define Libisofs_with_aaiP yes +*/ /* ts A90112 <<< write dummy AAIP fields with any node diff --git a/libisofs/node.c b/libisofs/node.c index 4338ed6..cd95d60 100644 --- a/libisofs/node.c +++ b/libisofs/node.c @@ -1429,10 +1429,19 @@ int iso_node_get_attrs(IsoNode *node, size_t *num_attrs, int iso_node_set_attrs(IsoNode *node, size_t num_attrs, char **names, size_t *value_lengths, char **values, int flag) { + +#ifdef Libisofs_with_aaiP + int ret; size_t sret, result_len; unsigned char *result; + if (num_attrs == 0) { + ret = iso_node_remove_xinfo(node, aaip_xinfo_func); + if (ret < 0) + return ret; + return 1; + } sret = aaip_encode("AA", num_attrs, names, value_lengths, values, &result_len, &result, 0); if (sret == 0) @@ -1451,9 +1460,20 @@ int iso_node_set_attrs(IsoNode *node, size_t num_attrs, char **names, return ISO_ERROR; } return 1; + +#else /* Libisofs_with_aaiP */ + + /* >>> no support for attributes */ + + return ISO_ERROR; + +#endif /* ! Libisofs_with_aaiP */ + } +#ifdef Libisofs_with_aaiP + static int iso_decode_acl(unsigned char *v_data, size_t v_len, size_t *consumed, char **text, size_t *text_fill, int flag) @@ -1478,10 +1498,15 @@ int iso_decode_acl(unsigned char *v_data, size_t v_len, size_t *consumed, return ret; } +#endif /* ! Libisofs_with_aaiP */ + /* ts A90116 */ int iso_node_get_acl_text(IsoNode *node, char **text, int flag) { + +#ifdef Libisofs_with_aaiP + size_t num_attrs = 0, *value_lengths = NULL, i, consumed, text_fill = 0; size_t v_len; char **names = NULL, **values = NULL; @@ -1496,8 +1521,6 @@ int iso_node_get_acl_text(IsoNode *node, char **text, int flag) return 1; } -#ifdef Libisofs_with_aaiP - *text = NULL; ret = iso_node_get_attrs(node, &num_attrs, &names, @@ -1574,6 +1597,9 @@ bad_decode:; /* ts A90119 */ 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 a_text_fill = 0, d_text_fill = 0; size_t v_len, acl_len= 0; @@ -1585,8 +1611,6 @@ int iso_node_set_acl_text(IsoNode *node, char *acl_text, int flag) int ret; mode_t st_mode; -#ifdef Libisofs_with_aaiP - if (flag & 2) { /* want to update ACL by st_mode */ st_mode = iso_node_get_permissions(node); } else { @@ -1652,7 +1676,7 @@ int iso_node_set_acl_text(IsoNode *node, char *acl_text, int flag) } } if (a_text != NULL || d_text != NULL) - ret = aaip_encode_both_acl(a_text, d_text, &acl_len, &acl, 0); + ret = aaip_encode_both_acl(a_text, d_text, &acl_len, &acl, 2); else ret = 1; if (ret <= 0) { @@ -1680,9 +1704,9 @@ int iso_node_set_acl_text(IsoNode *node, char *acl_text, int flag) goto ex; } if (flag & 1) - ret = aaip_encode_both_acl(NULL, acl_text, &acl_len, &acl, 0); + ret = aaip_encode_both_acl(NULL, acl_text, &acl_len, &acl, 2); else - ret = aaip_encode_both_acl(acl_text, NULL, &acl_len, &acl, 0); + ret = aaip_encode_both_acl(acl_text, NULL, &acl_len, &acl, 2); if (ret <= 0) { /* >>> cannot encode */; @@ -1750,7 +1774,7 @@ bad_decode:; #else /* Libisofs_with_aaiP */ - if (text != NULL) { + if (acl_text != NULL) { /* >>> No ACL enabled in program code */; diff --git a/libisofs/rockridge.c b/libisofs/rockridge.c index e0149b1..b5d4476 100644 --- a/libisofs/rockridge.c +++ b/libisofs/rockridge.c @@ -1178,10 +1178,10 @@ size_t rrip_calc_len(Ecma119Image *t, Ecma119Node *n, int type, size_t space, *ce += 160; /* ER of AAIP */ -#endif /* Libisofs_with_aaiP */ - } +#endif /* Libisofs_with_aaiP */ + } }