New find actions get_md5, get_any_xattr, test -has_any_xattr

master
Thomas Schmitt 14 years ago
parent 6de5c8d9d4
commit d1490aa95e
  1. 16
      xorriso/xorriso.1
  2. 12
      xorriso/xorriso.c
  3. 2
      xorriso/xorriso_timestamp.h
  4. 73
      xorriso/xorrisoburn.c

@ -2,7 +2,7 @@
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH XORRISO 1 "Aug 03, 2009"
.TH XORRISO 1 "Aug 09, 2009"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@ -487,7 +487,7 @@ to make dialog more comfortable.
.PP
Readline is an enhancement for the input line. You may know it already from
the bash shell. Whether it is available in xorriso depends on the availability
package readline-dev at the time when xorriso was built from its sourcecode.
of package readline-dev at the time when xorriso was built from its sourcecode.
.br
It allows to move the cursor over the text in the line by help of the
Leftward and the Rightward arrow key.
@ -1304,6 +1304,9 @@ Matches files which have xattr name-value pairs from user namespace.
\fB\-has_aaip\fR :
Matches files which have ACL or any xattr.
.br
\fB\-has_any_xattr\fR :
Matches files which have any xattr other than ACL.
.br
\fB\-has_filter\fR :
Matches files which are filtered by -set_filter.
.br
@ -1412,7 +1415,14 @@ ACL is given in text form as defined with option -setfacl.
.br
E.g.: -exec setfacl u:lisa:rw,u::rw,g::r,o::-,m::rw --
.br
\fBgetfattr\fR prints eventual xattr name-value pairs to the result channel.
\fBgetfattr\fR prints eventual xattr name-value pairs from user namespace
to the result channel.
.br
\fBget_any_xattr\fR prints eventual xattr name-value pairs from any namespace
except ACL to the result channel. This is mostly for debugging of
namespace "isofs".
.br
\fBget_md5\fR prints eventual recorded MD5 sum together with file path.
.br
\fBsetfattr\fR sets or deletes xattr name value pairs.
.br

@ -3307,12 +3307,13 @@ int Findjob_set_acl_filter(struct FindjoB *o, int value, int flag)
/* @param value -1= files without xattr, 1= only files with xattr
@param flag bit0=-has_any_xattr rather than -has_xattr
*/
int Findjob_set_xattr_filter(struct FindjoB *o, int value, int flag)
{
int ret;
ret= Findjob_set_prop_filter(o, 6, value, 0);
ret= Findjob_set_prop_filter(o, (flag & 1 ? 14 : 6), value, 0);
return(ret);
}
@ -15239,6 +15240,8 @@ not_enough_arguments:;
Findjob_set_acl_filter(job, -1, 0);
} else if(strcmp(argv[i], "-has_xattr")==0) {
Findjob_set_xattr_filter(job, 1, 0);
} else if(strcmp(argv[i], "-has_any_xattr")==0) {
Findjob_set_xattr_filter(job, 1, 1);
} else if(strcmp(argv[i], "-has_no_xattr")==0) {
Findjob_set_xattr_filter(job, -1, 0);
} else if(strcmp(argv[i], "-has_aaip")==0) {
@ -15475,6 +15478,10 @@ not_enough_exec_arguments:;
}
} else if(strcmp(cpt, "show_stream")==0) {
Findjob_set_action_target(job, 29, NULL, 0);
} else if(strcmp(cpt, "get_any_xattr")==0) {
Findjob_set_action_target(job, 33, NULL, 0);
} else if(strcmp(cpt, "get_md5")==0) {
Findjob_set_action_target(job, 34, NULL, 0);
} else {
sprintf(xorriso->info_text, "-find -exec: unknown action %s",
Text_shellsafe(argv[i], sfe, 0));
@ -15616,6 +15623,7 @@ int Xorriso_option_fs(struct XorrisO *xorriso, char *size, int flag)
*/
/* @param flag bit0= recursive -getfacl_r
bit1= getfattr rather than getfacl
bit3= with bit1: do not ignore eventual non-user attributes
*/
int Xorriso_option_getfacli(struct XorrisO *xorriso,
int argc, char **argv, int *idx, int flag)
@ -15646,7 +15654,7 @@ int Xorriso_option_getfacli(struct XorrisO *xorriso,
Findjob_destroy(&job, 0);
} else {
if(flag & 2)
ret= Xorriso_getfattr(xorriso, NULL, optv[i], NULL, 0);
ret= Xorriso_getfattr(xorriso, NULL, optv[i], NULL, flag & 8);
else
ret= Xorriso_getfacl(xorriso, NULL, optv[i], NULL, 0);
}

@ -1 +1 @@
#define Xorriso_timestamP "2009.08.03.075954"
#define Xorriso_timestamP "2009.08.10.123146"

@ -7502,7 +7502,7 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
gid_t group= 0;
time_t date= 0;
mode_t mode_or= 0, mode_and= ~1;
char *target, *text_2, sfe[5*SfileadrL], *iso_prefix;
char *target, *text_2, sfe[5*SfileadrL], *iso_prefix, md5[16];
struct FindjoB *subjob;
struct stat dir_stbuf;
@ -7588,7 +7588,12 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
iso_prefix, target, 0);
if(ret==2)
deleted= 1;
} else if(action == 33) {
ret= Xorriso_getfattr(xorriso, (void *) node, show_path, NULL, 8);
} else if(action == 34) {
ret= Xorriso_get_md5(xorriso, (void *) node, show_path, md5, 0);
if(ret >= 0)
ret= 1;
} else { /* includes : 15 in_iso */
sprintf(xorriso->result_line, "%s\n", Text_shellsafe(show_path, sfe, 0));
Xorriso_result(xorriso, 0);
@ -7734,7 +7739,9 @@ return:
value= (ret == 1);
break; case 6: /* -has_xattr */
ret = Xorriso_getfattr(xorriso, (void *) node, "", NULL, 64);
case 14: /* -has_any_xattr */
ret = Xorriso_getfattr(xorriso, (void *) node, "", NULL,
64 | (8 * (ftest->test_type == 14)));
if(ret < 0) {
value= -1;
Xorriso_process_msg_queues(xorriso, 0);
@ -10373,6 +10380,7 @@ ok:;
/*
@param flag bit0= do not remove leading slash
bit1= append flatly to result_line and put out
*/
int Xorriso_getfname(struct XorrisO *xorriso, char *path, int flag)
{
@ -10387,7 +10395,12 @@ int Xorriso_getfname(struct XorrisO *xorriso, char *path, int flag)
strlen(path + path_offset), 8);
if(ret <= 0)
return(-1);
sprintf(xorriso->result_line, "# file: %s\n", bsl_path[0] ? bsl_path : ".");
if(flag & 2) {
sprintf(xorriso->result_line + strlen(xorriso->result_line),
"%s\n", bsl_path[0] ? bsl_path : ".");
} else {
sprintf(xorriso->result_line, "# file: %s\n", bsl_path[0] ? bsl_path : ".");
}
free(bsl_path);
bsl_path= NULL;
/* temporarily disable -backslash_codes with result output */
@ -10607,9 +10620,10 @@ ex:;
/*
@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.
bit5= in case of symbolic link on disk: inquire link target
bit6= check for existence of user namespaceL xattr,
return 0 or 1
bit6= check for existence of xattr, return 0 or 1
(depends also on bit3)
*/
int Xorriso_getfattr(struct XorrisO *xorriso, void *in_node, char *path,
char **attr_text, int flag)
@ -10621,7 +10635,7 @@ int Xorriso_getfattr(struct XorrisO *xorriso, void *in_node, char *path,
if(attr_text != NULL)
*attr_text= NULL;
ret= Xorriso_get_attrs(xorriso, in_node, path, &num_attrs, &names,
&value_lengths, &values, flag & (2 | 32));
&value_lengths, &values, flag & (2 | 8 | 32));
if(ret <= 0)
goto ex;
if(flag & 64) {
@ -12138,3 +12152,48 @@ ex:;
}
/*
@param flag bit0= do not report to result but only retrieve md5 text
bit6= check for existence of md5, return 0 or 1
*/
int Xorriso_get_md5(struct XorrisO *xorriso, void *in_node, char *path,
char md5[16], int flag)
{
int ret= 1, i;
char *wpt;
IsoImage *image;
IsoNode *node;
ret= Xorriso_get_volume(xorriso, &image, 0);
if(ret <= 0)
goto ex;
node= (IsoNode *) in_node;
if(node == NULL) {
ret= Xorriso_get_node_by_path(xorriso, path, NULL, &node, 0);
if(ret<=0)
goto ex;
}
if(!LIBISO_ISREG(node))
return(0);
ret= iso_file_get_md5(image, (IsoFile *) node, md5, 0);
Xorriso_process_msg_queues(xorriso,0);
if(ret <= 0)
goto ex;
if(flag & 1)
{ret= 1; goto ex;}
wpt= xorriso->result_line;
for(i= 0; i < 16; i++) {
sprintf(wpt, "%2.2x", ((unsigned char *) md5)[i]);
wpt+= 2;
}
strcpy(wpt, " ");
wpt+= 2;
Xorriso_getfname(xorriso, path, 1 | 2);
ret= 1;
ex:;
return(ret);
}

Loading…
Cancel
Save