Enabled restoring of xattr

This commit is contained in:
Thomas Schmitt 2009-02-02 20:11:26 +00:00
parent f861321c45
commit efa1164328
3 changed files with 66 additions and 8 deletions

View File

@ -35,7 +35,7 @@ optical media or to filesystem objects.
Vice versa xorriso is able to restore file objects from ISO 9660 filesystems.
.PP
A special property of xorriso is that it needs neither an external ISO 9660
formatter program nor an external burn program for CD or DVD but rather
formatter program nor an external burn program for CD, DVD or BD but rather
incorporates the libraries of libburnia-project.org .
.SS
.B Overview of features:
@ -53,6 +53,8 @@ Updates ISO subtrees incrementally to match given disk subtrees.
Writes result either as completely new image or as add-on session
to optical media or filesystem objects.
.br
Can record and restore ACL of disk files.
.br
Can activate ISOLINUX boot images via El Torito.
.br
Can perform multi-session tasks as emulation of mkisofs and cdrecord.
@ -1049,6 +1051,19 @@ matches only files which use data blocks outside the areas marked as damaged.
matches only files which use data blocks within the range of start_lba
and start_lba+block_count-1.
.br
-has_acl , -has_no_acl
.br
match files which have resp. have not a non-trivial ACL.
.br
-has_xattr , -has_no_xattr
.br
match files which have resp. have not xattr name-value pairs.
.br
-has_aaip , -has_no_aaip
.br
match files which have ACL or xattr resp. have neither of them.
.br
Default action is "echo",
i.e. to print the address of the found file. Other actions are certain
xorriso commands which get performed on the found files. These commands
@ -1139,6 +1154,12 @@ E.g.:
.br
-find /workgroup -exec setfacl u:lisa:rw,u::rw,g::r,o::-,m::rw
.br
"getfattr" prints eventual xattr name-value pairs to the result channel.
.br
E.g.:
.br
-find / -has_xattr -exec getfattr
.br
"find" performs another run of -find on the matching file address. It accepts
the same params as -find, except iso_rr_path.
E.g.:
@ -2059,7 +2080,7 @@ directories.
.TP
\fB\-getfattr\fR iso_rr_pattern [***]
Print the XFS style Extended Attributes of the given files in the ISO image.
If the file has no such xattr then noting is printed.
If ia file has no such xattr then noting is printed for it.
.TP
\fB\-getfattr_r\fR iso_rr_pattern [***]
Like -gefattr but listing recursively the whole file trees underneath eventual

View File

@ -1 +1 @@
#define Xorriso_timestamP "2009.02.02.134346"
#define Xorriso_timestamP "2009.02.02.201124"

View File

@ -2009,7 +2009,7 @@ int Xorriso_transfer_properties(struct XorrisO *xorriso, struct stat *stbuf,
if(xorriso->do_aaip & 5) {
ret= iso_local_get_attrs(disk_path, &num_attrs, &names, &value_lengths,
&values, ((xorriso->do_aaip & 1) && !(flag & 2))
| (!(xorriso->do_aaip & 4)) << 4);
| (!(xorriso->do_aaip & 4)) << 2);
if(ret < 0) {
Xorriso_process_msg_queues(xorriso,0);
Xorriso_report_iso_error(xorriso, disk_path, ret,
@ -2862,9 +2862,16 @@ int Xorriso_restore_properties(struct XorrisO *xorriso, char *disk_path,
uid_t uid;
gid_t gid;
struct utimbuf utime_buffer;
char sfe[5*SfileadrL], *access_text= NULL, *default_text= NULL;
char sfe[5*SfileadrL];
struct stat stbuf;
#ifdef NIX
char *access_text= NULL, *default_text= NULL;
#else
size_t num_attrs= 0, *value_lengths= NULL;
char **names= NULL, **values= NULL;
#endif
ret= lstat(disk_path, &stbuf);
if(ret==-1) {
sprintf(xorriso->info_text,
@ -2902,10 +2909,9 @@ int Xorriso_restore_properties(struct XorrisO *xorriso, char *disk_path,
#ifdef Xorriso_with_aaiP
#ifdef NIX
if(xorriso->do_aaip & 2) {
/* >>> change to iso_node_get_attrs */;
ret= iso_node_get_acl_text(node, &access_text, &default_text, 16);
if(ret < 0) {
strcpy(xorriso->info_text, "Error with obtaining ACL for ");
@ -2934,6 +2940,33 @@ cannot_change_acl:;
}
}
#else /* NIX */
if(xorriso->do_aaip & 10) {
ret= iso_node_get_attrs(node, &num_attrs, &names, &value_lengths, &values,
(!!(xorriso->do_aaip & 2)) | (!(xorriso->do_aaip & 8)) << 2);
if (ret < 0) {
strcpy(xorriso->info_text, "Error with obtaining ACL and xattr for ");
Text_shellsafe(disk_path, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
{ret= 0; goto ex;}
}
if(num_attrs > 0) {
ret= iso_local_set_attrs(disk_path, num_attrs, names, value_lengths,
values, 0);
if(ret < 0) {
sprintf(xorriso->info_text,
"Cannot change ACL or xattr of disk file %s",
Text_shellsafe(disk_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",0);
{ret= 0; goto ex;}
}
}
Xorriso_process_msg_queues(xorriso,0);
}
#endif /* ! NIX */
#endif /* Xorriso_with_aaiP */
if(flag&1)
@ -2955,7 +2988,11 @@ cannot_change_acl:;
}
ret= 1;
ex:;
#ifdef NIX
iso_node_get_acl_text(node, &access_text, &default_text, 1 << 15);
#else
iso_node_get_attrs(node, &num_attrs, &names, &value_lengths, &values,1 << 15);
#endif
return(ret);
}