From 218cfa6a2dace1d526bfb4e136b78d3d60876abd Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 19 Aug 2009 18:07:44 +0000 Subject: [PATCH] New -md5 mode "all" --- libisoburn/trunk/xorriso/xorriso.1 | 8 +++- libisoburn/trunk/xorriso/xorriso.c | 45 ++++++++++++++------ libisoburn/trunk/xorriso/xorriso_private.h | 1 + libisoburn/trunk/xorriso/xorriso_timestamp.h | 2 +- libisoburn/trunk/xorriso/xorrisoburn.c | 3 +- 5 files changed, 43 insertions(+), 16 deletions(-) diff --git a/libisoburn/trunk/xorriso/xorriso.1 b/libisoburn/trunk/xorriso/xorriso.1 index d223d36c..938ca30b 100644 --- a/libisoburn/trunk/xorriso/xorriso.1 +++ b/libisoburn/trunk/xorriso/xorriso.1 @@ -2,7 +2,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 "Aug 18, 2009" +.TH XORRISO 1 "Aug 19, 2009" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -727,7 +727,7 @@ Enable or disable processing of xattr attributes in user namespace. If enabled, then xorriso will handle xattr similar to ACL. See also options -getfattr, -setfattr and above paragraph about xattr. .TP -\fB\-md5\fR "on"|"off" +\fB\-md5\fR "on"|"all"|"off" Enable or disable processing of MD5 checksums for the overall session and for each single data file. If enabled then images get loaded only if eventual checksums tags of superblock and directory tree match properly. The MD5 @@ -739,6 +739,10 @@ written into the new session. The checksums of files which have their data in older sessions get copied into the new session. Superblock, tree and whole session get a checksum tag each. .br +Mode "all" will additionally check during image generation whether the checksum +of a data file changed between the time when its reading began and the time +when it ended. This implies reading every file twice. +.br Checksums can be exploited via options -check_md5, -check_md5_r, via find actions get_md5, check_md5, and via -check_media. .TP diff --git a/libisoburn/trunk/xorriso/xorriso.c b/libisoburn/trunk/xorriso/xorriso.c index cde2fe2f..1d834383 100644 --- a/libisoburn/trunk/xorriso/xorriso.c +++ b/libisoburn/trunk/xorriso/xorriso.c @@ -7106,8 +7106,9 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag) if(!(is_default && no_defaults)) Xorriso_status_result(xorriso,filter,fp,flag&2); - is_default= ((xorriso->do_md5 & (1 | 2 | 4)) == 0); - sprintf(line,"-md5 %s\n", (xorriso->do_md5 & 1 ? "on" : "off")); + is_default= ((xorriso->do_md5 & (1 | 2 | 4 | 8)) == 0); + sprintf(line, "-md5 %s\n", (xorriso->do_md5 & 1 ? + xorriso->do_md5 & 8 ? "all" : "on" : "off")); if(!(is_default && no_defaults)) Xorriso_status_result(xorriso,filter,fp,flag&2); @@ -15482,7 +15483,7 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag) " -disk_dev_ino \"on\"|\"ino_only\"|\"off\"", " Enable resp. disable recording of disk file dev_t and ino_t", " and their use in file comparison.", -" -md5 \"on\"|\"off\"", +" -md5 \"on\"|\"all\"|\"off\"", " Enable resp. disable processing of MD5 checksums.", " -ban_stdio_write", " Allow for writing only the usage of optical drives.", @@ -16529,17 +16530,37 @@ int Xorriso_option_mark(struct XorrisO *xorriso, char *mark, int flag) } -/* Option -md5 "on"|"off" */ +/* Option -md5 "on"|"all"|"off" */ int Xorriso_option_md5(struct XorrisO *xorriso, char *mode, int flag) { - if(strcmp(mode, "off")==0) - xorriso->do_md5&= ~7; - else if(strcmp(mode, "on")==0) - xorriso->do_md5|= (1 | 2 | 4); - else { - sprintf(xorriso->info_text, "-md5: unknown mode '%s'", mode); - Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); - return(0); + char *npt, *cpt; + int l; + + 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->do_md5&= ~15; + else if(l == 2 && strncmp(cpt, "on", l) == 0) + xorriso->do_md5|= 7; + else if(l == 3 && strncmp(cpt, "all", l) == 0) + xorriso->do_md5|= 15; + else if(l == 18 && strncmp(cpt, "stability_check_on", l) == 0) + xorriso->do_md5|= 8; + else if(l == 19 && strncmp(cpt, "stability_check_off", l) == 0) + xorriso->do_md5&= ~8; + else { + sprintf(xorriso->info_text, "-md5: unknown mode "); + Text_shellsafe(cpt, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } } return(1); } diff --git a/libisoburn/trunk/xorriso/xorriso_private.h b/libisoburn/trunk/xorriso/xorriso_private.h index fb5ca126..bf00d824 100644 --- a/libisoburn/trunk/xorriso/xorriso_private.h +++ b/libisoburn/trunk/xorriso/xorriso_private.h @@ -127,6 +127,7 @@ struct XorrisO { /* the global context of xorriso */ int do_md5; /* bit0= read MD5 array bit1= write session MD5 bit2= write MD5 for each data file + bit3= make file content stability check by double reading */ int relax_compliance; /* opaque bitfield to be set by xorrisoburn */ diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index 65f11809..6e3298ff 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2009.08.19.180632" +#define Xorriso_timestamP "2009.08.19.180842" diff --git a/libisoburn/trunk/xorriso/xorrisoburn.c b/libisoburn/trunk/xorriso/xorrisoburn.c index f82bb7b2..31ba848f 100644 --- a/libisoburn/trunk/xorriso/xorrisoburn.c +++ b/libisoburn/trunk/xorriso/xorrisoburn.c @@ -1801,7 +1801,8 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag) (xorriso->do_md5 & (2 | 4)) ) * isoburn_igopt_aaip) | ((!!(xorriso->do_md5 & 2)) * isoburn_igopt_session_md5) | - ((!!(xorriso->do_md5 & 4)) * isoburn_igopt_file_md5); + ((!!(xorriso->do_md5 & 4)) * isoburn_igopt_file_md5) | + ((!!(xorriso->do_md5 & 8)) * isoburn_igopt_file_stability); isoburn_igopt_set_extensions(sopts, ext); isoburn_igopt_set_relaxed(sopts, relax); isoburn_igopt_set_sort_files(sopts, 1);