]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix job byte reporting -- the digest code runs in verify.c and increases this value.
authorLandon Fuller <landonf@opendarwin.org>
Sun, 10 Dec 2006 01:37:49 +0000 (01:37 +0000)
committerLandon Fuller <landonf@opendarwin.org>
Sun, 10 Dec 2006 01:37:49 +0000 (01:37 +0000)
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

index 16514cb29e4dc6e146a176dbf42bdc507eae85e1..efa696c2f9f602fac8e296b6bbd4f11e9701c665 100644 (file)
@@ -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) {