Better messages when aborting iso_image_import() due to checksum failure.
This commit is contained in:
parent
8b800094af
commit
363a39af3e
@ -2323,8 +2323,8 @@ int iso_src_check_sb_tree(IsoDataSource *src, uint32_t start_lba, int flag)
|
|||||||
/* Relocated Superblock: restart checking at real session start */
|
/* Relocated Superblock: restart checking at real session start */
|
||||||
if (next_tag < 32) {
|
if (next_tag < 32) {
|
||||||
/* Non plausible session_start address */
|
/* Non plausible session_start address */
|
||||||
iso_msg_submit(-1, ret, 0, NULL);
|
|
||||||
ret = ISO_SB_TREE_CORRUPTED;
|
ret = ISO_SB_TREE_CORRUPTED;
|
||||||
|
iso_msg_submit(-1, ret, 0, NULL);
|
||||||
goto ex;
|
goto ex;
|
||||||
}
|
}
|
||||||
/* Check real session */
|
/* Check real session */
|
||||||
@ -2422,13 +2422,15 @@ int iso_image_filesystem_new(IsoDataSource *src, struct iso_read_opts *opts,
|
|||||||
#ifdef Libisofs_with_checksumS
|
#ifdef Libisofs_with_checksumS
|
||||||
|
|
||||||
if (data->md5_load) {
|
if (data->md5_load) {
|
||||||
|
|
||||||
/* From opts->block on : check for superblock and tree tags */;
|
/* From opts->block on : check for superblock and tree tags */;
|
||||||
ret = iso_src_check_sb_tree(src, opts->block, 0);
|
ret = iso_src_check_sb_tree(src, opts->block, 0);
|
||||||
if (ret <= 0) {
|
if (ret < 0) {
|
||||||
|
iso_msgs_submit(0,
|
||||||
/* >>> refuse to load, hint towards loading without MD5 check */;
|
"Image loading aborted due to MD5 mismatch of image tree data",
|
||||||
|
0, "FAILURE", 0);
|
||||||
|
iso_msgs_submit(0,
|
||||||
|
"You may override this refusal by disabling MD5 checking",
|
||||||
|
0, "HINT", 0);
|
||||||
goto fs_cleanup;
|
goto fs_cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -277,6 +277,14 @@ const char *iso_error_to_msg(int errcode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int iso_msg_is_abort(int errcode)
|
||||||
|
{
|
||||||
|
if (ISO_ERR_SEV(errcode) >= abort_threshold)
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int iso_msg_submit(int imgid, int errcode, int causedby, const char *fmt, ...)
|
int iso_msg_submit(int imgid, int errcode, int causedby, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
char msg[MAX_MSG_LEN];
|
char msg[MAX_MSG_LEN];
|
||||||
@ -307,7 +315,7 @@ int iso_msg_submit(int imgid, int errcode, int causedby, const char *fmt, ...)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ISO_ERR_SEV(errcode) >= abort_threshold) {
|
if (iso_msg_is_abort(errcode)) {
|
||||||
return ISO_CANCELED;
|
return ISO_CANCELED;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -24,6 +24,13 @@ extern int iso_message_id;
|
|||||||
*/
|
*/
|
||||||
void iso_msg_debug(int imgid, const char *fmt, ...);
|
void iso_msg_debug(int imgid, const char *fmt, ...);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inquire whether the given error code triggers the abort threshold
|
||||||
|
*/
|
||||||
|
int iso_msg_is_abort(int errcode);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param errcode
|
* @param errcode
|
||||||
@ -33,7 +40,7 @@ void iso_msg_debug(int imgid, const char *fmt, ...);
|
|||||||
* < 0 will be returned in any case. Use 0 if there is no previous
|
* < 0 will be returned in any case. Use 0 if there is no previous
|
||||||
* cause for the error.
|
* cause for the error.
|
||||||
* @return
|
* @return
|
||||||
* 1 on success, < 0 if function must abort asap.
|
* 0 on success, < 0 if function must abort asap.
|
||||||
*/
|
*/
|
||||||
int iso_msg_submit(int imgid, int errcode, int causedby, const char *fmt, ...);
|
int iso_msg_submit(int imgid, int errcode, int causedby, const char *fmt, ...);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user