From 7aba2e615cb4b2df7eaa7fbcfaea73b548feb2ab Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 20 Dec 2012 20:22:58 +0000 Subject: [PATCH] New command -launch_frontend --- configure.ac | 28 ++++- libisoburn/libisoburn.ver | 1 + xorriso/base_obj.c | 1 + xorriso/compile_xorriso.sh | 2 +- xorriso/configure_ac.txt | 32 ++++++ xorriso/opts_d_h.c | 5 + xorriso/opts_i_o.c | 22 ++++ xorriso/parse_exec.c | 18 ++- xorriso/text_io.c | 213 ++++++++++++++++++++++++++++++++++++ xorriso/text_io.h | 3 + xorriso/xorriso.1 | 62 ++++++++++- xorriso/xorriso.h | 5 + xorriso/xorriso.info | 103 ++++++++++++----- xorriso/xorriso.texi | 63 ++++++++++- xorriso/xorriso_private.h | 1 + xorriso/xorriso_timestamp.h | 2 +- 16 files changed, 525 insertions(+), 36 deletions(-) diff --git a/configure.ac b/configure.ac index f8dc0e29..68efc5ca 100644 --- a/configure.ac +++ b/configure.ac @@ -268,6 +268,32 @@ else fi AC_SUBST(EXTF_SUID_DEF) + +AC_ARG_ENABLE(launch-frontend, +[ --enable-launch-frontend Enable start of piped frontend program by xorriso, default=yes], + , enable_launch_frontend=yes) +if test x"$enable_launch_frontend" = xyes; then + LFRONT_DEF="-DXorriso_allow_launch_frontenD" + echo "enabled xorriso command -launch_frontend" +else + LFRONT_DEF= + echo "disabled xorriso command -launch_frontend" +fi +AC_SUBST(LFRONT_DEF) + +AC_ARG_ENABLE(launch-frontend-setuid, +[ --enable-launch-frontend-setuid Enable start of piped frontend program under setuid, default=no], + , enable_launch_frontend_setuid=no) +if test x$enable_launch_frontend_setuid = xyes; then + LFRONT_SUID_DEF="-DXorriso_allow_extf_suiD" + echo "enabled xorriso command -launch_frontend under setuid" +else + LFRONT_SUID_DEF= + echo "disabled xorriso command -launch_frontend under setuid" +fi +AC_SUBST(LFRONT_SUID_DEF) + + AC_ARG_ENABLE(dvd-obs-64k, [ --enable-dvd-obs-64k 64 KB default size for xorriso DVD/BD writing, default=no], , enable_dvd_obs_64=no) @@ -370,7 +396,7 @@ else CFLAGS="-DDEBUG $CFLAGS" fi -CFLAGS="$READLINE_DEF $LIBACL_DEF $XATTR_DEF $EXTF_DEF $EXTF_SUID_DEF $ZLIB_DEF $LIBJTE_DEF $XORRISO_DVD_OBS_64K $CFLAGS" +CFLAGS="$READLINE_DEF $LIBACL_DEF $XATTR_DEF $EXTF_DEF $EXTF_SUID_DEF $LFRONT_DEF $LFRONT_SUID_DEF $ZLIB_DEF $LIBJTE_DEF $XORRISO_DVD_OBS_64K $CFLAGS" AC_CONFIG_FILES([ Makefile diff --git a/libisoburn/libisoburn.ver b/libisoburn/libisoburn.ver index a7a78345..5345ff1f 100644 --- a/libisoburn/libisoburn.ver +++ b/libisoburn/libisoburn.ver @@ -210,6 +210,7 @@ Xorriso_option_history; Xorriso_option_iso_rr_pattern; Xorriso_option_jigdo; Xorriso_option_joliet; +Xorriso_option_launch_frontend; Xorriso_option_list_arg_sorting; Xorriso_option_list_delimiter; Xorriso_option_list_extras; diff --git a/xorriso/base_obj.c b/xorriso/base_obj.c index bff407fe..51ddc8ac 100644 --- a/xorriso/base_obj.c +++ b/xorriso/base_obj.c @@ -373,6 +373,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag) m->insert_count= 0; m->insert_bytes= 0; m->error_count= 0; + m->launch_frontend_banned= 0; m->pacifier_style= 0; m->pacifier_interval= 1.0; m->pacifier_count= 0; diff --git a/xorriso/compile_xorriso.sh b/xorriso/compile_xorriso.sh index fe0908cb..70a961e5 100755 --- a/xorriso/compile_xorriso.sh +++ b/xorriso/compile_xorriso.sh @@ -18,7 +18,7 @@ isoburn=./libisoburn-develop/libisoburn xorr=./libisoburn-develop/xorriso debug_opts="-O2" -def_opts="-DXorriso_allow_external_filterS" +def_opts="-DXorriso_allow_external_filterS -DXorriso_allow_launch_frontenD" largefile_opts="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1" do_strip=0 static_opts= diff --git a/xorriso/configure_ac.txt b/xorriso/configure_ac.txt index 4bb78b80..92af97a7 100644 --- a/xorriso/configure_ac.txt +++ b/xorriso/configure_ac.txt @@ -376,6 +376,38 @@ then AC_DEFINE([Xorriso_allow_extf_suiD], []) fi +AH_TEMPLATE([Xorriso_allow_launch_frontenD], [Define to allow xorriso command -launch_frontend]) +AC_ARG_ENABLE(launch-frontend, +[ --enable-launch-frontend Enable start of piped frontend program by xorriso, default=yes], + , enable_launch_frontend=yes) +if test x"$enable_launch_frontend" = xyes; then + LFRONT_DEF="-DXorriso_allow_launch_frontenD" + echo "enabled xorriso command -launch_frontend" +else + LFRONT_DEF= + echo "disabled xorriso command -launch_frontend" +fi +if test x$LFRONT_DEF = x-DXorriso_allow_launch_frontenD +then + AC_DEFINE([Xorriso_allow_launch_frontenD], []) +fi + +AH_TEMPLATE([Xorriso_allow_extf_suiD], [Define to allow xorriso command -launch_frontend when running under setuid]) +AC_ARG_ENABLE(launch-frontend-setuid, +[ --enable-launch-frontend-setuid Enable start of piped frontend program under setuid, default=no], + , enable_launch_frontend_setuid=no) +if test x$enable_launch_frontend_setuid = xyes; then + LFRONT_SUID_DEF="-DXorriso_allow_extf_suiD" + echo "enabled xorriso command -launch_frontend under setuid" +else + LFRONT_SUID_DEF= + echo "disabled xorriso command -launch_frontend under setuid" +fi +if test x$LFRONT_SUID_DEF = x-DXorriso_allow_extf_suiD +then + AC_DEFINE([Xorriso_allow_extf_suiD], []) +fi + AH_TEMPLATE([Xorriso_dvd_obs_default_64K], [Define to make 64 KB default size for DVD/BD writing]) AC_ARG_ENABLE(dvd-obs-64k, diff --git a/xorriso/opts_d_h.c b/xorriso/opts_d_h.c index 495fcc9d..c95092ec 100644 --- a/xorriso/opts_d_h.c +++ b/xorriso/opts_d_h.c @@ -2082,6 +2082,11 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag) " \"parse\"|\"parse_bulk\"|\"compare_sev\"|\"list_sev\" param_text", " Enable, use, or disable message sieve. Or parse lines into", " words. Or compare or list severity names.", +" -launch_frontend program_with_args command_pipe reply_pipe", +" Start a program, connect its stdin to xorriso stdout and", +" stderr, connect its stdout to xorriso stdin.", +" If command_pipe and reply_pipe are nonempty, use them as", +" named pipes. The started program is supposed to use them too.", " -logfile channel fileaddress Copy output of a channel to the given file.", " channel may be 'R','I','M' as with -pkt_output or '.'", " for the consolidated -pkt_output stream.", diff --git a/xorriso/opts_i_o.c b/xorriso/opts_i_o.c index 0967c029..65ef5335 100644 --- a/xorriso/opts_i_o.c +++ b/xorriso/opts_i_o.c @@ -74,6 +74,28 @@ int Xorriso_option_joliet(struct XorrisO *xorriso, char *mode, int flag) } +/* Command -launch_frontend */ +int Xorriso_option_launch_frontend(struct XorrisO *xorriso, char *cmd, + char *cmd_pipe_adr, char *reply_pipe_adr, int flag) +{ + int ret; + + xorriso->dialog= 2; + + if(xorriso->launch_frontend_banned) { + sprintf(xorriso->info_text, + "-launch_frontend was already executed in this xorriso run"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + xorriso->launch_frontend_banned= 1; + if(cmd[0] == 0 && (cmd_pipe_adr[0] == 0 || reply_pipe_adr[0] == 0)) + return(1); + ret= Xorriso_launch_frontend(xorriso, cmd, cmd_pipe_adr, reply_pipe_adr, 0); + return(ret); +} + + /* Option -list_arg_sorting */ int Xorriso_option_list_arg_sorting(struct XorrisO *xorriso, int flag) { diff --git a/xorriso/parse_exec.c b/xorriso/parse_exec.c index 41682002..e4b6cb92 100644 --- a/xorriso/parse_exec.c +++ b/xorriso/parse_exec.c @@ -534,7 +534,7 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv, "" }; static char arg3_commands[][40]= { - "append_partition", + "append_partition", "launch_frontend", "" }; static char arg4_commands[][40]= { @@ -740,6 +740,9 @@ int Xorriso_cmd_sorting_rank(struct XorrisO *xorriso, "* Dialog mode control:", "dialog", "page", "use_readline", "reassure", + "* Support for frontend programs via stdin and stdout (3):", + "launch_frontend", + "* Scripting, dialog and program control features (3):", "rollback_end", "end", @@ -899,7 +902,7 @@ return: { int ret, was_dashed, end_ret, num1, num2, cmd_data_size= 2 * SfileadrL; int mem_idx, arg_count, i; - char *cmd, *original_cmd, *cmd_data= NULL, *arg1, *arg2; + char *cmd, *original_cmd, *cmd_data= NULL, *arg1, *arg2, *arg3; Xorriso_alloc_meM(cmd_data, char, cmd_data_size); @@ -974,6 +977,10 @@ next_command:; arg2= argv[(*idx)+1]; else arg2= ""; + if((*idx) + 2 < argc) + arg3= argv[(*idx) + 2]; + else + arg3= ""; ret= 1; if(cmd[0]=='#' || cmd[0]==0) { @@ -1005,8 +1012,7 @@ next_command:; } else if(strcmp(cmd,"append_partition")==0) { (*idx)+= 3; - ret= Xorriso_option_append_partition(xorriso, arg1, arg2, argv[*idx - 1], - 0); + ret= Xorriso_option_append_partition(xorriso, arg1, arg2, arg3, 0); } else if(strcmp(cmd,"application_id")==0) { (*idx)++; @@ -1350,6 +1356,10 @@ next_command:; (*idx)++; ret= Xorriso_option_joliet(xorriso, arg1, 0); + } else if(strcmp(cmd, "launch_frontend") == 0) { + (*idx)+= 3; + ret= Xorriso_option_launch_frontend(xorriso, arg1, arg2, arg3, 0); + } else if(strcmp(cmd, "list_arg_sorting") == 0) { ret= Xorriso_option_list_arg_sorting(xorriso, 0); diff --git a/xorriso/text_io.c b/xorriso/text_io.c index ccaa54c4..72c5d04f 100644 --- a/xorriso/text_io.c +++ b/xorriso/text_io.c @@ -24,6 +24,7 @@ #include #include #include +#include /* for -charset */ @@ -3673,3 +3674,215 @@ ex:; return(1); } + +/* >>> make configurable by configure.ac # define Xorriso_allow_launch_frontenD 1 */ +/* # define Xorriso_allow_launch_frontend_suiD 1 */ + + +int Xorriso_launch_frontend(struct XorrisO *xorriso, char *cmd, + char *cmd_pipe_adr, char *reply_pipe_adr, int flag) +{ + int command_pipe[2], reply_pipe[2], ret, i, argc= 0, cpid, is_banned= 0; + char **argv= NULL, **exec_argv= NULL, *sfe= NULL, *adrpt; + struct stat stbuf; + + Xorriso_alloc_meM(sfe, char, 5 * SfileadrL); + for(i= 0; i < 2; i++) + command_pipe[i]= reply_pipe[i]= -1; + +#ifndef Xorriso_allow_launch_frontenD + /* To be controlled by: configure --enable-external-filters */ + + sprintf(xorriso->info_text, "-launch_frontend : Banned at compile time."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + sprintf(xorriso->info_text, +"This may be changed at compile time by ./configure option --enable-external-filters"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0); + is_banned= 1; + +#endif /* ! Xorriso_allow_launch_frontenD */ + +#ifndef Xorriso_allow_launch_frontend_suiD + + /* To be controlled by: configure --enable-external-filters-setuid */ + + if(getuid() != geteuid()) { + sprintf(xorriso->info_text, + "-set_filter: UID and EUID differ. Will not run external programs."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + sprintf(xorriso->info_text, +"This may be changed at compile time by ./configure option --enable-external-filters-setuid"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0); + is_banned= 1; + } + +#endif /* ! Xorriso_allow_launch_frontend_suiD */ + + if(is_banned) + {ret= 0; goto ex;} + + ret= Xorriso_parse_line(xorriso, cmd, "", "", 0, &argc, &argv, 1 | 64); + if(ret <= 0) + goto ex; + if(argc > 0) { + if(strchr(argv[0], '/') == NULL) { + sprintf(xorriso->info_text, + "-launch_frontend : Command path does not contain a '/'-character"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + + /* Add a NULL pointer for execv() */ + Xorriso_alloc_meM(exec_argv, char *, argc + 1); + if(exec_argv == NULL) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + ret= -1; goto ex; + } + for(i= 0; i < argc; i++) + exec_argv[i]= argv[i]; + exec_argv[argc]= NULL; + } else if(cmd_pipe_adr[0] == 0 || reply_pipe_adr[0] == 0) + {ret= 0; goto ex;} + + if(cmd_pipe_adr[0] && reply_pipe_adr[0]) { + /* Create named pipes if needed */ + for(i= 0; i < 2; i++) { + if(i == 0) + adrpt= cmd_pipe_adr; + else + adrpt= reply_pipe_adr; + ret= stat(adrpt, &stbuf); + if(ret == -1) { + ret= mknod(adrpt, S_IFIFO | S_IRWXU | S_IRWXG | S_IRWXO | S_IRWXO, + (dev_t) 0); + if(ret == -1) { + sprintf(xorriso->info_text, + "-launch_frontend: Cannot create named pipe %s", + Text_shellsafe(adrpt, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, + "FAILURE", 0); + ret= 0; goto ex; + } + } + } + } else { + ret= pipe(command_pipe); + if (ret == -1) { +no_pipe_open: + sprintf(xorriso->info_text, + "-launch_frontend: Failed to create a nameless pipe object"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + ret= 0; goto ex; + } + ret= pipe(reply_pipe); + if (ret == -1) + goto no_pipe_open; + } + + if(argc > 0) { + cpid = fork(); + if (cpid == -1) { + sprintf(xorriso->info_text, + "-launch_frontend: Failed to create a child process"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + ret= 0; goto ex; + } + } else + cpid= -1; /* Dummy child id */ + + if (cpid != 0) { + /* Parent becomes the xorriso slave */ + + if(cmd_pipe_adr[0] && reply_pipe_adr[0]) { + command_pipe[0]= open(cmd_pipe_adr, O_RDONLY); + if(command_pipe[0] == -1) { + sprintf(xorriso->info_text, + "-launch_frontend: Failed to open named command pipe %s", + Text_shellsafe(cmd_pipe_adr, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, + "FAILURE", 0); + ret= 0; goto ex; + } + reply_pipe[1]= open(reply_pipe_adr, O_WRONLY | O_APPEND); + if(reply_pipe[1] == -1) { + sprintf(xorriso->info_text, + "-launch_frontend: Failed to open named reply pipe %s", + Text_shellsafe(reply_pipe_adr, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, + "FAILURE", 0); + ret= 0; goto ex; + } + } else { + /* Close unused pipe ends */ + close(command_pipe[1]); + close(reply_pipe[0]); + } + close(0); + close(1); + close(2); + ret= dup2(command_pipe[0], 0); + if(ret == -1) { +no_dup:; + sprintf(xorriso->info_text, + "-launch_frontend: Failed to connect pipe to xorriso standard i/o channels"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + ret= -1; goto ex; + } + ret= dup2(reply_pipe[1], 1); + if(ret == -1) + goto no_dup; + ret= dup2(reply_pipe[1], 2); + if(ret == -1) + goto no_dup; + ret= 1; goto ex; + } + + /* Child becomes the frontend program */ + + /* Close unused pipe ends */; + if(cmd_pipe_adr[0] && reply_pipe_adr[0]) { + command_pipe[1]= open(cmd_pipe_adr, O_WRONLY | O_APPEND); + if(command_pipe[1] == -1) { + fprintf(stderr, + "xorriso: -launch_frontend: Failed to open named command pipe '%s'\n", + cmd_pipe_adr); + perror("xorriso: -launch_frontend"); + exit(1); + } + reply_pipe[0]= open(reply_pipe_adr, O_RDONLY); + if(reply_pipe[0] == -1) { + fprintf(stderr, + "xorriso: -launch_frontend: Failed to open named reply pipe '%s'\n", + reply_pipe_adr); + exit(1); + } + } else { + close(command_pipe[0]); + close(reply_pipe[1]); + } + close(0); + close(1); + ret= dup2(command_pipe[1], 1); + if(ret == -1) { + perror("xorriso: -launch_frontend: Error on redirecting standard output for frontend"); + exit(1); + } + ret= dup2(reply_pipe[0], 0); + if(ret == -1) { + perror("xorriso: -launch_frontend: Error on redirecting standard input for frontend"); + exit(1); + } + + execv(exec_argv[0], exec_argv); + fprintf(stderr, "xorriso: -launch_frontend: Failure to start program '%s'\n", + exec_argv[0]); + perror("xorriso: -launch_frontend"); + exit(1); + +ex:; + Xorriso__dispose_words(&argc, &argv); + Xorriso_free_meM(exec_argv); + Xorriso_free_meM(sfe); + return(ret); +} + diff --git a/xorriso/text_io.h b/xorriso/text_io.h index 22395348..15d18c09 100644 --- a/xorriso/text_io.h +++ b/xorriso/text_io.h @@ -96,5 +96,8 @@ int Xorriso_msg_op_parse_bulk(struct XorrisO *xorriso, int max_words, int pflag, int bulk_lines, int flag); +int Xorriso_launch_frontend(struct XorrisO *xorriso, char *cmd, + char *cmd_pipe_adr, char *reply_pipe_adr, int flag); + #endif /* ! Xorriso_pvt_textio_includeD */ diff --git a/xorriso/xorriso.1 b/xorriso/xorriso.1 index 525beb00..233cdc4e 100644 --- a/xorriso/xorriso.1 +++ b/xorriso/xorriso.1 @@ -9,7 +9,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 "Version 1.2.5, Dec 18, 2012" +.TH XORRISO 1 "Version 1.2.5, Dec 20, 2012" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -4588,6 +4588,66 @@ Print to the result channel a blank separated list of all severity names. Sorted from low to high severity. .br .TP +\fB\-launch_frontend\fR program_with_args command_pipe reply_pipe +.br +Start the program that is given as first word in parameter +program_with_args. Submit the other words from that parameter as +program arguments. Enable xorriso dialog mode. +.br +xorriso will abort when the started program ends or if it cannot +be started at all. In both cases it will return a non\-zero exit value. +The exit value will be zero if the frontend sends \-end or \-rollback_end +before ending itself. +.br +This command may be totaly banned at compile time. It is banned +by default if xorriso runs under setuid permissions. +.br +The program name will not be searched in the $PATH directories. +To make this clear, it must contain at least one /\-character. +Best is an absolute path. Like: /usr/bin/wish +.br +If one of command_pipe and reply_pipe is empty, then two nameless pipe +objects are created. xorriso standard input gets connected to the +standard output of the started program. xorriso standard output and +standard error get connected to the standard input of that program. +.br +The frontend program should first send via its standard output: +.br + \-mark 0 \-pkt_output on \-msg_op start_sieve \- +.br +It should be ready to decode \-pkt_output and to react on \-mark messages. +Best is to increment the \-mark number after each sent command sequence +and then to wait for the new number to show up in a mark message: +.br + some ... commands \-mark +.br +Further are advised: +.br + \-report_about UPDATE \-abort_on NEVER +.br + \-iso_rr_pattern off \-disk_pattern off +.br +A check of the xorriso version should be done, in order to make sure +that all desired features are present. +.br +If command_pipe and reply_pipe are not empty, then +create named pipes with these names and use them for the connection to +the standard input and standard output of the started program. +It is not an error if the named pipes already exist. +.br +With named pipes it is important that the frontend program opens the +command_pipe first. This is because xorriso will block at this pipe +until the frontend opens it. If the frontend would try to open reply_pipe +first, then it would block there and create a deadlock situation. +.br +Command \-launch_frontend will only work once per xorriso run. +If all three command parameters are submitted as empty texts, then +no program will be started but nevertheless \-launch_frontend will +be irrevocably disabled. +If parameter program_with_args is submitted as empty text and both +pipe parameters are non\-empty, then no program will be started but +the standard i/o channels of xorriso will get connected to named pipes. +.TP \fB\-prog\fR text Use text as name of this program in subsequent messages .TP diff --git a/xorriso/xorriso.h b/xorriso/xorriso.h index dc0e93a3..2293fae9 100644 --- a/xorriso/xorriso.h +++ b/xorriso/xorriso.h @@ -1526,6 +1526,11 @@ int Xorriso_option_jigdo(struct XorrisO *xorriso, char *aspect, char *arg, /* Command -joliet "on"|"off" */ int Xorriso_option_joliet(struct XorrisO *xorriso, char *mode, int flag); +/* Command -launch_frontend */ +/* @since 1.2.6 */ +int Xorriso_option_launch_frontend(struct XorrisO *xorriso, char *cmd, + char *cmd_pipe_adr, char *reply_pipe_adr, int flag); + /* Command -list_arg_sorting */ /* @since 1.2.2 */ int Xorriso_option_list_arg_sorting(struct XorrisO *xorriso, int flag); diff --git a/xorriso/xorriso.info b/xorriso/xorriso.info index fec6d135..99c7f70d 100644 --- a/xorriso/xorriso.info +++ b/xorriso/xorriso.info @@ -4014,6 +4014,53 @@ File: xorriso.info, Node: Frontend, Next: ExDevices, Prev: Scripting, Up: Co *list_sev* Print to the result channel a blank separated list of all severity names. Sorted from low to high severity. +-launch_frontend program_with_args command_pipe reply_pipe + Start the program that is given as first word in parameter + program_with_args. Submit the other words from that parameter as + program arguments. Enable xorriso dialog mode. + xorriso will abort when the started program ends or if it cannot + be started at all. In both cases it will return a non-zero exit + value. The exit value will be zero if the frontend sends -end or + -rollback_end before ending itself. + This command may be totaly banned at compile time. It is banned by + default if xorriso runs under setuid permissions. + The program name will not be searched in the $PATH directories. + To make this clear, it must contain at least one /-character. + Best is an absolute path. Like: /usr/bin/wish + If one of command_pipe and reply_pipe is empty, then two nameless + pipe objects are created. xorriso standard input gets connected to + the standard output of the started program. xorriso standard + output and standard error get connected to the standard input of + that program. + The frontend program should first send via its standard output: + -mark 0 -pkt_output on -msg_op start_sieve - + It should be ready to decode -pkt_output and to react on -mark + messages. Best is to increment the -mark number after each sent + command sequence and then to wait for the new number to show up in + a mark message: + some ... commands -mark + Further are advised: + -report_about UPDATE -abort_on NEVER + -iso_rr_pattern off -disk_pattern off + A check of the xorriso version should be done, in order to make + sure that all desired features are present. + If command_pipe and reply_pipe are not empty, then create named + pipes with these names and use them for the connection to the + standard input and standard output of the started program. It is + not an error if the named pipes already exist. + With named pipes it is important that the frontend program opens + the command_pipe first. This is because xorriso will block at this + pipe until the frontend opens it. If the frontend would try to + open reply_pipe first, then it would block there and create a + deadlock situation. + Command -launch_frontend will only work once per xorriso run. If + all three command parameters are submitted as empty texts, then no + program will be started but nevertheless -launch_frontend will be + irrevocably disabled. If parameter program_with_args is submitted + as empty text and both pipe parameters are non-empty, then no + program will be started but the standard i/o channels of xorriso + will get connected to named pipes. + -prog text Use text as name of this program in subsequent messages @@ -4724,6 +4771,8 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top * -iso_rr_pattern controls pattern expansion: Manip. (line 10) * -jigdo clears JTE or or adds parameter to JTE: Jigdo. (line 33) * -joliet enables production of Joliet tree: SetWrite. (line 10) +* -launch_frontend starts frontend program at pipes: Frontend. + (line 113) * -list_arg_sorting prints sorting order of -x: ArgSort. (line 27) * -list_delimiter replaces '--': Scripting. (line 60) * -list_extras lists compile time extra features: Scripting. @@ -4776,8 +4825,8 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top * -print_info prints message text line: Scripting. (line 102) * -print_mark prints synchronizing text line: Scripting. (line 105) * -print_size predicts image size: Inquiry. (line 91) -* -prog sets program name: Frontend. (line 113) -* -prog_help prints help text: Frontend. (line 116) +* -prog sets program name: Frontend. (line 160) +* -prog_help prints help text: Frontend. (line 163) * -prompt prompts for enter key: Scripting. (line 110) * -publisher sets publisher id: SetWrite. (line 186) * -pvd_info shows image id strings: Inquiry. (line 104) @@ -5047,7 +5096,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Program, end without writing, -rollback_end: Scripting. (line 159) * Program, list extra features, -list_extras: Scripting. (line 26) * Program, print help text, -help: Scripting. (line 20) -* Program, print help text, -prog_help: Frontend. (line 116) +* Program, print help text, -prog_help: Frontend. (line 163) * Program, print message text line, -print_info: Scripting. (line 102) * Program, print result text line, -print: Scripting. (line 99) * Program, print synchronizing text line, -print_mark: Scripting. @@ -5055,7 +5104,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Program, print version, -version: Scripting. (line 23) * Program, prompt for enter key, -prompt: Scripting. (line 110) * Program, replace --, -list_delimiter: Scripting. (line 60) -* Program, set name, -prog: Frontend. (line 113) +* Program, set name, -prog: Frontend. (line 160) * Program, show current settings, -status: Scripting. (line 47) * Program, status history, -status_history_max: Scripting. (line 56) * Program, wait a time span, -sleep: Scripting. (line 114) @@ -5161,28 +5210,28 @@ Node: Restore174782 Node: Emulation181692 Node: Scripting191504 Node: Frontend198665 -Node: Examples204596 -Node: ExDevices205774 -Node: ExCreate206433 -Node: ExDialog207718 -Node: ExGrowing208983 -Node: ExModifying209788 -Node: ExBootable210292 -Node: ExCharset210844 -Node: ExPseudo211665 -Node: ExCdrecord212563 -Node: ExMkisofs212880 -Node: ExGrowisofs214220 -Node: ExException215355 -Node: ExTime215809 -Node: ExIncBackup216268 -Node: ExRestore220260 -Node: ExRecovery221220 -Node: Files221790 -Node: Seealso223089 -Node: Bugreport223812 -Node: Legal224393 -Node: CommandIdx225404 -Node: ConceptIdx241495 +Node: Examples207358 +Node: ExDevices208536 +Node: ExCreate209195 +Node: ExDialog210480 +Node: ExGrowing211745 +Node: ExModifying212550 +Node: ExBootable213054 +Node: ExCharset213606 +Node: ExPseudo214427 +Node: ExCdrecord215325 +Node: ExMkisofs215642 +Node: ExGrowisofs216982 +Node: ExException218117 +Node: ExTime218571 +Node: ExIncBackup219030 +Node: ExRestore223022 +Node: ExRecovery223982 +Node: Files224552 +Node: Seealso225851 +Node: Bugreport226574 +Node: Legal227155 +Node: CommandIdx228166 +Node: ConceptIdx244395  End Tag Table diff --git a/xorriso/xorriso.texi b/xorriso/xorriso.texi index 62442a31..07e9d510 100644 --- a/xorriso/xorriso.texi +++ b/xorriso/xorriso.texi @@ -50,7 +50,7 @@ @c man .\" First parameter, NAME, should be all caps @c man .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection @c man .\" other parameters are allowed: see man(7), man(1) -@c man .TH XORRISO 1 "Version 1.2.5, Dec 18, 2012" +@c man .TH XORRISO 1 "Version 1.2.5, Dec 20, 2012" @c man .\" Please adjust this date whenever revising the manpage. @c man .\" @c man .\" Some roff macros, for reference: @@ -5374,6 +5374,67 @@ Print to the result channel a blank separated list of all severity names. Sorted from low to high severity. @* @c man .TP +@item -launch_frontend program_with_args command_pipe reply_pipe +@kindex -launch_frontend starts frontend program at pipes +@cindex Frontend program, start at pipes, -launch_frontend +Start the program that is given as first word in parameter +program_with_args. Submit the other words from that parameter as +program arguments. Enable xorriso dialog mode. +@* +xorriso will abort when the started program ends or if it cannot +be started at all. In both cases it will return a non-zero exit value. +The exit value will be zero if the frontend sends -end or -rollback_end +before ending itself. +@* +This command may be totaly banned at compile time. It is banned +by default if xorriso runs under setuid permissions. +@* +The program name will not be searched in the $PATH directories. +To make this clear, it must contain at least one /-character. +Best is an absolute path. Like: /usr/bin/wish +@* +If one of command_pipe and reply_pipe is empty, then two nameless pipe +objects are created. xorriso standard input gets connected to the +standard output of the started program. xorriso standard output and +standard error get connected to the standard input of that program. +@* +The frontend program should first send via its standard output: +@* + -mark 0 -pkt_output on -msg_op start_sieve - +@* +It should be ready to decode -pkt_output and to react on -mark messages. +Best is to increment the -mark number after each sent command sequence +and then to wait for the new number to show up in a mark message: +@* + some ... commands -mark +@* +Further are advised: +@* + -report_about UPDATE -abort_on NEVER +@* + -iso_rr_pattern off -disk_pattern off +@* +A check of the xorriso version should be done, in order to make sure +that all desired features are present. +@* +If command_pipe and reply_pipe are not empty, then +create named pipes with these names and use them for the connection to +the standard input and standard output of the started program. +It is not an error if the named pipes already exist. +@* +With named pipes it is important that the frontend program opens the +command_pipe first. This is because xorriso will block at this pipe +until the frontend opens it. If the frontend would try to open reply_pipe +first, then it would block there and create a deadlock situation. +@* +Command -launch_frontend will only work once per xorriso run. +If all three command parameters are submitted as empty texts, then +no program will be started but nevertheless -launch_frontend will +be irrevocably disabled. +If parameter program_with_args is submitted as empty text and both +pipe parameters are non-empty, then no program will be started but +the standard i/o channels of xorriso will get connected to named pipes. +@c man .TP @item -prog text @kindex -prog sets program name @cindex Program, set name, -prog diff --git a/xorriso/xorriso_private.h b/xorriso/xorriso_private.h index 0b49ac66..38ce6733 100644 --- a/xorriso/xorriso_private.h +++ b/xorriso/xorriso_private.h @@ -644,6 +644,7 @@ struct XorrisO { /* the global context of xorriso */ double insert_count; double insert_bytes; double error_count; /* double will not roll over */ + int launch_frontend_banned; /* pacifiers */ int pacifier_style; /* 0= xorriso, 1=mkisofs 2=cdrecord */ diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index fa3cba16..cf157099 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2012.12.19.210641" +#define Xorriso_timestamP "2012.12.20.202145"