New commands -lfa_flags, -lsattr, -lsattrd, -chattr, -chattr_r, -find test -has_lfa_flags, -find actions lsattrd, chattr
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
|
||||
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
|
||||
|
||||
Copyright 2007-2020 Thomas Schmitt, <scdbackup@gmx.net>
|
||||
Copyright 2007-2024 Thomas Schmitt, <scdbackup@gmx.net>
|
||||
|
||||
Provided under GPL version 2 or later.
|
||||
|
||||
@ -147,6 +147,92 @@ ex:;
|
||||
}
|
||||
|
||||
|
||||
/* Command -lfa_flags */
|
||||
int Xorriso_option_lfa_flags(struct XorrisO *xorriso, char *mode, int flag)
|
||||
{
|
||||
int ret, lfa_flags_mem, l;
|
||||
char *npt, *cpt, *mask= NULL;
|
||||
uint64_t mask_flags;
|
||||
|
||||
lfa_flags_mem= xorriso->lfa_flags_setting;
|
||||
npt= cpt= mode;
|
||||
for(; npt!=NULL; cpt= npt+1) {
|
||||
npt= strchr(cpt,':');
|
||||
if(npt==NULL)
|
||||
l= strlen(cpt);
|
||||
else
|
||||
l= npt-cpt;
|
||||
if(l == 0)
|
||||
continue;
|
||||
if(l == 3 && strncmp(cpt, "off", l) == 0) {
|
||||
xorriso->lfa_flags_setting&= ~1;
|
||||
} else if((l == 2 && strncmp(cpt, "on", l) == 0)) {
|
||||
xorriso->lfa_flags_setting|= 1;
|
||||
} else if((l == 7 && strncmp(cpt, "restore", l) == 0)) {
|
||||
xorriso->lfa_flags_setting|= (1 << 12);
|
||||
} else if((l == 10 && strncmp(cpt, "no_restore", l) == 0)) {
|
||||
xorriso->lfa_flags_setting&= ~(1 << 12);
|
||||
} else if((l == 4 && strncmp(cpt, "read", l) == 0)) {
|
||||
xorriso->lfa_flags_setting|= (1 << 11);
|
||||
} else if((l == 7 && strncmp(cpt, "no_read", l) == 0)) {
|
||||
xorriso->lfa_flags_setting&= ~(1 << 11);
|
||||
} else if(l == 10 && strncmp(cpt, "restore_su", l) == 0) {
|
||||
xorriso->lfa_flags_setting&= ~2;
|
||||
xorriso->lfa_flags_setting&= ~(1 << 13);
|
||||
} else if(l == 13 && strncmp(cpt, "no_restore_su", l) == 0) {
|
||||
xorriso->lfa_flags_setting&= ~2;
|
||||
xorriso->lfa_flags_setting|= 1 << 13;
|
||||
} else if(l == 15 && strncmp(cpt, "restore_su_auto", l) == 0) {
|
||||
xorriso->lfa_flags_setting|= 2;
|
||||
} else if(l == 18 && strncmp(cpt, "restore_only_known", l) == 0) {
|
||||
xorriso->lfa_flags_setting|= 1 << 14;
|
||||
} else if(l == 15 && strncmp(cpt, "restore_unknown", l) == 0) {
|
||||
xorriso->lfa_flags_setting&= ~(1 << 14);
|
||||
} else if(l >= 13 && strncmp(cpt, "restore_mask=", 13) == 0) {
|
||||
if(l == 13) {
|
||||
xorriso->lfa_restore_mask= ~((uint64_t) 0);
|
||||
} else {
|
||||
Xorriso_alloc_meM(mask, char, l - 13 + 1);
|
||||
strncpy(mask, cpt + 13, l - 13);
|
||||
mask[l - 13]= 0;
|
||||
ret= Xorriso_decode_lfa_flags(xorriso, mask, &mask_flags, 0);
|
||||
if(ret > 0) {
|
||||
xorriso->lfa_restore_mask= mask_flags;
|
||||
} else {
|
||||
sprintf(xorriso->info_text,
|
||||
"Cannot apply -lfa_flags restore_mask='%s'", mask);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
}
|
||||
}
|
||||
} else if(l == 7 && strncmp(cpt, "default", l) == 0) {
|
||||
xorriso->lfa_flags_setting= xorriso->lfa_flags_default;
|
||||
xorriso->lfa_restore_mask= ~((uint64_t) 0);
|
||||
} else {
|
||||
sprintf(xorriso->info_text, "-lfa_flags: unknown mode in '%s'", mode);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
xorriso->lfa_flags_setting= lfa_flags_mem;
|
||||
{ret= 0; goto ex;}
|
||||
}
|
||||
}
|
||||
if(xorriso->lfa_flags_setting & 2) {
|
||||
if(geteuid() == 0)
|
||||
xorriso->lfa_flags_setting&= ~(1 << 13);
|
||||
else
|
||||
xorriso->lfa_flags_setting|= 1 << 13;
|
||||
}
|
||||
xorriso->do_aaip&= ~(15 << 11);
|
||||
if(xorriso->lfa_flags_setting & 1)
|
||||
xorriso->do_aaip|= xorriso->lfa_flags_setting & (15 << 11);
|
||||
ret= Xorriso_set_ignore_aclea(xorriso, 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
ret= 1;
|
||||
ex:;
|
||||
Xorriso_free_meM(mask);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
/* Option -list_arg_sorting */
|
||||
int Xorriso_option_list_arg_sorting(struct XorrisO *xorriso, int flag)
|
||||
{
|
||||
@ -365,10 +451,12 @@ logfile_wrong_form:;
|
||||
/* Options -ls alias -lsi and -lsl alias -lsli
|
||||
and -lsd alias -lsdi and -lsdl alias -lsdli
|
||||
and -du alias -dui and -dus alias -dusi
|
||||
and -lsattr alias -lsattri and -lsattrd alias -lsattrdi
|
||||
@param flag bit0= long format (-lsl , -du, not -dus, not -ls)
|
||||
bit1= do not expand patterns but use literally
|
||||
bit2= -du rather than -ls
|
||||
bit3= list directories as themselves (-lsd)
|
||||
bit4= -lsattr rather than -ls
|
||||
*/
|
||||
int Xorriso_option_lsi(struct XorrisO *xorriso, int argc, char **argv,
|
||||
int *idx, int flag)
|
||||
@ -442,7 +530,7 @@ no_memory:;
|
||||
}
|
||||
if(flag&2) {
|
||||
ret= Xorriso_ls_filev(xorriso, xorriso->wdi, nump, argv + (*idx), mem,
|
||||
flag&(1|4|8));
|
||||
flag & (1 | 4 | 8 | 16));
|
||||
} else if(nump==1 && strcmp(patterns[0],"*")==0 && !(flag&4)){
|
||||
/* save temporary memory by calling simpler function */
|
||||
ret= Xorriso_ls(xorriso, (flag&1)|4);
|
||||
@ -452,7 +540,7 @@ no_memory:;
|
||||
if(ret<=0)
|
||||
{ret= 0; goto ex;}
|
||||
ret= Xorriso_ls_filev(xorriso, xorriso->wdi, filec, filev, mem,
|
||||
flag&(1|4|8));
|
||||
flag & (1 | 4 | 8 | 16));
|
||||
}
|
||||
if(ret<=0)
|
||||
{ret= 0; goto ex;}
|
||||
|
Reference in New Issue
Block a user