Adapted to a change in iso_util_decode_md5_tag()

master
Thomas Schmitt 13 years ago
parent f155241628
commit 489a1b6c98
  1. 2
      xorriso/xorriso.c
  2. 2
      xorriso/xorriso_timestamp.h
  3. 110
      xorriso/xorrisoburn.c

@ -4597,7 +4597,7 @@ int Checkmediajob_new(struct CheckmediajoB **o, int flag)
m->map_with_volid= 0;
m->retry= 0;
m->report_mode= 0;
m->event_severity[0]= 0;
strcpy(m->event_severity, "ALL");
return(1);
}

@ -1 +1 @@
#define Xorriso_timestamP "2009.08.15.173403"
#define Xorriso_timestamP "2009.08.16.200906"

@ -9215,9 +9215,12 @@ int Xorriso_check_interval(struct XorrisO *xorriso, struct SpotlisT *spotlist,
double pre_read_time, post_read_time, time_diff, total_time_diff= 0;
double last_abort_file_time= 0;
struct stat stbuf;
void *ctx= NULL;
void *ctx= NULL, *cloned_ctx= NULL;
char md5[16], tag_md5[16];
uint32_t pos, range_start, range_size;
uint32_t pos, range_start, range_size, next_tag= 0, lba, md5_spot_lba;
int md5_spot_value= Xorriso_read_quality_untesteD, chain_broken= 0;
int tag_type= 0, valid, was_sb_tag= 0;
char *comparison= "", *sev_text= "DEBUG", *tag_type_name= "";
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to check media readability",
@ -9376,51 +9379,79 @@ abort_check:;
quality= Xorriso_read_quality_sloW;
}
/* MD5 checksumming */
if(ctx != NULL) {
for(j= 0; j < to_read; j++) {
ret= iso_util_decode_md5_tag(data + j * 2048, &pos, &range_start,
&range_size, tag_md5, 0);
if(ret == 1 && pos == i + j + from_lba) {
lba= i + j + from_lba;
if(lba < md5_start)
continue;
ret= 0;
if(lba > md5_start + 16 &&
(next_tag == 0 || chain_broken || lba == next_tag)) {
ret= iso_util_decode_md5_tag(data + j * 2048, &tag_type,
&pos, &range_start, &range_size,
&next_tag, tag_md5, !!chain_broken);
}
valid= (ret == 1 || ret == ISO_MD5_AREA_CORRUPTED);
if(valid && tag_type == 2 && pos == lba && lba < md5_start + 32) {
tag_type_name= "superblock";
was_sb_tag= 1;
}else if(valid && tag_type == 3 && pos == lba && was_sb_tag) {
tag_type_name= "tree";
}else if(valid && tag_type == 1 && pos == lba) {
/* >>> ??? allow this without superblock and tree tag ? */
tag_type_name= "session";
} else {
tag_type_name= "";
}
if (tag_type_name[0]) {
if(range_start != md5_start) {
sprintf(xorriso->info_text,
"Found MD5 checksum tag which covers different data range");
"Found MD5 %s tag which covers different data range",
tag_type_name);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE",0);
sprintf(xorriso->info_text,
" Expected: %u Found: %u",
(unsigned int) md5_start, range_start);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE",0);
chain_broken= 1;
} else {
iso_md5_end(&ctx, md5);
ret= iso_md5_clone(ctx, &cloned_ctx);
if(ret <= 0) {
Xorriso_no_malloc_memory(xorriso, NULL, 0);
ret= -1; goto ex;
}
iso_md5_end(&cloned_ctx, md5);
for(k= 0; k < 16; k++)
if(tag_md5[k] != md5[k])
break;
if(k < 16 ) {
ret= Spotlist_add_item(spotlist, md5_start,
i + j + from_lba - md5_start,
Xorriso_read_quality_md5_mismatcH, 0);
sprintf(xorriso->info_text,
"Found NON-MATCHING MD5 checksum tag: start=%d size=%d",
md5_start, i + j + from_lba - md5_start);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0,
"WARNING", 0);
if(ret == ISO_MD5_AREA_CORRUPTED) {
comparison= "CORRUPTED";
sev_text= "WARNING";
md5_spot_value= Xorriso_read_quality_md5_mismatcH;
chain_broken= 1;
} else if(k < 16 ) {
comparison= "NON-MATCHING";
sev_text= "WARNING";
md5_spot_value= Xorriso_read_quality_md5_mismatcH;
chain_broken= 1;
} else {
ret= Spotlist_add_item(spotlist, md5_start,
i + j + from_lba - md5_start,
Xorriso_read_quality_md5_matcH, 0);
sprintf(xorriso->info_text,
"Found matching MD5 checksum tag: start=%d size=%d",
md5_start, i + j + from_lba - md5_start);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE",
0);
comparison= "matching";
sev_text= "UPDATE";
md5_spot_value= Xorriso_read_quality_md5_matcH;
}
md5_spot_lba= lba;
sprintf(xorriso->info_text,
"Found %s MD5 %s tag: start=%d size=%d",
comparison, tag_type_name, md5_start, lba - md5_start);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0,
sev_text, 0);
}
} else {
/* >>> ??? warn if ret == ISO_MD5_AREA_CORRUPTED */;
if(from_lba + i + j >= md5_start)
iso_md5_compute(ctx, data + j * 2048, 2048);
}
iso_md5_compute(ctx, data + j * 2048, 2048);
}
}
@ -9482,6 +9513,25 @@ failed_to_write:;
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
}
/* MD5 checksumming : register result */
/* >>> ??? allow chain_broken to be a match ? */
if(next_tag > 0) {
sprintf(xorriso->info_text, "Missing announced MD5 tag: start=%d pos=%d",
md5_start, next_tag);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
md5_spot_value= Xorriso_read_quality_md5_mismatcH;
md5_spot_lba= next_tag;
}
if(md5_spot_value != Xorriso_read_quality_untesteD) {
ret= Spotlist_add_item(spotlist, md5_start, md5_spot_lba - md5_start,
md5_spot_value, 0);
if(ret <= 0)
goto ex;
}
ret= 1;
ex:
if(ctx != NULL)

Loading…
Cancel
Save