]> git.sur5r.net Git - bacula/bacula/commitdiff
Fixed two bugs, the first of which is mine:
authorLandon Fuller <landonf@opendarwin.org>
Tue, 28 Nov 2006 07:02:34 +0000 (07:02 +0000)
committerLandon Fuller <landonf@opendarwin.org>
Tue, 28 Nov 2006 07:02:34 +0000 (07:02 +0000)
    - If a signed digest was incorrectly written for a non-file, do not leak or attempt to validate the digest -- ignore it.
    - If no new data is encrypted, but the output buffer is not empty, there is still data that needs to be written -- don't exit.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3714 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/filed/restore.c

index 9ccf22e905e988d1516909f9d648558087c6768e..880890ad36909cc6b65fec9b225a4a8d9a3261a3 100644 (file)
@@ -523,7 +523,7 @@ void do_restore(JCR *jcr)
 
       case STREAM_SIGNED_DIGEST:
          /* Save signature. */
-         if ((sig = crypto_sign_decode((uint8_t *)sd->msg, (uint32_t)sd->msglen)) == NULL) {
+         if (extract && (sig = crypto_sign_decode((uint8_t *)sd->msg, (uint32_t)sd->msglen)) == NULL) {
             Jmsg1(jcr, M_ERROR, 0, _("Failed to decode message signature for %s\n"), jcr->last_fname);
          }
          break;
@@ -978,9 +978,8 @@ bool flush_cipher(JCR *jcr, BFILE *bfd, int flags, CIPHER_CONTEXT *cipher, uint3
       Jmsg1(jcr, M_FATAL, 0, _("Decryption error for %s\n"), jcr->last_fname);
    }
 
-   if (decrypted_len == 0)
-   {
-      ASSERT(jcr->crypto_count == 0);
+   /* If nothing new was decrypted, and our output buffer is empty, return */
+   if (decrypted_len == 0 && jcr->crypto_count == 0) {
       return true;
    }