New option -setfacl, -setfacl_r, new -find action setfacl

This commit is contained in:
Thomas Schmitt 2009-01-25 14:11:37 +00:00
parent 40d4330bcc
commit 02f2954bd5
6 changed files with 396 additions and 27 deletions

View File

@ -2337,9 +2337,13 @@ struct FindjoB {
22= report_lba 22= report_lba
23= internal:memorize path of last matching node in found_path 23= internal:memorize path of last matching node in found_path
24= getfacl 24= getfacl
25= setfacl access_acl default_acl
*/ */
int action; int action;
/* action specific parameters */
char *target; char *target;
char *text_2;
uid_t user; uid_t user;
gid_t group; gid_t group;
mode_t mode_and, mode_or; mode_t mode_and, mode_or;
@ -2368,6 +2372,7 @@ int Findjob_new(struct FindjoB **o, char *start_path, int flag)
m->wanted_node= NULL; m->wanted_node= NULL;
m->action= 0; /* print */ m->action= 0; /* print */
m->target= NULL; /* a mere pointer, not managed memory */ m->target= NULL; /* a mere pointer, not managed memory */
m->text_2= NULL; /* a mere pointer, not managed memory */
m->user= 0; m->user= 0;
m->group= 0; m->group= 0;
m->type= 0; m->type= 0;
@ -2628,13 +2633,14 @@ int Findjob_get_action(struct FindjoB *o, int flag)
/* @return <0 error, >=0 see above struct FindjoB.action /* @return <0 error, >=0 see above struct FindjoB.action
*/ */
int Findjob_get_action_parms(struct FindjoB *o, char **target, int Findjob_get_action_parms(struct FindjoB *o, char **target, char **text_2,
uid_t *user, gid_t *group, uid_t *user, gid_t *group,
mode_t *mode_and, mode_t *mode_or, mode_t *mode_and, mode_t *mode_or,
int *type, time_t *date, struct FindjoB **subjob, int *type, time_t *date, struct FindjoB **subjob,
int flag) int flag)
{ {
*target= o->target; *target= o->target;
*text_2= o->text_2;
*user= o->user; *user= o->user;
*group= o->group; *group= o->group;
*mode_and= o->mode_and; *mode_and= o->mode_and;
@ -2655,6 +2661,16 @@ int Findjob_set_action_target(struct FindjoB *o, int action, char *target,
} }
int Findjob_set_action_text_2(struct FindjoB *o, int action, char *target,
char* text_2, int flag)
{
o->action= action;
o->target= target;
o->text_2= text_2;
return(1);
}
/* @param flag bit0= recursive /* @param flag bit0= recursive
*/ */
int Findjob_set_action_chown(struct FindjoB *o, uid_t user,int flag) int Findjob_set_action_chown(struct FindjoB *o, uid_t user,int flag)
@ -5457,7 +5473,7 @@ int Xorriso_check_media_setup_job(struct XorrisO *xorriso,
ret= Checkmediajob_new(&default_job, 0); ret= Checkmediajob_new(&default_job, 0);
if(ret <= 0) { if(ret <= 0) {
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"-check_media: Cannot reset optionis due to lack of resources"); "-check_media: Cannot reset options due to lack of resources");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0);
ret= -1; goto ex; ret= -1; goto ex;
} }
@ -8609,11 +8625,11 @@ int Xorriso_findx_action(struct XorrisO *xorriso, struct FindjoB *job,
gid_t group= 0; gid_t group= 0;
time_t date= 0; time_t date= 0;
mode_t mode_or= 0, mode_and= ~1; mode_t mode_or= 0, mode_and= ~1;
char *target, sfe[5*SfileadrL], *disk_prefix, iso_path[SfileadrL]; char *target, *text_2, sfe[5*SfileadrL], *disk_prefix, iso_path[SfileadrL];
struct FindjoB *subjob; struct FindjoB *subjob;
struct stat stbuf; struct stat stbuf;
action= Findjob_get_action_parms(job, &target, &user, &group, action= Findjob_get_action_parms(job, &target, &text_2, &user, &group,
&mode_and, &mode_or, &type, &date, &subjob, 0); &mode_and, &mode_or, &type, &date, &subjob, 0);
if(action<0) if(action<0)
action= 0; action= 0;
@ -12709,6 +12725,8 @@ int Xorriso_option_find(struct XorrisO *xorriso, int argc, char **argv,
int ret, i, end_idx, type= 0, action, deleter= 0, start_lba, count; int ret, i, end_idx, type= 0, action, deleter= 0, start_lba, count;
struct FindjoB *job, *first_job= NULL, *new_job; struct FindjoB *job, *first_job= NULL, *new_job;
char *start_path, sfe[5*SfileadrL], *cpt, other_path_start[SfileadrL]; char *start_path, sfe[5*SfileadrL], *cpt, other_path_start[SfileadrL];
char *access_acl_text= NULL, *default_acl_text= NULL;
struct stat dir_stbuf; struct stat dir_stbuf;
uid_t user= 0; uid_t user= 0;
gid_t group= 0; gid_t group= 0;
@ -12912,6 +12930,16 @@ not_enough_arguments:;
Findjob_set_action_target(job, 22, NULL, 0); Findjob_set_action_target(job, 22, NULL, 0);
} else if(strcmp(cpt, "getfacl")==0) { } else if(strcmp(cpt, "getfacl")==0) {
Findjob_set_action_target(job, 24, NULL, 0); Findjob_set_action_target(job, 24, NULL, 0);
} else if(strcmp(cpt, "setfacl")==0) {
if(i+1>=end_idx)
goto not_enough_arguments;
i++;
ret= Xorriso_normalize_acl_text(xorriso, argv[i],
&access_acl_text, &default_acl_text, 0);
if(ret <= 0)
goto ex;
Findjob_set_action_text_2(job, 25, access_acl_text, default_acl_text,
0);
} else { } else {
sprintf(xorriso->info_text, "-find -exec: unknown action %s", sprintf(xorriso->info_text, "-find -exec: unknown action %s",
Text_shellsafe(argv[i], sfe, 0)); Text_shellsafe(argv[i], sfe, 0));
@ -12938,6 +12966,10 @@ ex:;
else if(mem_lut!=xorriso->last_update_time && mem_lut!=0.0 && !(flag&2)) else if(mem_lut!=xorriso->last_update_time && mem_lut!=0.0 && !(flag&2))
Xorriso_pacifier_callback(xorriso, "content bytes read", Xorriso_pacifier_callback(xorriso, "content bytes read",
xorriso->pacifier_count, 0, "", 1); xorriso->pacifier_count, 0, "", 1);
if(access_acl_text != NULL)
free(access_acl_text);
if(default_acl_text != NULL)
free(default_acl_text);
Findjob_destroy(&first_job, 0); Findjob_destroy(&first_job, 0);
(*idx)= end_idx; (*idx)= end_idx;
return(ret); return(ret);
@ -13038,10 +13070,10 @@ int Xorriso_option_fs(struct XorrisO *xorriso, char *size, int flag)
} }
/* Option -getfacl , -getfacl_r */ /* Option -getfacl alias -getfacli, -getfacl_r alias -getfacl_ri */
/* @param flag bit0=recursive -getfacl_r /* @param flag bit0=recursive -getfacl_r
*/ */
int Xorriso_option_getfacl(struct XorrisO *xorriso, int Xorriso_option_getfacli(struct XorrisO *xorriso,
int argc, char **argv, int *idx, int flag) int argc, char **argv, int *idx, int flag)
{ {
int i, ret, was_failure= 0, end_idx, fret; int i, ret, was_failure= 0, end_idx, fret;
@ -13287,6 +13319,11 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" Equivalent to chmod in the ISO image.", " Equivalent to chmod in the ISO image.",
" -chmod_r mode iso_rr_path [***]", " -chmod_r mode iso_rr_path [***]",
" Like -chmod but affecting all files below directories.", " Like -chmod but affecting all files below directories.",
" -setfacl acl_text iso_rr_path [***]",
" Replace the permissions and eventual ACL of the given files",
" in the ISO image by the ACL which is defined by acl_text.",
" -setfacl_r acl_text iso_rr_path [***]",
" Like -setfacl but affecting all files below directories.",
" -alter_date type timestring iso_rr_path [***]", " -alter_date type timestring iso_rr_path [***]",
" Alter the date entries of a file in the ISO image. type is", " Alter the date entries of a file in the ISO image. type is",
" one of \"a\", \"m\", \"b\" for:", " one of \"a\", \"m\", \"b\" for:",
@ -13294,15 +13331,17 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" -alter_date_r type timestring iso_rr_path [***]", " -alter_date_r type timestring iso_rr_path [***]",
" Like -alter_date but affecting all files below directories.", " Like -alter_date but affecting all files below directories.",
" -find iso_rr_path [test [test ...]] [-exec action [params]]", " -find iso_rr_path [test [test ...]] [-exec action [params]]",
" performs an action on files below the current working", " performs an action on files below the given directory in",
" directory in the ISO image. If -name pattern is given", " the ISO image. If -name pattern is given then only files",
" then only files with matching leaf names are processed.", " with matching leaf names are processed.",
" If -type is given then only files with matching type are", " If -type is given then only files with matching type are",
" processed. Types: block,char,dir,pipe,file,link,socket.", " processed. Types: block,char,dir,pipe,file,link,socket.",
" Further tests: -damaged, -undamaged, -lba_range start count", " Further tests: -damaged, -undamaged, -lba_range start count,",
" action may be one of: echo, chown, chown_r, chgrp, chgrp_r", " -pending_data, -has_acl, -has_no_acl.",
" Action may be one of: echo, chown, chown_r, chgrp, chgrp_r",
" chmod, chmod_r, alter_date, alter_date_r, lsdl, compare,", " chmod, chmod_r, alter_date, alter_date_r, lsdl, compare,",
" rm, rm_r, compare, update, report_damage, find.", " rm, rm_r, compare, update, report_damage, report_lba,",
" getfacl, setfacl, find.",
" params are their arguments except iso_rr_path.", " params are their arguments except iso_rr_path.",
" echo, lsdl, rm, rm_r, report_damage have no params at all.", " echo, lsdl, rm, rm_r, report_damage have no params at all.",
" -mkdir iso_rr_path [...]", " -mkdir iso_rr_path [...]",
@ -15171,6 +15210,255 @@ int Xorriso_option_session_log(struct XorrisO *xorriso, char *path, int flag)
} }
/* Normalize ACL and sort apart "access" ACL from "default" ACL.
*/
int Xorriso_normalize_acl_text(struct XorrisO *xorriso, char *in_text,
char **access_acl_text, char **default_acl_text, int flag)
{
int ret, access_count= 0, default_count= 0, pass, is_default, line_len;
int was_error= 0, line_count= 0, perms;
char *acl_text= NULL, *cpt, *npt, *access_wpt= NULL, *default_wpt= NULL;
char *dpt, *ddpt, **wpt, *ppt;
if(in_text[0] == 0 || strcmp(in_text, "clear") == 0 ||
strcmp(in_text, "--remove-all") == 0) {
*access_acl_text= *default_acl_text= NULL;
return(1);
} else if (strcmp(in_text, "--remove-default") == 0) {
/* >>> protect Access-ACL and delete Default-ACL */;
/* <<< */
return(0);
}
acl_text= strdup(in_text);
if(acl_text == NULL) {
Xorriso_no_malloc_memory(xorriso, NULL, 0);
{ret= -1; goto ex;}
}
/* From comma to newline */
for(cpt= strchr(acl_text, ','); cpt != NULL; cpt= strchr(cpt + 1, ','))
*cpt= '\n';
/* Normalize to long text form
and sort apart "access" ACL from "default" ACL */;
for(pass= 0; pass < 2; pass++) {
for(cpt= acl_text; cpt != NULL; cpt= npt) {
if(pass == 0)
line_count++;
npt= strchr(cpt, '\n');
if(npt != NULL)
npt++;
if(*cpt == '#' || *cpt == '\n' || *cpt == 0)
continue;
is_default= 0;
wpt= &access_wpt;
if(*cpt == 'd') {
is_default= 1;
if(pass == 1)
wpt= &default_wpt;
cpt= strchr(cpt, ':');
if(cpt == NULL) {
was_error= line_count;
continue;
}
}
line_len= 0;
dpt= strchr(cpt, ':');
if(dpt != NULL)
ddpt= strchr(dpt + 1, ':');
if(dpt == NULL || ddpt == NULL) {
was_error= line_count;
continue;
}
if(*cpt == 'u') {
if(pass == 0) {
line_len+= 5;
line_len+= ddpt - dpt;
} else {
strcpy(*wpt, "user:");
strncpy(*wpt + 5, dpt + 1, ddpt - dpt);
(*wpt)+= 5 + (ddpt - dpt);
}
} else if(*cpt == 'g') {
if(pass == 0) {
line_len+= 6 + (ddpt - dpt);
} else {
strcpy(*wpt, "group:");
strncpy(*wpt + 6, dpt + 1, ddpt - dpt);
(*wpt)+= 6 + (ddpt - dpt);
}
} else if(*cpt == 'o') {
if(pass == 0) {
if(ddpt - dpt > 1) {
was_error= line_count;
continue;
}
line_len+= 6 + (ddpt - dpt);
} else {
strcpy(*wpt, "other:");
strncpy(*wpt + 6, dpt + 1, ddpt - dpt);
(*wpt)+= 6 + (ddpt - dpt);
}
} else if(*cpt == 'm') {
if(pass == 0) {
if(ddpt - dpt > 1) {
was_error= line_count;
continue;
}
line_len+= 5 + (ddpt - dpt);
} else {
strcpy(*wpt, "mask:");
strncpy(*wpt + 5, dpt + 1, ddpt - dpt);
(*wpt)+= 5 + (ddpt - dpt);
}
} else {
/* Unknown tag type */
was_error= line_count;
continue;
}
/* Examine permissions at ddpt + 1 */;
perms= 0;
for(ppt= ddpt + 1; *ppt != 0 && *ppt != '\n'; ppt++) {
if(*ppt == 'r')
perms|= 4;
else if(*ppt == 'w')
perms|= 2;
else if(*ppt == 'x')
perms|= 1;
else if(*ppt == '-')
;
else {
was_error= line_count;
continue;
}
}
if(pass == 0) {
line_len+= 4;
} else {
sprintf(*wpt, "%c%c%c\n",
perms & 4 ? 'r' : '-', perms & 2 ? 'w' : '-', perms & 1 ? 'x' : '-');
(*wpt)+= 4;
}
if(pass == 0) {
if(is_default)
default_count+= line_len;
else
access_count+= line_len;
}
}
if(pass == 0) {
*access_acl_text= calloc(access_count + 1, 1);
*default_acl_text= calloc(default_count + 1, 1);
if(access_acl_text == NULL || *default_acl_text == NULL) {
Xorriso_no_malloc_memory(xorriso, access_acl_text, 0);
{ret= -1; goto ex;}
}
access_wpt= *access_acl_text;
default_wpt= *default_acl_text;
} else {
*access_wpt= 0;
*default_wpt= 0;
}
}
ret= 1;
ex:;
if(acl_text != NULL)
free(acl_text);
if(was_error) {
sprintf(xorriso->info_text,
"Malformed ACL entries encountered. Last one in line number %d.",
was_error);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
}
return(ret);
}
/* Options -setfacl alias -setfacli, -setfacl_r alias -setfacl_ri */
/* @param flag bit0=recursive -setfacl_r
*/
int Xorriso_option_setfacli(struct XorrisO *xorriso, char *acl_text,
int argc, char **argv, int *idx, int flag)
{
int i, ret, was_failure= 0, end_idx, fret;
int optc= 0;
char **optv= NULL, *access_acl_text= NULL, *default_acl_text= NULL;
struct FindjoB *job= NULL;
struct stat dir_stbuf;
ret= Xorriso_opt_args(xorriso, "-setfacl", argc, argv, *idx, &end_idx, &optc,
&optv, 0);
if(ret <= 0)
goto ex;
ret= Xorriso_normalize_acl_text(xorriso, acl_text,
&access_acl_text, &default_acl_text, 0);
if(access_acl_text != NULL && default_acl_text != NULL) {
sprintf(xorriso->info_text, "Access-ACL :\n%s", access_acl_text);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
sprintf(xorriso->info_text, "Default-ACL :\n%s", default_acl_text);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
} else if(access_acl_text == NULL && default_acl_text == NULL) {
sprintf(xorriso->info_text, "Will delete Access-ACL and Default-ACL");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
}
if(ret <= 0)
goto ex;
for(i= 0; i<optc; i++) {
if(flag&1) {
ret= Findjob_new(&job, optv[i], 0);
if(ret<=0) {
Xorriso_no_findjob(xorriso, "-setfacl_r", 0);
{ret= -1; goto ex;}
}
Findjob_set_action_text_2(job, 25, access_acl_text, default_acl_text, 0);
ret= Xorriso_findi(xorriso, job, NULL, (off_t) 0,
NULL, optv[i], &dir_stbuf, 0, 0);
Findjob_destroy(&job, 0);
} else {
ret= 1;
if(access_acl_text == NULL || access_acl_text[0])
ret= Xorriso_setfacl(xorriso, NULL, optv[i], access_acl_text, 0);
if(ret > 0 && (default_acl_text == NULL || default_acl_text[0]))
ret= Xorriso_setfacl(xorriso, NULL, optv[i], default_acl_text, 1);
}
if(ret>0 && !xorriso->request_to_abort)
continue; /* regular bottom of loop */
was_failure= 1;
fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
if(fret>=0)
continue;
ret= 0; goto ex;
}
ret= 1;
ex:;
(*idx)= end_idx;
Xorriso_opt_args(xorriso, "-setfacl", argc, argv, *idx, &end_idx,
&optc, &optv, 256);
Findjob_destroy(&job, 0);
if(access_acl_text != NULL)
free(access_acl_text);
if(default_acl_text != NULL)
free(default_acl_text);
if(ret<=0)
return(ret);
return(!was_failure);
}
/* Option -speed */ /* Option -speed */
int Xorriso_option_speed(struct XorrisO *xorriso, char *speed, int flag) int Xorriso_option_speed(struct XorrisO *xorriso, char *speed, int flag)
{ {
@ -15684,6 +15972,7 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv,
"ls","lsi","lsl","lsli","lsd","lsdi","lsdl","lsdli", "ls","lsi","lsl","lsli","lsd","lsdi","lsdl","lsdli",
"lsx","lslx","lsdx","lsdlx","map_l","mv","mvi","mkdir","mkdiri", "lsx","lslx","lsdx","lsdlx","map_l","mv","mvi","mkdir","mkdiri",
"not_paths","rm","rmi","rm_r","rm_ri","rmdir","rmdiri","update_l", "not_paths","rm","rmi","rm_r","rm_ri","rmdir","rmdiri","update_l",
"setfacl","setfacli","setfacl_r","setfacl_ri",
"" ""
}; };
@ -16030,10 +16319,10 @@ next_command:;
ret= Xorriso_option_fs(xorriso, arg1, 0); ret= Xorriso_option_fs(xorriso, arg1, 0);
} else if(strcmp(cmd,"getfacl")==0 || strcmp(cmd,"getfacli")==0) { } else if(strcmp(cmd,"getfacl")==0 || strcmp(cmd,"getfacli")==0) {
ret= Xorriso_option_getfacl(xorriso, argc, argv, idx, 0); ret= Xorriso_option_getfacli(xorriso, argc, argv, idx, 0);
} else if(strcmp(cmd,"getfacl_r")==0 || strcmp(cmd,"getfacl_ri")==0) { } else if(strcmp(cmd,"getfacl_r")==0 || strcmp(cmd,"getfacl_ri")==0) {
ret= Xorriso_option_getfacl(xorriso, argc, argv, idx, 1); ret= Xorriso_option_getfacli(xorriso, argc, argv, idx, 1);
} else if(strcmp(cmd,"gid")==0) { } else if(strcmp(cmd,"gid")==0) {
(*idx)++; (*idx)++;
@ -16309,6 +16598,14 @@ next_command:;
ret= Xorriso_option_mount(xorriso, arg1, arg2, ret= Xorriso_option_mount(xorriso, arg1, arg2,
argv[(*idx)-2], argv[(*idx)-1], 2); argv[(*idx)-2], argv[(*idx)-1], 2);
} else if(strcmp(cmd,"setfacl")==0 || strcmp(cmd,"setfacli")==0) {
(*idx)+= 1;
ret= Xorriso_option_setfacli(xorriso, arg1, argc, argv, idx, 0);
} else if(strcmp(cmd,"setfacl_r")==0 || strcmp(cmd,"setfacl_ri")==0) {
(*idx)+= 1;
ret= Xorriso_option_setfacli(xorriso, arg1, argc, argv, idx, 1);
} else if(strcmp(cmd,"speed")==0) { } else if(strcmp(cmd,"speed")==0) {
(*idx)++; (*idx)++;
ret= Xorriso_option_speed(xorriso, arg1, 0); ret= Xorriso_option_speed(xorriso, arg1, 0);

View File

@ -466,8 +466,10 @@ int Xorriso_option_find(struct XorrisO *xorriso, int argc, char **argv,
/* Option -fs */ /* Option -fs */
int Xorriso_option_fs(struct XorrisO *xorriso, char *size, int flag); int Xorriso_option_fs(struct XorrisO *xorriso, char *size, int flag);
/* Option -getfacl */ /* Option -getfacl alias -getfacli, -getfacl_r alias -getfacl_ri */
int Xorriso_option_getfacl(struct XorrisO *xorriso, /* @param flag bit0=recursive -getfacl_r
*/
int Xorriso_option_getfacli(struct XorrisO *xorriso,
int argc, char **argv, int *idx, int flag); int argc, char **argv, int *idx, int flag);
/* Option -gid */ /* Option -gid */
@ -668,6 +670,12 @@ int Xorriso_option_rom_toc_scan(struct XorrisO *xorriso, char *mode,
/* Option -session_log */ /* Option -session_log */
int Xorriso_option_session_log(struct XorrisO *xorriso, char *path, int flag); int Xorriso_option_session_log(struct XorrisO *xorriso, char *path, int flag);
/* Option -setfacl alias -setfacli , -setfacl_r alias -setfacl_ri */
/* @param flag bit0=recursive -setfacl_r
*/
int Xorriso_option_setfacli(struct XorrisO *xorriso, char *acl_text,
int argc, char **argv, int *idx, int flag);
/* Option -speed */ /* Option -speed */
int Xorriso_option_speed(struct XorrisO *xorriso, char *speed, int flag); int Xorriso_option_speed(struct XorrisO *xorriso, char *speed, int flag);

View File

@ -613,6 +613,12 @@ char *Xorriso_get_pattern(struct XorrisO *xorriso,
struct Xorriso_lsT *patternlist, int index, int flag); struct Xorriso_lsT *patternlist, int index, int flag);
/* Normalize ACL and sort apart "access" ACL from "default" ACL.
*/
int Xorriso_normalize_acl_text(struct XorrisO *xorriso, char *in_text,
char **access_acl_text, char **default_acl_text, int flag);
int Sfile_str(char target[SfileadrL], char *source, int flag); int Sfile_str(char target[SfileadrL], char *source, int flag);
double Sfile_microtime(int flag); double Sfile_microtime(int flag);
@ -698,7 +704,7 @@ int Findjob_get_action(struct FindjoB *o, int flag);
/* @return <0 error, >=0 see xorriso.c struct FindjoB.action /* @return <0 error, >=0 see xorriso.c struct FindjoB.action
*/ */
int Findjob_get_action_parms(struct FindjoB *o, char **target, int Findjob_get_action_parms(struct FindjoB *o, char **target, char **text_2,
uid_t *user, gid_t *group, uid_t *user, gid_t *group,
mode_t *mode_and, mode_t *mode_or, mode_t *mode_and, mode_t *mode_or,
int *type, time_t *date, struct FindjoB **subjob, int *type, time_t *date, struct FindjoB **subjob,

View File

@ -1 +1 @@
#define Xorriso_timestamP "2009.01.23.172757" #define Xorriso_timestamP "2009.01.25.141124"

View File

@ -6397,11 +6397,11 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
gid_t group= 0; gid_t group= 0;
time_t date= 0; time_t date= 0;
mode_t mode_or= 0, mode_and= ~1; mode_t mode_or= 0, mode_and= ~1;
char *target, sfe[5*SfileadrL], *iso_prefix; char *target, *text_2, sfe[5*SfileadrL], *iso_prefix;
struct FindjoB *subjob; struct FindjoB *subjob;
struct stat dir_stbuf; struct stat dir_stbuf;
action= Findjob_get_action_parms(job, &target, &user, &group, action= Findjob_get_action_parms(job, &target, &text_2, &user, &group,
&mode_and, &mode_or, &type, &date, &subjob, 0); &mode_and, &mode_or, &type, &date, &subjob, 0);
if(action<0) if(action<0)
action= 0; action= 0;
@ -6455,7 +6455,12 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
} else if(action == 23) { } else if(action == 23) {
ret= Findjob_set_found_path(job, show_path, 0); ret= Findjob_set_found_path(job, show_path, 0);
} else if(action == 24) { } else if(action == 24) {
ret = Xorriso_getfacl(xorriso, (void *) node, show_path, NULL, 0); ret= Xorriso_getfacl(xorriso, (void *) node, show_path, NULL, 0);
} else if(action == 25) {
if(target == NULL || target[0])
ret= Xorriso_setfacl(xorriso, (void *) node, show_path, target, 0);
if(ret > 0 && (text_2 == NULL || text_2[0]))
ret= Xorriso_setfacl(xorriso, (void *) node, show_path, text_2, 1);
} else { /* includes : 15 in_iso */ } else { /* includes : 15 in_iso */
sprintf(xorriso->result_line, "%s\n", Text_shellsafe(show_path, sfe, 0)); sprintf(xorriso->result_line, "%s\n", Text_shellsafe(show_path, sfe, 0));
Xorriso_result(xorriso, 0); Xorriso_result(xorriso, 0);
@ -8799,11 +8804,12 @@ int Xorriso_getfacl(struct XorrisO *xorriso, void *in_node, char *path,
ret= 0; ret= 0;
#endif #endif
if(ret < 0) { if(ret < 0) {
if(path != NULL && path[0] != 0) {
strcpy(xorriso->info_text, "Error with obtaining ACL of "); strcpy(xorriso->info_text, "Error with obtaining ACL of ");
Text_shellsafe(path, xorriso->info_text, 1); Text_shellsafe(path, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
}
ret= 0; goto ex; ret= 0; goto ex;
} }
if(flag & 2) { if(flag & 2) {
@ -8882,3 +8888,45 @@ int Xorriso_set_ignore_aclea(struct XorrisO *xorriso, int flag)
return(1); return(1);
} }
/* @param node Opaque handle to IsoNode which is to be manipulated
instead of path if it is not NULL.
@param path is used as address if node is NULL.
@param acl_text ACL in long text form
@param flag bit0=set "default" ACL rather than "access" ACL
@return >0 success , <=0 failure
*/
int Xorriso_setfacl(struct XorrisO *xorriso, void *in_node, char *path,
char *acl_text, int flag)
{
int ret;
IsoNode *node;
node= (IsoNode *) in_node;
if(node == NULL) {
ret= Xorriso_get_node_by_path(xorriso, path, NULL, &node, 0);
if(ret<=0)
goto ex;
}
#ifdef Xorriso_with_aaiP
ret= iso_node_set_acl_text(node, acl_text, flag & 1);
#else
ret= 0;
#endif
if(ret <= 0) {
if(path != NULL && path[0] != 0) {
strcpy(xorriso->info_text, "Error with setting ACL of ");
Text_shellsafe(path, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
}
ret= 0; goto ex;
}
xorriso->volset_change_pending= 1;
ret= 1;
ex:;
Xorriso_process_msg_queues(xorriso,0);
return(ret);
}

View File

@ -403,6 +403,16 @@ int Xorriso_getfacl(struct XorrisO *xorriso, void *node,
int Xorriso_set_ignore_aclea(struct XorrisO *xorriso, int flag); int Xorriso_set_ignore_aclea(struct XorrisO *xorriso, int flag);
/* @param node Opaque handle to IsoNode which is to be manipulated
instead of path if it is not NULL.
@param path is used as address if node is NULL.
@param acl_text ACL in long text form
@param flag bit0=set "default" ACL rather than "access" ACL
@return >0 success , <=0 failure
*/
int Xorriso_setfacl(struct XorrisO *xorriso, void *in_node, char *path,
char *acl_text, int flag);
/* A pseudo file type for El-Torito bootsectors as in man 2 stat : /* A pseudo file type for El-Torito bootsectors as in man 2 stat :
For now take the highest possible value. For now take the highest possible value.
*/ */