From 1040bca293f762d6d8b5218cdab1ce0b8fc43e49 Mon Sep 17 00:00:00 2001 From: Landon Fuller Date: Tue, 28 Nov 2006 07:02:34 +0000 Subject: [PATCH] Fixed two bugs, the first of which is mine: - 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 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bacula/src/filed/restore.c b/bacula/src/filed/restore.c index 9ccf22e905..880890ad36 100644 --- a/bacula/src/filed/restore.c +++ b/bacula/src/filed/restore.c @@ -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; } -- 2.39.5