Enabled more actions for -findx: getfacl, getfattr, get_any_xattr
This commit is contained in:
@ -1156,17 +1156,20 @@ int Xorriso_findx_action(struct XorrisO *xorriso, struct FindjoB *job,
|
||||
char *abs_path, char *show_path, int depth, int flag)
|
||||
{
|
||||
int ret= 0, type, action= 0, dpl= 0, compare_result, uret, max_bit;
|
||||
int follow_links;
|
||||
uid_t user= 0;
|
||||
gid_t group= 0;
|
||||
time_t date= 0;
|
||||
mode_t mode_or= 0, mode_and= ~1;
|
||||
uint64_t chattr_flags, lfa_flags;
|
||||
char *target, *text_2, *wdi_mem= NULL, *disk_prefix, *iso_path= NULL;
|
||||
char *basename, *lfa_text= NULL;
|
||||
char *basename, *lfa_text= NULL, *acl_text= NULL, *attrlist= NULL;
|
||||
char *leafname= NULL;
|
||||
struct FindjoB *subjob;
|
||||
struct stat stbuf;
|
||||
|
||||
Xorriso_alloc_meM(iso_path, char, SfileadrL);
|
||||
Xorriso_alloc_meM(leafname, char, SfileadrL);
|
||||
|
||||
action= Findjob_get_action_parms(job, &target, &text_2, &user, &group,
|
||||
&mode_and, &mode_or, &type, &date, &subjob,
|
||||
@ -1250,6 +1253,36 @@ int Xorriso_findx_action(struct XorrisO *xorriso, struct FindjoB *job,
|
||||
Xorriso_result(xorriso,0);
|
||||
}
|
||||
{ret= 1; goto ex;}
|
||||
|
||||
} else if(action == 24) { /* getfacl */
|
||||
follow_links= (xorriso->do_follow_links ||
|
||||
(xorriso->do_follow_param && !(flag & 1))) << 5;
|
||||
ret= Xorriso_local_getfacl(xorriso, abs_path, &acl_text, follow_links);
|
||||
if(ret == 1) {
|
||||
ret= lstat(abs_path, &stbuf);
|
||||
if(ret == -1)
|
||||
{ret= 0; goto ex;}
|
||||
ret= Xorriso_report_acl_header(xorriso, show_path,
|
||||
stbuf.st_uid, stbuf.st_gid, 0);
|
||||
if(ret > 0) {
|
||||
strcpy(xorriso->result_line, acl_text);
|
||||
Xorriso_result(xorriso, 0);
|
||||
}
|
||||
}
|
||||
if(acl_text != NULL)
|
||||
Xorriso_local_getfacl(xorriso, "", &acl_text, 1 << 15);
|
||||
|
||||
} else if(action == 26) { /* getfattr */
|
||||
follow_links= (xorriso->do_follow_links ||
|
||||
(xorriso->do_follow_param && !(flag & 1))) << 5;
|
||||
ret= Xorriso_getfattr(xorriso, NULL, abs_path, &attrlist, 2 | follow_links);
|
||||
|
||||
} else if(action == 33) { /* get_any_xattr */
|
||||
follow_links= (xorriso->do_follow_links ||
|
||||
(xorriso->do_follow_param && !(flag & 1))) << 5;
|
||||
ret= Xorriso_getfattr(xorriso, NULL, abs_path, &attrlist,
|
||||
2 | 8 | follow_links);
|
||||
|
||||
} else if(action == 40) { /* estimate_size */
|
||||
basename= strrchr(abs_path, '/');
|
||||
if(basename != NULL)
|
||||
@ -1263,6 +1296,14 @@ int Xorriso_findx_action(struct XorrisO *xorriso, struct FindjoB *job,
|
||||
} else if(action == 44) { /* list_extattr */
|
||||
ret= Xorriso_list_extattr(xorriso, NULL, abs_path, show_path, target, 2);
|
||||
|
||||
} else if(action == 50) { /* print_outname */
|
||||
ret= Sfile_leafname(abs_path, leafname, 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
ret= Xorriso_test_outchar(xorriso, NULL, leafname, type, 1);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
|
||||
} else if(action == 60) { /* lsattrd */
|
||||
ret= Xorriso_get_lfa_flags(xorriso, NULL, show_path, &lfa_flags, &max_bit,
|
||||
2);
|
||||
@ -1294,6 +1335,7 @@ ex:;
|
||||
xorriso->request_to_abort= 1; /* Need an image. No use to try again. */
|
||||
if(wdi_mem != NULL)
|
||||
free(wdi_mem);
|
||||
Xorriso_free_meM(leafname);
|
||||
Xorriso_free_meM(iso_path);
|
||||
return(ret);
|
||||
}
|
||||
|
Reference in New Issue
Block a user