From 30828a48678d33629f2299977949953ae5dceff3 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 21 Apr 2014 16:56:44 +0000 Subject: [PATCH] New -follow occasion "concat" --- xorriso/base_obj.c | 1 + xorriso/disk_ops.c | 16 ++--- xorriso/opts_d_h.c | 12 +++- xorriso/text_io.c | 5 +- xorriso/xorriso.1 | 26 +++++--- xorriso/xorriso.info | 126 +++++++++++++++++++----------------- xorriso/xorriso.texi | 26 +++++--- xorriso/xorriso_private.h | 1 + xorriso/xorriso_timestamp.h | 2 +- 9 files changed, 121 insertions(+), 94 deletions(-) diff --git a/xorriso/base_obj.c b/xorriso/base_obj.c index ca1bc81e..43327e63 100644 --- a/xorriso/base_obj.c +++ b/xorriso/base_obj.c @@ -159,6 +159,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag) m->follow_link_limit= 100; m->resolve_link_rec_count= 0; m->resolve_link_rec_limit= 100; + m->do_follow_concat= 0; m->do_follow_mount= 1; m->do_global_uid= 0; m->global_uid= 0; diff --git a/xorriso/disk_ops.c b/xorriso/disk_ops.c index 56bb7b60..0fde60dc 100644 --- a/xorriso/disk_ops.c +++ b/xorriso/disk_ops.c @@ -2003,15 +2003,13 @@ int Xorriso_is_concat_target(struct XorrisO *xorriso, char *target, } if(*ftype == 3) { - - /* >>> - if follow_links is enabled : obtain target type - *ftype= Sfile_type(target, 1 | 4 | 8); - else - */ - - why= "May not follow symbolic link."; - goto not_usable; + if(!xorriso->do_follow_concat) { + why= "May not follow symbolic link. No -follow \"...:concat:...\"."; + goto not_usable; + } + *ftype= Sfile_type(target, 1 | 4 | 8); + if(*ftype == -1) + return(2); /* not yet existing regular */ } if(*ftype == 2) { why= "May not write data into a directory."; diff --git a/xorriso/opts_d_h.c b/xorriso/opts_d_h.c index 5ccc1456..6c0888d7 100644 --- a/xorriso/opts_d_h.c +++ b/xorriso/opts_d_h.c @@ -1305,17 +1305,19 @@ ex:; /* Option -follow */ int Xorriso_option_follow(struct XorrisO *xorriso, char *mode, int flag) { - int was_fl, was_fm, was_fpr, was_fpt, l; + int was_fl, was_fm, was_fpr, was_fpt, was_fc, l; double num; char *cpt, *npt; was_fpt= xorriso->do_follow_pattern; was_fpr= xorriso->do_follow_param; was_fl= xorriso->do_follow_links; + was_fc= xorriso->do_follow_concat; was_fm= xorriso->do_follow_mount; xorriso->do_follow_pattern= 0; xorriso->do_follow_param= 0; xorriso->do_follow_links= 0; + xorriso->do_follow_concat= 0; xorriso->do_follow_mount= 0; npt= cpt= mode; for(cpt= mode; npt!=NULL; cpt= npt+1) { @@ -1330,16 +1332,19 @@ int Xorriso_option_follow(struct XorrisO *xorriso, char *mode, int flag) xorriso->do_follow_pattern= 0; xorriso->do_follow_param= 0; xorriso->do_follow_links= 0; + xorriso->do_follow_concat= 0; xorriso->do_follow_mount= 0; } else if(strncmp(cpt, "on", l)==0) { xorriso->do_follow_pattern= 1; xorriso->do_follow_param= 1; xorriso->do_follow_links= 1; + xorriso->do_follow_concat= 1; xorriso->do_follow_mount= 1; } else if(strncmp(cpt, "default", l)==0) { xorriso->do_follow_pattern= 1; xorriso->do_follow_param= 0; xorriso->do_follow_links= 0; + xorriso->do_follow_concat= 0; xorriso->do_follow_mount= 1; xorriso->follow_link_limit= 100; } else if(strncmp(cpt, "link", l)==0 || strncmp(cpt,"links", l)==0) { @@ -1350,6 +1355,8 @@ int Xorriso_option_follow(struct XorrisO *xorriso, char *mode, int flag) xorriso->do_follow_param= 1; } else if(strncmp(cpt, "pattern", l)==0) { xorriso->do_follow_pattern= 1; + } else if(strncmp(cpt, "concat", l)==0) { + xorriso->do_follow_concat= 1; } else if(strncmp(cpt, "limit=", 6)==0) { sscanf(cpt+6, "%lf", &num); if(num<=0 || num>1.0e6) { @@ -1369,6 +1376,7 @@ sorry_ex: xorriso->do_follow_pattern= was_fpt; xorriso->do_follow_param= was_fpr; xorriso->do_follow_links= was_fl; + xorriso->do_follow_concat= was_fc; xorriso->do_follow_mount= was_fm; return(0); } @@ -1927,7 +1935,7 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag) " Like -not_list but with line rules as -dialog \"on\".", " -not_mgt \"reset\"|\"on\"|\"off\"|\"param_on\"|\"subtree_on\"|\"ignore_on\"", " Control effect of exclusion lists.", -" -follow \"on\"|\"pattern:param:link:mount:limit=#\"|\"default\"|\"off\"", +" -follow \"on\"|\"pattern:param:link:concat:mount:limit=#\"|\"default\"|\"off\"", " Follow symbolic links and mount points within disk_path.", " -overwrite \"on\"|\"nondir\"|\"off\"", " Allow or disallow to overwrite existing files in ISO image.", diff --git a/xorriso/text_io.c b/xorriso/text_io.c index eb6744f4..431b52df 100644 --- a/xorriso/text_io.c +++ b/xorriso/text_io.c @@ -3022,7 +3022,8 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag) is_default= (xorriso->do_follow_pattern && (!xorriso->do_follow_param) && xorriso->do_follow_mount && (!xorriso->do_follow_links) - && xorriso->follow_link_limit==100); + && xorriso->follow_link_limit==100 + && (!xorriso->do_follow_concat)); mode[0]= 0; if(xorriso->do_follow_pattern && !(xorriso->do_follow_links && xorriso->do_follow_mount)) @@ -3031,6 +3032,8 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag) strcat(mode,":param"); if(xorriso->do_follow_links) strcat(mode,":link"); + if(xorriso->do_follow_concat) + strcat(mode,":concat"); if(xorriso->do_follow_mount) strcat(mode,":mount"); if(mode[0]==0) diff --git a/xorriso/xorriso.1 b/xorriso/xorriso.1 index f93bfdad..04a84dc6 100644 --- a/xorriso/xorriso.1 +++ b/xorriso/xorriso.1 @@ -1337,25 +1337,31 @@ handled as one parameter for \-not_paths resp. \-not_leaf. .TP \fB\-follow\fR occasion[:occasion[...]] Enable or disable resolution of symbolic links and mountpoints under -disk_paths. This applies to actions \-add, \-du*x, \-ls*x, \-findx, +disk_paths. This applies to actions \-add, \-du*x, \-ls*x, \-findx, \-concat, and to \-disk_pattern expansion. .br -There are two kinds of follow decisison to be made: +There are three kinds of follow decisison to be made: .br -"link" is the hop from a symbolic link to its target file object. +\fBlink\fR is the hop from a symbolic link to its target file object for the +purpose of reading. I.e. not for command \-concat. If enabled then symbolic links are handled as their target file objects, else symbolic links are handled as themselves. .br -"mount" is the hop from one filesystem to another subordinate filesystem. +\fBmount\fR is the hop from one filesystem to another subordinate filesystem. If enabled then mountpoint directories are handled as any other directory, else mountpoints are handled as empty directories if they are encountered in directory tree traversals. .br +\fBconcat\fR is the hop from a symbolic link to its target file object for +the purpose of writing. I.e. for command \-concat. This is a security risk ! +.br Less general than above occasions: .br -"pattern" is mount and link hopping, but only during \-disk_pattern expansion. +\fBpattern\fR is mount and link hopping, but only during \-disk_pattern +expansion. .br -"param" is link hopping for parameter words (after eventual pattern expansion). +\fBparam\fR is link hopping for parameter words (after eventual pattern +expansion). If enabled then \-ls*x will show the link targets rather than the links themselves. \-du*x, \-findx, and \-add will process the link targets but not follow links in an eventual directory tree below the targets (unless "link" @@ -1364,19 +1370,19 @@ is enabled). Occasions can be combined in a colon separated list. All occasions mentioned in the list will then lead to a positive follow decision. .br -"off" prevents any positive follow decision. Use it if no other occasion +\fBoff\fR prevents any positive follow decision. Use it if no other occasion applies. .br Shortcuts: .br -"default" is equivalent to "pattern:mount:limit=100". +\fBdefault\fR is equivalent to "pattern:mount:limit=100". .br -"on" always decides positive. Equivalent to "link:mount". +\fBon\fR always decides positive. Equivalent to "link:mount:concat". .br Not an occasion but an optional setting is: .br -"limit=" which sets the maximum number of link hops. +\fBlimit=\fR which sets the maximum number of link hops. A link hop consists of a sequence of symbolic links and a final target of different type. Nevertheless those hops can loop. Example: .br diff --git a/xorriso/xorriso.info b/xorriso/xorriso.info index a268c3f0..707dfcea 100644 --- a/xorriso/xorriso.info +++ b/xorriso/xorriso.info @@ -1231,33 +1231,37 @@ File: xorriso.info, Node: SetInsert, Next: Manip, Prev: Insert, Up: Commands -follow occasion[:occasion[...]] Enable or disable resolution of symbolic links and mountpoints under disk_paths. This applies to actions -add, -du*x, -ls*x, - -findx, and to -disk_pattern expansion. - There are two kinds of follow decisison to be made: - "link" is the hop from a symbolic link to its target file object. - If enabled then symbolic links are handled as their target file + -findx, -concat, and to -disk_pattern expansion. + There are three kinds of follow decisison to be made: + *link* is the hop from a symbolic link to its target file object + for the purpose of reading. I.e. not for command -concat. If + enabled then symbolic links are handled as their target file objects, else symbolic links are handled as themselves. - "mount" is the hop from one filesystem to another subordinate + *mount* is the hop from one filesystem to another subordinate filesystem. If enabled then mountpoint directories are handled as any other directory, else mountpoints are handled as empty directories if they are encountered in directory tree traversals. + *concat* is the hop from a symbolic link to its target file object + for the purpose of writing. I.e. for command -concat. This is a + security risk ! Less general than above occasions: - "pattern" is mount and link hopping, but only during -disk_pattern + *pattern* is mount and link hopping, but only during -disk_pattern expansion. - "param" is link hopping for parameter words (after eventual - pattern expansion). If enabled then -ls*x will show the link - targets rather than the links themselves. -du*x, -findx, and -add - will process the link targets but not follow links in an eventual + *param* is link hopping for parameter words (after eventual pattern + expansion). If enabled then -ls*x will show the link targets + rather than the links themselves. -du*x, -findx, and -add will + process the link targets but not follow links in an eventual directory tree below the targets (unless "link" is enabled). Occasions can be combined in a colon separated list. All occasions mentioned in the list will then lead to a positive follow decision. - "off" prevents any positive follow decision. Use it if no other + *off* prevents any positive follow decision. Use it if no other occasion applies. Shortcuts: - "default" is equivalent to "pattern:mount:limit=100". - "on" always decides positive. Equivalent to "link:mount". + *default* is equivalent to "pattern:mount:limit=100". + *on* always decides positive. Equivalent to "link:mount:concat". Not an occasion but an optional setting is: - "limit=" which sets the maximum number of link hops. A + *limit=* which sets the maximum number of link hops. A link hop consists of a sequence of symbolic links and a final target of different type. Nevertheless those hops can loop. Example: @@ -5124,13 +5128,13 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top * -osirrox enables ISO-to-disk copying: Restore. (line 18) * -out_charset sets output character set: SetWrite. (line 276) * -outdev acquires a drive for output: AqDrive. (line 31) -* -overwrite enables overwriting in ISO: SetInsert. (line 127) +* -overwrite enables overwriting in ISO: SetInsert. (line 131) * -pacifier controls pacifier text form: Emulation. (line 165) * -padding sets amount or mode of image padding: SetWrite. (line 384) * -page set terminal geometry: DialogCtl. (line 19) * -paste_in copies file into disk file: Restore. (line 124) * -path_list inserts paths from disk file: Insert. (line 80) -* -pathspecs sets meaning of = with -add: SetInsert. (line 118) +* -pathspecs sets meaning of = with -add: SetInsert. (line 122) * -pkt_output consolidates text output: Frontend. (line 7) * -preparer_id sets preparer id: SetWrite. (line 250) * -print prints result text line: Scripting. (line 110) @@ -5183,7 +5187,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top (line 69) * -sleep waits for a given time span: Scripting. (line 125) * -speed set write speed: SetWrite. (line 302) -* -split_size enables large file splitting: SetInsert. (line 140) +* -split_size enables large file splitting: SetInsert. (line 144) * -status shows current settings: Scripting. (line 47) * -status_history_max curbs -status history: Scripting. (line 56) * -stdio_sync controls stdio buffer: SetWrite. (line 340) @@ -5333,7 +5337,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Image, show id strings, -pvd_info: Inquiry. (line 115) * Image, show MBR, GPT, and alike, -pvd_info: Inquiry. (line 124) * Input Character Set, _definition: Charset. (line 25) -* Insert, enable overwriting, -overwrite: SetInsert. (line 127) +* Insert, enable overwriting, -overwrite: SetInsert. (line 131) * Insert, file exclusion absolute, -not_paths: SetInsert. (line 55) * Insert, file exclusion from file, -not_list: SetInsert. (line 67) * Insert, file exclusion pattern, -not_leaf: SetInsert. (line 62) @@ -5342,10 +5346,10 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Insert, if different, -update: Insert. (line 104) * Insert, if different, -update_l: Insert. (line 126) * Insert, if different, -update_r: Insert. (line 115) -* Insert, large file splitting, -split_size: SetInsert. (line 140) +* Insert, large file splitting, -split_size: SetInsert. (line 144) * Insert, limit data file size, -file_size_limit: SetInsert. (line 7) * Insert, links or mount points, -follow: SetInsert. (line 76) -* Insert, meaning of = with -add, -pathspecs: SetInsert. (line 118) +* Insert, meaning of = with -add, -pathspecs: SetInsert. (line 122) * Insert, non-dashed arguments, -add_plainly: Insert. (line 66) * Insert, path, -map: Insert. (line 90) * Insert, path, -map_single: Insert. (line 95) @@ -5398,7 +5402,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Ownership, in ISO image, -chown_r: Manip. (line 54) * Partition offset, _definition: Bootable. (line 180) * Partition table, _definition: Bootable. (line 141) -* Pathspec, _definition: SetInsert. (line 120) +* Pathspec, _definition: SetInsert. (line 124) * Pattern expansion, _definition: Processing. (line 24) * Pattern expansion, for disk paths, -disk_pattern: Insert. (line 36) * Pattern expansion, for ISO paths, -iso_rr_pattern: Manip. (line 10) @@ -5526,45 +5530,45 @@ Node: AqDrive28025 Node: Loading31070 Node: Insert47999 Node: SetInsert58213 -Node: Manip66790 -Node: CmdFind76570 -Node: Filter93841 -Node: Writing98463 -Node: SetWrite108594 -Node: Bootable129300 -Node: Jigdo146667 -Node: Charset150914 -Node: Exception154229 -Node: DialogCtl160349 -Node: Inquiry162947 -Node: Navigate170082 -Node: Verify178380 -Node: Restore188207 -Node: Emulation196780 -Node: Scripting207168 -Node: Frontend214939 -Node: Examples224546 -Node: ExDevices225724 -Node: ExCreate226390 -Node: ExDialog227675 -Node: ExGrowing228940 -Node: ExModifying229745 -Node: ExBootable230249 -Node: ExCharset230801 -Node: ExPseudo231693 -Node: ExCdrecord232591 -Node: ExMkisofs232908 -Node: ExGrowisofs234248 -Node: ExException235383 -Node: ExTime235837 -Node: ExIncBackup236296 -Node: ExRestore240276 -Node: ExRecovery241209 -Node: Files241779 -Node: Seealso243078 -Node: Bugreport243801 -Node: Legal244382 -Node: CommandIdx245393 -Node: ConceptIdx262201 +Node: Manip67033 +Node: CmdFind76813 +Node: Filter94084 +Node: Writing98706 +Node: SetWrite108837 +Node: Bootable129543 +Node: Jigdo146910 +Node: Charset151157 +Node: Exception154472 +Node: DialogCtl160592 +Node: Inquiry163190 +Node: Navigate170325 +Node: Verify178623 +Node: Restore188450 +Node: Emulation197023 +Node: Scripting207411 +Node: Frontend215182 +Node: Examples224789 +Node: ExDevices225967 +Node: ExCreate226633 +Node: ExDialog227918 +Node: ExGrowing229183 +Node: ExModifying229988 +Node: ExBootable230492 +Node: ExCharset231044 +Node: ExPseudo231936 +Node: ExCdrecord232834 +Node: ExMkisofs233151 +Node: ExGrowisofs234491 +Node: ExException235626 +Node: ExTime236080 +Node: ExIncBackup236539 +Node: ExRestore240519 +Node: ExRecovery241452 +Node: Files242022 +Node: Seealso243321 +Node: Bugreport244044 +Node: Legal244625 +Node: CommandIdx245636 +Node: ConceptIdx262444  End Tag Table diff --git a/xorriso/xorriso.texi b/xorriso/xorriso.texi index 276775f9..e249b21c 100644 --- a/xorriso/xorriso.texi +++ b/xorriso/xorriso.texi @@ -1654,25 +1654,31 @@ handled as one parameter for -not_paths resp. -not_leaf. @kindex -follow softlinks and mount points @cindex Insert, links or mount points, -follow Enable or disable resolution of symbolic links and mountpoints under -disk_paths. This applies to actions -add, -du*x, -ls*x, -findx, +disk_paths. This applies to actions -add, -du*x, -ls*x, -findx, -concat, and to -disk_pattern expansion. @* -There are two kinds of follow decisison to be made: +There are three kinds of follow decisison to be made: @* -"link" is the hop from a symbolic link to its target file object. +@strong{link} is the hop from a symbolic link to its target file object for the +purpose of reading. I.e. not for command -concat. If enabled then symbolic links are handled as their target file objects, else symbolic links are handled as themselves. @* -"mount" is the hop from one filesystem to another subordinate filesystem. +@strong{mount} is the hop from one filesystem to another subordinate filesystem. If enabled then mountpoint directories are handled as any other directory, else mountpoints are handled as empty directories if they are encountered in directory tree traversals. @* +@strong{concat} is the hop from a symbolic link to its target file object for +the purpose of writing. I.e. for command -concat. This is a security risk ! +@* Less general than above occasions: @* -"pattern" is mount and link hopping, but only during -disk_pattern expansion. +@strong{pattern} is mount and link hopping, but only during -disk_pattern +expansion. @* -"param" is link hopping for parameter words (after eventual pattern expansion). +@strong{param} is link hopping for parameter words (after eventual pattern +expansion). If enabled then -ls*x will show the link targets rather than the links themselves. -du*x, -findx, and -add will process the link targets but not follow links in an eventual directory tree below the targets (unless "link" @@ -1681,20 +1687,20 @@ is enabled). Occasions can be combined in a colon separated list. All occasions mentioned in the list will then lead to a positive follow decision. @* -"off" prevents any positive follow decision. Use it if no other occasion +@strong{off} prevents any positive follow decision. Use it if no other occasion applies. @* Shortcuts: @* -"default" is equivalent to "pattern:mount:limit=100". +@strong{default} is equivalent to "pattern:mount:limit=100". @* -"on" always decides positive. Equivalent to "link:mount". +@strong{on} always decides positive. Equivalent to "link:mount:concat". @* @sp 1 Not an occasion but an optional setting is: @* -"limit=" which sets the maximum number of link hops. +@strong{limit=} which sets the maximum number of link hops. A link hop consists of a sequence of symbolic links and a final target of different type. Nevertheless those hops can loop. Example: @* diff --git a/xorriso/xorriso_private.h b/xorriso/xorriso_private.h index 0d53a46a..2a72df01 100644 --- a/xorriso/xorriso_private.h +++ b/xorriso/xorriso_private.h @@ -192,6 +192,7 @@ struct XorrisO { /* the global context of xorriso */ int follow_link_limit; int resolve_link_rec_count; int resolve_link_rec_limit; + int do_follow_concat; int do_follow_mount; int do_global_uid; uid_t global_uid; diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 7ea46bef..b490411e 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2014.04.21.131802" +#define Xorriso_timestamP "2014.04.21.165612"