From: Eric Bollengier Date: Tue, 13 Oct 2020 08:50:33 +0000 (+0200) Subject: Add support for SHA256/512 in Verify Jobs X-Git-Tag: Release-11.3.2~1003 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bff3661b25f9d9c8b8ca21bc1fc7867f0fef50b8;p=thirdparty%2Fbacula.git Add support for SHA256/512 in Verify Jobs --- diff --git a/bacula/src/dird/inc_conf.c b/bacula/src/dird/inc_conf.c index cde6465da..c7d97c5cf 100644 --- a/bacula/src/dird/inc_conf.c +++ b/bacula/src/dird/inc_conf.c @@ -273,11 +273,11 @@ static void scan_include_options(LEX *lc, int keyword, char *opts, int optlen) /* Check if the options are correct */ switch(keyword) { case INC_KW_VERIFY: - fs_options = "ipnugsamcd51:V"; /* From dird/verify.c */ + fs_options = "ipnugsamcd5123:V"; /* From dird/verify.c */ break; case INC_KW_BASEJOB: case INC_KW_ACCURATE: - fs_options = "ipnugsamMcdA51:JC"; /* From filed/accurate.c accurate_check_file() */ + fs_options = "ipnugsamMcdA5123:JC"; /* From filed/accurate.c accurate_check_file() */ break; default: break; diff --git a/bacula/src/dird/verify.c b/bacula/src/dird/verify.c index 392ab7e0c..6100255ef 100644 --- a/bacula/src/dird/verify.c +++ b/bacula/src/dird/verify.c @@ -798,6 +798,12 @@ void get_attributes_and_compare_to_catalog(JCR *jcr, JobId_t JobId) case '1': /* compare SHA1 */ do_Digest = CRYPTO_DIGEST_SHA1; break; + case '2': /* compare SHA256 */ + do_Digest = CRYPTO_DIGEST_SHA256; + break; + case '3': /* compare SHA512 */ + do_Digest = CRYPTO_DIGEST_SHA512; + break; case ':': case 'V': default: @@ -815,7 +821,7 @@ void get_attributes_and_compare_to_catalog(JCR *jcr, JobId_t JobId) * preceded by an attributes record, which sets attr_file_index */ if (jcr->FileIndex != file_index) { - Jmsg2(jcr, M_FATAL, 0, _("MD5/SHA1 index %d not same as attributes %d\n"), + Jmsg2(jcr, M_FATAL, 0, _("MD5/SHA index %d not same as attributes %d\n"), file_index, jcr->FileIndex); free_pool_memory(fname); return; diff --git a/bacula/src/filed/verify_vol.c b/bacula/src/filed/verify_vol.c index 754c3f4a7..91c2471a5 100644 --- a/bacula/src/filed/verify_vol.c +++ b/bacula/src/filed/verify_vol.c @@ -144,6 +144,8 @@ void v_ctx::scan_fileset() findFOPTS *fo = (findFOPTS *)incexe->opts_list.get(j); check_size = (strchr(fo->VerifyOpts, 's') != NULL); if ((strchr(fo->VerifyOpts, '1') != NULL) || + (strchr(fo->VerifyOpts, '2') != NULL) || + (strchr(fo->VerifyOpts, '3') != NULL) || (strchr(fo->VerifyOpts, '5') != NULL)) { check_chksum = true;