From 0c1d78b597f0ae98887fe5b23123994e3aeba0b8 Mon Sep 17 00:00:00 2001 From: Landon Fuller Date: Sun, 10 Dec 2006 01:37:49 +0000 Subject: [PATCH] Fix job byte reporting -- the digest code runs in verify.c and increases this value. The better solution is to digest the stream as we receive it, thus removing the need to re-read from disk at all, but that requires more extensive and potentially destabilizing changes. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3786 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/filed/restore.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bacula/src/filed/restore.c b/bacula/src/filed/restore.c index 16514cb29e..efa696c2f9 100644 --- a/bacula/src/filed/restore.c +++ b/bacula/src/filed/restore.c @@ -775,7 +775,8 @@ static int do_file_digest(FF_PKT *ff_pkt, void *pkt, bool top_level) * Verify the signature for the last restored file * Return value is either true (signature correct) * or false (signature could not be verified). - * TODO landonf: Better signature failure handling. + * TODO landonf: Implement without using find_one_file and + * without re-reading the file. */ int verify_signature(JCR *jcr, SIGNATURE *sig) { @@ -793,10 +794,13 @@ int verify_signature(JCR *jcr, SIGNATURE *sig) jcr->digest = digest; /* Checksum the entire file */ + uint64_t saved_bytes = jcr->JobBytes; if (find_one_file(jcr, jcr->ff, do_file_digest, jcr, jcr->last_fname, (dev_t)-1, 1) != 0) { Jmsg(jcr, M_ERROR, 0, _("Signature validation failed for %s: \n"), jcr->last_fname); + jcr->JobBytes = saved_bytes; return false; } + jcr->JobBytes = saved_bytes; /* Verify the signature */ if ((err = crypto_sign_verify(sig, keypair, digest)) != CRYPTO_ERROR_NONE) { -- 2.39.5