From 521a0acb2e380da2345406d681f744a93c293c01 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 8 Jul 2020 09:19:24 +0200 Subject: [PATCH] DataStore::load_manifest: also return CryptMode Signed-off-by: Wolfgang Bumiller --- src/api2/admin/datastore.rs | 4 ++-- src/backup/datastore.rs | 9 +++++++-- src/backup/verify.rs | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs index abe5af95..66776ef6 100644 --- a/src/api2/admin/datastore.rs +++ b/src/api2/admin/datastore.rs @@ -46,7 +46,7 @@ fn check_backup_owner(store: &DataStore, group: &BackupGroup, userid: &str) -> R fn read_backup_index(store: &DataStore, backup_dir: &BackupDir) -> Result, Error> { - let (manifest, index_size) = store.load_manifest(backup_dir)?; + let (manifest, manifest_crypt_mode, index_size) = store.load_manifest(backup_dir)?; let mut result = Vec::new(); for item in manifest.files() { @@ -59,7 +59,7 @@ fn read_backup_index(store: &DataStore, backup_dir: &BackupDir) -> Result Result<(BackupManifest, u64), Error> { + pub fn load_manifest( + &self, + backup_dir: &BackupDir, + ) -> Result<(BackupManifest, CryptMode, u64), Error> { let (blob, raw_size) = self.load_blob(backup_dir, MANIFEST_BLOB_NAME)?; + let crypt_mode = blob.crypt_mode()?; let manifest = BackupManifest::try_from(blob)?; - Ok((manifest, raw_size)) + Ok((manifest, crypt_mode, raw_size)) } } diff --git a/src/backup/verify.rs b/src/backup/verify.rs index ac21de62..3d9ff7bd 100644 --- a/src/backup/verify.rs +++ b/src/backup/verify.rs @@ -101,7 +101,7 @@ fn verify_dynamic_index(datastore: &DataStore, backup_dir: &BackupDir, info: &Fi pub fn verify_backup_dir(datastore: &DataStore, backup_dir: &BackupDir, worker: &WorkerTask) -> Result { let manifest = match datastore.load_manifest(&backup_dir) { - Ok((manifest, _)) => manifest, + Ok((manifest, _crypt_mode, _)) => manifest, Err(err) => { worker.log(format!("verify {}:{} - manifest load error: {}", datastore.name(), backup_dir, err)); return Ok(false);