New option -acl enables ACL loading

This commit is contained in:
Thomas Schmitt 2009-01-21 20:45:22 +00:00
parent 7935ab6df4
commit cb9300b4b6
6 changed files with 84 additions and 29 deletions

View File

@ -3821,6 +3821,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
m->split_size= 0; m->split_size= 0;
strcpy(m->list_delimiter, "--"); strcpy(m->list_delimiter, "--");
m->do_joliet= 0; m->do_joliet= 0;
m->do_aaip= 0;
m->relax_compliance= 0; m->relax_compliance= 0;
m->do_follow_pattern= 1; m->do_follow_pattern= 1;
m->do_follow_param= 0; m->do_follow_param= 0;
@ -6120,6 +6121,11 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
Xorriso_status_result(xorriso, filter, fp, flag & 2); Xorriso_status_result(xorriso, filter, fp, flag & 2);
} }
is_default= (xorriso->do_aaip==0);
sprintf(line,"-acl %s\n", (xorriso->do_aaip & 1 ? "on" : "off"));
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
is_default= (xorriso->assert_volid[0] == 0); is_default= (xorriso->assert_volid[0] == 0);
sprintf(line, "-assert_volid "); sprintf(line, "-assert_volid ");
Text_shellsafe(xorriso->assert_volid, line, 1); Text_shellsafe(xorriso->assert_volid, line, 1);
@ -10723,6 +10729,27 @@ int Xorriso_option_abort_on(struct XorrisO *xorriso, char *severity, int flag)
} }
/* Option -acl "on"|"off" */
int Xorriso_option_acl(struct XorrisO *xorriso, char *mode, int flag)
{
int ret;
if(strcmp(mode, "off")==0)
xorriso->do_aaip&= ~3;
else if(strcmp(mode, "on")==0)
xorriso->do_aaip|= (1 | 2);
else {
sprintf(xorriso->info_text, "-acl: unknown mode '%s'", mode);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
}
ret= Xorriso_set_ignore_aclea(xorriso, 0);
if(ret <= 0)
return(ret);
return(1);
}
/* Option -add */ /* Option -add */
/* @param flag bit0=do not report the added item /* @param flag bit0=do not report the added item
bit1=do not reset pacifier, no final pacifier message bit1=do not reset pacifier, no final pacifier message
@ -13105,6 +13132,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" Like -charset but only for conversion to media.", " Like -charset but only for conversion to media.",
" -local_charset name", " -local_charset name",
" Override system assumption of the local character set name.", " Override system assumption of the local character set name.",
" -acl \"on\"|\"off\"",
" Enable resp. disable reading and writing of ACLs.",
" -ban_stdio_write", " -ban_stdio_write",
" Allow for writing only the usage of optical drives.", " Allow for writing only the usage of optical drives.",
" -blank \"fast\"|\"all\"|\"deformat\"|\"deformat_quickest\"", " -blank \"fast\"|\"all\"|\"deformat\"|\"deformat_quickest\"",
@ -15580,7 +15609,7 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv,
"" ""
}; };
static char arg1_commands[][40]= { static char arg1_commands[][40]= {
"abort_on","add_plainly","application_id","backslash_codes","blank", "abort_on","acl","add_plainly","application_id","backslash_codes","blank",
"cd","cdi","cdx","charset","close","commit_eject","compliance", "cd","cdi","cdx","charset","close","commit_eject","compliance",
"dev", "dummy","dialog","disk_pattern","eject","iso_rr_pattern","follow", "dev", "dummy","dialog","disk_pattern","eject","iso_rr_pattern","follow",
"format","fs","gid","grow_blindly", "format","fs","gid","grow_blindly",
@ -15741,6 +15770,10 @@ next_command:;
(*idx)++; (*idx)++;
ret= Xorriso_option_abort_on(xorriso, arg1, 0); ret= Xorriso_option_abort_on(xorriso, arg1, 0);
} else if(strcmp(cmd,"acl")==0) {
(*idx)++;
ret= Xorriso_option_acl(xorriso, arg1, 0);
} else if(strcmp(cmd,"add")==0) { } else if(strcmp(cmd,"add")==0) {
ret= Xorriso_option_add(xorriso, argc, argv, idx, 0); ret= Xorriso_option_add(xorriso, argc, argv, idx, 0);

View File

@ -263,6 +263,11 @@ int Xorriso_lst_destroy_all(struct Xorriso_lsT **lstring, int flag);
/* Option -abort_on */ /* Option -abort_on */
int Xorriso_option_abort_on(struct XorrisO *xorriso, char *severity, int flag); int Xorriso_option_abort_on(struct XorrisO *xorriso, char *severity, int flag);
/* Option -acl "on"|"off" */
int Xorriso_option_acl(struct XorrisO *xorriso, char *mode, int flag);
/* Option -add */ /* Option -add */
/* @param flag bit0=do not report the added item /* @param flag bit0=do not report the added item
bit1=do not reset pacifier, no final pacifier message bit1=do not reset pacifier, no final pacifier message

View File

@ -100,6 +100,9 @@ struct XorrisO { /* the global context of xorriso */
/* >>> put libisofs aspects here <<< */ /* >>> put libisofs aspects here <<< */
int do_joliet; int do_joliet;
int do_aaip; /* bit0= ACL in , bit1= ACL out , bit2= EA in , bit3= EA out */
int relax_compliance; /* opaque bitfield to be set by xorrisoburn */ int relax_compliance; /* opaque bitfield to be set by xorrisoburn */
int do_follow_pattern; int do_follow_pattern;
int do_follow_param; int do_follow_param;

View File

@ -1 +1 @@
#define Xorriso_timestamP "2009.01.21.203852" #define Xorriso_timestamP "2009.01.21.204513"

View File

@ -525,7 +525,7 @@ int Xorriso_assert_volid(struct XorrisO *xorriso, int msc1, int flag)
*/ */
int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag) int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
{ {
int ret, hret, not_writeable= 0, has_what, aquire_flag, load_lba; int ret, hret, not_writeable= 0, has_what, aquire_flag, load_lba, ext;
uint32_t size; uint32_t size;
struct burn_drive_info *dinfo= NULL, *out_dinfo, *in_dinfo; struct burn_drive_info *dinfo= NULL, *out_dinfo, *in_dinfo;
struct burn_drive *drive, *out_drive, *in_drive; struct burn_drive *drive, *out_drive, *in_drive;
@ -582,6 +582,10 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
isoburn_set_msgs_submit(Xorriso_msgs_submit_void, (void *) xorriso, isoburn_set_msgs_submit(Xorriso_msgs_submit_void, (void *) xorriso,
(3<<2) | 128 , 0); (3<<2) | 128 , 0);
aquire_flag= 1 | ((flag&(8|4))>>1) | ((xorriso->toc_emulation_flag & 3)<<3); aquire_flag= 1 | ((flag&(8|4))>>1) | ((xorriso->toc_emulation_flag & 3)<<3);
if(!(xorriso->do_aaip & 1))
aquire_flag|= 32;
if(!(xorriso->do_aaip & 4))
aquire_flag|= 64;
ret= isoburn_drive_aquire(&dinfo, libburn_adr, aquire_flag); ret= isoburn_drive_aquire(&dinfo, libburn_adr, aquire_flag);
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
if(ret<=0) { if(ret<=0) {
@ -670,7 +674,18 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
ret= isoburn_ropt_new(&ropts, 0); ret= isoburn_ropt_new(&ropts, 0);
if(ret<=0) if(ret<=0)
goto ex; goto ex;
isoburn_ropt_set_extensions(ropts, isoburn_ropt_noiso1999);
ext= isoburn_ropt_noiso1999;
#ifdef isoburn_ropt_noacl
if(!(xorriso->do_aaip & 1))
ext|= isoburn_ropt_noacl;
#endif
#ifdef isoburn_ropt_noea
if(!(xorriso->do_aaip & 4))
ext|= isoburn_ropt_noea;
#endif
isoburn_ropt_set_extensions(ropts, ext);
isoburn_ropt_set_default_perms(ropts, (uid_t) 0, (gid_t) 0, (mode_t) 0555); isoburn_ropt_set_default_perms(ropts, (uid_t) 0, (gid_t) 0, (mode_t) 0555);
isoburn_ropt_set_input_charset(ropts, xorriso->in_charset); isoburn_ropt_set_input_charset(ropts, xorriso->in_charset);
@ -703,6 +718,7 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
isoburn_ropt_noiso1999 | isoburn_ropt_norock | isoburn_ropt_nojoliet); isoburn_ropt_noiso1999 | isoburn_ropt_norock | isoburn_ropt_nojoliet);
} }
ret= isoburn_read_image(drive, ropts, &volset); ret= isoburn_read_image(drive, ropts, &volset);
/* <<< Resetting to normal thresholds */ /* <<< Resetting to normal thresholds */
@ -8603,28 +8619,6 @@ int Xorriso_mount(struct XorrisO *xorriso, char *dev, int adr_mode,
0, "SORRY", 0); 0, "SORRY", 0);
sprintf(xorriso->result_line, "%s\n", mount_command); sprintf(xorriso->result_line, "%s\n", mount_command);
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
#ifdef NIX
} else if(geteuid() != getuid() || getgid() != getegid()) {
Xorriso_msgs_submit(xorriso, 0,
"-mount : Detected own setuid/gid identity. Will not perform mount command.",
0, "SORRY", 0);
sprintf(xorriso->result_line, "%s\n", mount_command);
Xorriso_result(xorriso,0);
} else {
/* >>> find safer way to perform command */;
ret= system(mount_command);
if(WIFEXITED(ret) && WEXITSTATUS(ret) != 0) {
sprintf(xorriso->info_text,
"-mount : mount command failed with exit value %d",
(int) WEXITSTATUS(ret));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
ret= 0; goto ex;
}
#else
} else { } else {
ret= Xorriso_execv(xorriso, mount_command, "/bin:/sbin", &status, 1); ret= Xorriso_execv(xorriso, mount_command, "/bin:/sbin", &status, 1);
if(WIFEXITED(status) && WEXITSTATUS(status) != 0) { if(WIFEXITED(status) && WEXITSTATUS(status) != 0) {
@ -8634,9 +8628,6 @@ int Xorriso_mount(struct XorrisO *xorriso, char *dev, int adr_mode,
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;
} }
#endif
sprintf(xorriso->info_text, "\nMounted session %d of device %s", sprintf(xorriso->info_text, "\nMounted session %d of device %s",
session, Text_shellsafe(dev_path, sfe, 0)); session, Text_shellsafe(dev_path, sfe, 0));
dpt= strchr(cmd, ':'); dpt= strchr(cmd, ':');
@ -8795,8 +8786,13 @@ int Xorriso_getfacl(struct XorrisO *xorriso, char *path, char **acl_text,
goto ex; goto ex;
} }
if(ret == 0 || ret == 2) { if(ret == 0 || ret == 2) {
#ifdef Xorriso_with_aaiP
strcpy(xorriso->info_text, "No ACL associated with "); strcpy(xorriso->info_text, "No ACL associated with ");
Text_shellsafe(path, xorriso->info_text, 1); Text_shellsafe(path, xorriso->info_text, 1);
#else
strcpy(xorriso->info_text,
"ACL not enabled by Libisofs_with_aaiP/Xorriso_with_aaiP");
#endif
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
if(ret == 0) if(ret == 0)
{ret= 2; goto ex;} {ret= 2; goto ex;}
@ -8841,3 +8837,17 @@ ex:;
return(ret); return(ret);
} }
int Xorriso_set_ignore_aclea(struct XorrisO *xorriso, int flag)
{
int ret;
IsoImage *volume;
ret= Xorriso_get_volume(xorriso, &volume, 0);
if(ret<=0)
return(ret);
iso_image_set_ignore_aclea(volume,
((~xorriso->do_aaip) & 1) | (((~xorriso->do_aaip) & 4) >> 1));
return(1);
}

View File

@ -394,6 +394,10 @@ int Xorriso_getfacl(struct XorrisO *xorriso, char *path, char **acl_text,
int flag); int flag);
/* Calls iso_image_set_ignore_aclea() according to xorriso->do_aaip */
int Xorriso_set_ignore_aclea(struct XorrisO *xorriso, 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.
*/ */