Enabling non-user xattr namespaces with -getfattr and -setfattr

This commit is contained in:
2017-11-15 11:10:33 +01:00
parent 3eee0607ec
commit 3794753662
7 changed files with 253 additions and 157 deletions

View File

@ -813,7 +813,8 @@ too_long:
/*
@param flag bit0= do not report to result but only retrieve attr text
bit1= path is disk_path
bit3= do not ignore eventual non-user attributes.
bit3= do not ignore non-user attributes
bit4= ignore isofs. attributes despite bit3
bit5= in case of symbolic link on disk: inquire link target
bit6= check for existence of xattr, return 0 or 1
(depends also on bit3)
@ -827,6 +828,8 @@ int Xorriso_getfattr(struct XorrisO *xorriso, void *in_node, char *path,
if(attr_text != NULL)
*attr_text= NULL;
if((xorriso->do_aaip & 1024) && !(flag & 8))
flag|= 8 | 16;
ret= Xorriso_get_attrs(xorriso, in_node, path, &num_attrs, &names,
&value_lengths, &values, flag & (2 | 8 | 32));
if(ret <= 0)
@ -852,6 +855,9 @@ int Xorriso_getfattr(struct XorrisO *xorriso, void *in_node, char *path,
}
}
for(i= 0; i < (int) num_attrs; i++) {
if(flag & 16)
if(strncmp(names[i], "isofs.", 6) == 0)
continue;
if(strlen(names[i]) + value_lengths[i] >= SfileadrL) {
sprintf(xorriso->result_line, "# oversized: name %d , value %d bytes\n",
(int) strlen(names[i]), (int) value_lengths[i]);
@ -880,6 +886,14 @@ int Xorriso_getfattr(struct XorrisO *xorriso, void *in_node, char *path,
}
}
}
if((flag & 16) && attr_text != NULL)
if(*attr_text != NULL)
if((*attr_text)[0] == 0) {
free(*attr_text);
*attr_text= NULL;
ret= 2;
goto ex;
}
if(!(flag & 1)) {
strcpy(xorriso->result_line, "\n");
Xorriso_result(xorriso, 0);