New flag bit with iso_node_set_attrs() to protect namespace "isofs"
This commit is contained in:
parent
942ec97c7b
commit
7001121a3f
@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
|
||||
/* Some extra debugging messages for Vladimir Serbinko
|
||||
/* Some extra debugging messages for Vladimir Serbinenko
|
||||
#define Libisofs_hfsplus_verbose_debuG yes
|
||||
*/
|
||||
|
||||
|
@ -6076,6 +6076,10 @@ int iso_node_lookup_attr(IsoNode *node, char *name,
|
||||
* I.e. those with a non-empty name which does not begin by "user."
|
||||
* (The empty name is always allowed and governed by bit0.) This
|
||||
* deletes all previously existing attributes if not bit1 is set.
|
||||
* bit4= Do not affect attributes from namespace "isofs".
|
||||
* To be combined with bit3 for copying attributes from local
|
||||
* filesystem to ISO image.
|
||||
* @since 1.2.4
|
||||
* @return
|
||||
* 1 = ok
|
||||
* < 0 = error
|
||||
|
@ -1727,6 +1727,7 @@ int attr_enlarge_list(char ***names, size_t **value_lengths, char ***values,
|
||||
bit2= delete the given names rather than overwrite
|
||||
their content
|
||||
bit4= do not overwrite value of empty name
|
||||
bit5= do not overwrite isofs attributes
|
||||
bit15= release memory and return 1
|
||||
*/
|
||||
static
|
||||
@ -1775,6 +1776,8 @@ int iso_node_merge_xattr(IsoNode *node, size_t num_attrs, char **names,
|
||||
continue;
|
||||
if (names[i][0] == 0 && (flag & 16))
|
||||
continue;
|
||||
if ((flag & 32) && strncmp(names[i], "isofs.", 6) == 0)
|
||||
continue;
|
||||
for (j = 0; j < *m_num_attrs; j++) {
|
||||
if ((*m_names)[j] == NULL)
|
||||
continue;
|
||||
@ -1820,6 +1823,8 @@ int iso_node_merge_xattr(IsoNode *node, size_t num_attrs, char **names,
|
||||
continue;
|
||||
if (names[i][0] == 0 && (flag & 16))
|
||||
continue;
|
||||
if ((flag & 32) && strncmp(names[i], "isofs.", 6) == 0)
|
||||
continue;
|
||||
for (j = 0; j < *m_num_attrs; j++) {
|
||||
if ((*m_names)[j] == NULL)
|
||||
continue;
|
||||
@ -1870,13 +1875,13 @@ int iso_node_set_attrs(IsoNode *node, size_t num_attrs, char **names,
|
||||
for (i = 0; i < num_attrs; i++)
|
||||
if (strncmp(names[i], "user.", 5) != 0 && names[i][0] != 0)
|
||||
return ISO_AAIP_NON_USER_NAME;
|
||||
|
||||
if ((flag & (2 | 4)) || !(flag & 8)) {
|
||||
if ((flag & (2 | 4 | 16)) || !(flag & 8)) {
|
||||
/* Merge old and new lists */
|
||||
ret = iso_node_merge_xattr(
|
||||
node, num_attrs, names, value_lengths, values,
|
||||
&m_num, &m_names, &m_value_lengths, &m_values,
|
||||
(flag & 4) | (!(flag & 2)) | ((!(flag & 1)) << 4));
|
||||
(flag & 4) | (!(flag & 2)) | ((!(flag & 1)) << 4) |
|
||||
((flag & 16) << 1));
|
||||
if (ret < 0)
|
||||
goto ex;
|
||||
num_attrs = m_num;
|
||||
|
Loading…
Reference in New Issue
Block a user