Making use of new API call iso_md5_match() and adapted to MD5 image mismatches

This commit is contained in:
Thomas Schmitt 2009-08-18 17:34:08 +00:00
parent f0c12594c1
commit 6d05a2f7fc
2 changed files with 18 additions and 20 deletions

View File

@ -1 +1 @@
#define Xorriso_timestamP "2009.08.17.162834" #define Xorriso_timestamP "2009.08.18.173453"

View File

@ -938,6 +938,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, ext; int ret, hret, not_writeable= 0, has_what, aquire_flag, load_lba, ext;
int lba, track, session, params_flag, adr_mode, read_ret;
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;
@ -949,7 +950,6 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
size_t value_length; size_t value_length;
char *value= NULL; char *value= NULL;
double num; double num;
int lba, track, session, params_flag, adr_mode;
char volid[33], adr_data[163], *adr_pt; char volid[33], adr_data[163], *adr_pt;
if((flag&3)==0) { if((flag&3)==0) {
@ -1160,7 +1160,7 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
goto ex; goto ex;
} }
ret= isoburn_read_image(drive, ropts, &volset); read_ret= ret= isoburn_read_image(drive, ropts, &volset);
/* <<< Resetting to normal thresholds */ /* <<< Resetting to normal thresholds */
if(xorriso->img_read_error_mode>0) if(xorriso->img_read_error_mode>0)
@ -1175,9 +1175,16 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
if(xorriso->img_read_error_mode==2) if(xorriso->img_read_error_mode==2)
sev= "FATAL"; sev= "FATAL";
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, sev, 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, sev, 0);
if(xorriso->img_read_error_mode!=0) if(read_ret == ISO_SB_TREE_CORRUPTED && (xorriso->do_md5 & 1)) {
Xorriso_msgs_submit(xorriso, 0, "You might get a partial or altered ISO image tree by option -error_behavior 'image_loading' 'best_effort'", Xorriso_msgs_submit(xorriso, 0,
"You might get a questionable ISO image tree by option -md5 'off'.",
0, "HINT", 0);
} else if(xorriso->img_read_error_mode!=0) {
Xorriso_msgs_submit(xorriso, 0, "You might get a partial or altered ISO image tree by option -error_behavior 'image_loading' 'best_effort' if -abort_on is set to be tolerant enough.",
0, "HINT", 0); 0, "HINT", 0);
}
ret= 3; goto ex; ret= 3; goto ex;
} }
Xorriso_pacifier_callback(xorriso, "nodes read", xorriso->pacifier_count, 0, Xorriso_pacifier_callback(xorriso, "nodes read", xorriso->pacifier_count, 0,
@ -9203,7 +9210,7 @@ int Xorriso_check_interval(struct XorrisO *xorriso, struct SpotlisT *spotlist,
int from_lba, int block_count, int read_chunk, int from_lba, int block_count, int read_chunk,
int md5_start, int flag) int md5_start, int flag)
{ {
int i, j, k, ret, total_count= 0, sectors= -1, sector_size= -1, skip_reading; int i, j, ret, total_count= 0, sectors= -1, sector_size= -1, skip_reading;
int prev_quality= -1, quality= -1, retry= 0, profile_no, is_cd= 0; int prev_quality= -1, quality= -1, retry= 0, profile_no, is_cd= 0;
int start_sec, end_sec, first_value, fret; int start_sec, end_sec, first_value, fret;
char profile_name[80]; char profile_name[80];
@ -9445,15 +9452,12 @@ abort_check:;
} }
iso_md5_end(&cloned_ctx, md5); iso_md5_end(&cloned_ctx, md5);
for(k= 0; k < 16; k++)
if(tag_md5[k] != md5[k])
break;
if(ret == ISO_MD5_AREA_CORRUPTED) { if(ret == ISO_MD5_AREA_CORRUPTED) {
comparison= "CORRUPTED"; comparison= "CORRUPTED";
sev_text= "WARNING"; sev_text= "WARNING";
md5_spot_value= Xorriso_read_quality_md5_mismatcH; md5_spot_value= Xorriso_read_quality_md5_mismatcH;
chain_broken= 1; chain_broken= 1;
} else if(k < 16 ) { } else if(! iso_md5_match(tag_md5, md5)) {
comparison= "NON-MATCHING"; comparison= "NON-MATCHING";
sev_text= "WARNING"; sev_text= "WARNING";
md5_spot_value= Xorriso_read_quality_md5_mismatcH; md5_spot_value= Xorriso_read_quality_md5_mismatcH;
@ -12292,7 +12296,7 @@ ex:;
int Xorriso_check_md5(struct XorrisO *xorriso, void *in_node, char *path, int Xorriso_check_md5(struct XorrisO *xorriso, void *in_node, char *path,
int flag) int flag)
{ {
int i, ret, wanted, rret; int ret, wanted, rret;
IsoImage *image; IsoImage *image;
IsoNode *node; IsoNode *node;
IsoFile *file; IsoFile *file;
@ -12361,10 +12365,7 @@ int Xorriso_check_md5(struct XorrisO *xorriso, void *in_node, char *path,
goto ex; goto ex;
/* Report outcome */ /* Report outcome */
for(i= 0; i < 16; i++) if(! iso_md5_match(node_md5, data_md5)) {
if(node_md5[i] != data_md5[i])
break;
if(i < 16 ) {
sprintf(xorriso->result_line, "MD5 MISMATCH: "); sprintf(xorriso->result_line, "MD5 MISMATCH: ");
Text_shellsafe(path, xorriso->result_line, 1); Text_shellsafe(path, xorriso->result_line, 1);
strcat(xorriso->result_line, "\n"); strcat(xorriso->result_line, "\n");
@ -12391,7 +12392,7 @@ ex:;
int Xorriso_check_md5_range(struct XorrisO *xorriso, off_t start_lba, int Xorriso_check_md5_range(struct XorrisO *xorriso, off_t start_lba,
off_t end_lba, char md5[16], int flag) off_t end_lba, char md5[16], int flag)
{ {
int ret, i; int ret;
struct burn_drive_info *dinfo= NULL; struct burn_drive_info *dinfo= NULL;
struct burn_drive *drive= NULL; struct burn_drive *drive= NULL;
off_t pos, data_count, to_read; off_t pos, data_count, to_read;
@ -12422,11 +12423,8 @@ int Xorriso_check_md5_range(struct XorrisO *xorriso, off_t start_lba,
xorriso->pacifier_count, 0, "", 0); xorriso->pacifier_count, 0, "", 0);
} }
iso_md5_end(&ctx, data_md5); iso_md5_end(&ctx, data_md5);
for(i= 0; i < 16; i++)
if(md5[i] != data_md5[i])
break;
ret= 1; ret= 1;
if(i < 16 ) if(! iso_md5_match(md5, data_md5))
ret= 0; ret= 0;
ex:; ex:;
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);