From: Alain Spineux Date: Tue, 22 Nov 2022 09:41:24 +0000 (+0100) Subject: Fix #9689 VolumeEncryption parameters must be yes|no|strong X-Git-Tag: Beta-15.0.0~343 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b39bed2a77c3f613bc1fd8233c41ee53d91e10a;p=thirdparty%2Fbacula.git Fix #9689 VolumeEncryption parameters must be yes|no|strong --- diff --git a/bacula/src/stored/block.c b/bacula/src/stored/block.c index 1e2fca506..f6c6ea493 100644 --- a/bacula/src/stored/block.c +++ b/bacula/src/stored/block.c @@ -74,11 +74,9 @@ bool DCR::write_block_to_device(bool final) ok = false; goto bail_out; /* fatal error */ } - if (dcr->despooling && dev->device->volume_encryption!=ET_NONE && dev->crypto_device_ctx!=NULL) { -// DEVICE *old = block->dev; + if (dcr->despooling && dev->device->volume_encryption != ET_NO + && dev->crypto_device_ctx!=NULL) { block->dev = dev; -// uint64_t checksum = ser_block_header(block, dev->do_checksum()); -// block->dev = old; } Dmsg1(500, "Write block to dev=%p\n", dcr->dev); diff --git a/bacula/src/stored/block_util.c b/bacula/src/stored/block_util.c index 5028130cc..02d4d5f06 100644 --- a/bacula/src/stored/block_util.c +++ b/bacula/src/stored/block_util.c @@ -384,7 +384,7 @@ uint64_t ser_block_header(DEV_BLOCK *block, bool do_checksum) ser_declare; uint32_t block_len = block->binbuf; uint32_t hdr_option = 0x0; - bool do_encrypt_vol = dev->device->volume_encryption!=ET_NONE && dev->crypto_device_ctx!=NULL; + bool do_encrypt_vol = dev->device->volume_encryption != ET_NO && dev->crypto_device_ctx != NULL; bool do_encrypt_block = do_encrypt_vol && !block->first_block; hdr_option |= (do_checksum?BLKHOPT_CHKSUM:0) | (do_encrypt_vol?BLKHOPT_ENCRYPT_VOL:0) | diff --git a/bacula/src/stored/dev.c b/bacula/src/stored/dev.c index 9e3ab5dcb..8b33b2fc6 100644 --- a/bacula/src/stored/dev.c +++ b/bacula/src/stored/dev.c @@ -1175,7 +1175,7 @@ bool DEVICE::get_tape_worm(DCR *dcr) int DEVICE::use_volume_encryption() { - return device->volume_encryption != ET_NONE; + return device->volume_encryption != ET_NO; }; bool DEVICE::load_encryption_key(DCR *dcr, const char *operation, @@ -1194,7 +1194,8 @@ bool DEVICE::load_encryption_key(DCR *dcr, const char *operation, } /* don't use encryption if volume encryption is not enable or we are reading * (aka not recycling) a BB02 volume */ - if (device->volume_encryption == ET_NONE || (op != op_label && !(VolHdr.blkh_options & BLKHOPT_ENCRYPT_VOL))) { + if (device->volume_encryption == ET_NO + || (op != op_label && !(VolHdr.blkh_options & BLKHOPT_ENCRYPT_VOL))) { return ok; } JCR *jcr = dcr->jcr; diff --git a/bacula/src/stored/stored_conf.c b/bacula/src/stored/stored_conf.c index 00c3cafbd..01dda27e0 100644 --- a/bacula/src/stored/stored_conf.c +++ b/bacula/src/stored/stored_conf.c @@ -297,9 +297,9 @@ s_kw dev_types[] = { * encryption type encryption code = token */ s_kw enc_types[] = { - {"None", ET_NONE}, - {"Enable", ET_ENABLE}, - {"Strong", ET_STRONG}, + {"No", ET_NO}, + {"Yes", ET_YES}, + {"Strong", ET_STRONG}, {NULL, 0} }; diff --git a/bacula/src/stored/stored_conf.h b/bacula/src/stored/stored_conf.h index ccb1d9573..ebadb8b87 100644 --- a/bacula/src/stored/stored_conf.h +++ b/bacula/src/stored/stored_conf.h @@ -300,7 +300,7 @@ extern s_kw enc_types[]; /* Encryption type */ enum { - ET_NONE, - ET_ENABLE, + ET_NO, + ET_YES, ET_STRONG, };