From: Landon Fuller Date: Sat, 9 Dec 2006 23:50:00 +0000 (+0000) Subject: This commit fixes backup and restore of HFS+ resource forks. X-Git-Tag: Release-2.0.0~132 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=08d49bde027b1a4a332e99cceb68c0434180c2b5;p=bacula%2Fbacula This commit fixes backup and restore of HFS+ resource forks. Unrelated to the above, I added a long-missing 'break' statement in HFS+ attribute handling that resulted in restore failures. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3785 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/filed/backup.c b/bacula/src/filed/backup.c index f7a09ffb68..8cb9f63713 100644 --- a/bacula/src/filed/backup.c +++ b/bacula/src/filed/backup.c @@ -462,6 +462,7 @@ static int save_file(FF_PKT *ff_pkt, void *vjcr, bool top_level) ff_pkt->flags & FO_HFSPLUS)) { if (ff_pkt->hfsinfo.rsrclength > 0) { int flags; + int rsrc_stream; if (!bopen_rsrc(&ff_pkt->bfd, ff_pkt->fname, O_RDONLY | O_BINARY, 0) < 0) { ff_pkt->ff_errno = errno; berrno be; @@ -475,7 +476,12 @@ static int save_file(FF_PKT *ff_pkt, void *vjcr, bool top_level) } flags = ff_pkt->flags; ff_pkt->flags &= ~(FO_GZIP|FO_SPARSE); - stat = send_data(jcr, STREAM_MACOS_FORK_DATA, ff_pkt, digest, signing_digest); + if (flags & FO_ENCRYPT) { + rsrc_stream = STREAM_ENCRYPTED_MACOS_FORK_DATA; + } else { + rsrc_stream = STREAM_MACOS_FORK_DATA; + } + stat = send_data(jcr, rsrc_stream, ff_pkt, digest, signing_digest); ff_pkt->flags = flags; bclose(&ff_pkt->bfd); if (!stat) { diff --git a/bacula/src/filed/restore.c b/bacula/src/filed/restore.c index c2cebe8416..16514cb29e 100644 --- a/bacula/src/filed/restore.c +++ b/bacula/src/filed/restore.c @@ -58,11 +58,19 @@ const bool have_libz = true; const bool have_libz = false; #endif +typedef struct restore_cipher_ctx { + CIPHER_CONTEXT *cipher; + uint32_t block_size; + + POOLMEM *buf; /* Pointer to descryption buffer */ + int32_t buf_len; /* Count of bytes currently in buf */ + int32_t packet_len; /* Total bytes in packet */ +} RESTORE_CIPHER_CTX; + int verify_signature(JCR *jcr, SIGNATURE *sig); int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen, - uint64_t *addr, int flags, CIPHER_CONTEXT *cipher, uint32_t cipher_block_size); -bool flush_cipher(JCR *jcr, BFILE *bfd, uint64_t *addr, int flags, CIPHER_CONTEXT *cipher, - uint32_t cipher_block_size); + uint64_t *addr, int flags, RESTORE_CIPHER_CTX *cipher_ctx); +bool flush_cipher(JCR *jcr, BFILE *bfd, uint64_t *addr, int flags, RESTORE_CIPHER_CTX *cipher_ctx); #define RETRY 10 /* retry wait time */ @@ -98,18 +106,19 @@ void do_restore(JCR *jcr) uint32_t VolSessionId, VolSessionTime; bool extract = false; int32_t file_index; - char ec1[50]; /* Buffer printing huge values */ - BFILE bfd; /* File content */ - uint64_t fileAddr = 0; /* file write address */ - uint32_t size; /* Size of file */ - BFILE altbfd; /* Alternative data stream */ - uint64_t alt_addr = 0; /* Write address for alternative stream */ - intmax_t alt_size = 0; /* Size of alternate stream */ - SIGNATURE *sig = NULL; /* Cryptographic signature (if any) for file */ - CRYPTO_SESSION *cs = NULL; /* Cryptographic session data (if any) for file */ - CIPHER_CONTEXT *cipher_ctx = NULL; /* Cryptographic cipher context (if any) for file */ - uint32_t cipher_block_size = 0; /* Cryptographic algorithm block size for file */ - int flags = 0; /* Options for extract_data() */ + char ec1[50]; /* Buffer printing huge values */ + BFILE bfd; /* File content */ + uint64_t fileAddr = 0; /* file write address */ + uint32_t size; /* Size of file */ + BFILE altbfd; /* Alternative data stream */ + uint64_t alt_addr = 0; /* Write address for alternative stream */ + intmax_t alt_size = 0; /* Size of alternate stream */ + SIGNATURE *sig = NULL; /* Cryptographic signature (if any) for file */ + CRYPTO_SESSION *cs = NULL; /* Cryptographic session data (if any) for file */ + RESTORE_CIPHER_CTX cipher_ctx; /* Cryptographic restore context (if any) for file */ + RESTORE_CIPHER_CTX alt_cipher_ctx; /* Cryptographic restore context (if any) for alternative stream */ + int flags = 0; /* Options for extract_data() */ + int alt_flags = 0; /* Options for extract_data() */ int stat; ATTR *attr; @@ -180,9 +189,15 @@ void do_restore(JCR *jcr) } if (have_crypto) { - jcr->crypto_buf = get_memory(CRYPTO_CIPHER_MAX_BLOCK_SIZE); - jcr->crypto_buf_len = 0; - jcr->crypto_packet_len = 0; + cipher_ctx.cipher = NULL; + cipher_ctx.buf = get_memory(CRYPTO_CIPHER_MAX_BLOCK_SIZE); + cipher_ctx.buf_len = 0; + cipher_ctx.packet_len = 0; + + cipher_ctx.cipher = NULL; + alt_cipher_ctx.buf = get_memory(CRYPTO_CIPHER_MAX_BLOCK_SIZE); + alt_cipher_ctx.buf_len = 0; + alt_cipher_ctx.packet_len = 0; } /* @@ -244,6 +259,11 @@ void do_restore(JCR *jcr) /* If we change streams, close and reset alternate data streams */ if (prev_stream != stream) { if (is_bopen(&altbfd)) { + if (alt_cipher_ctx.cipher) { + flush_cipher(jcr, &altbfd, &alt_addr, alt_flags, &alt_cipher_ctx); + crypto_cipher_free(alt_cipher_ctx.cipher); + alt_cipher_ctx.cipher = NULL; + } bclose_chksize(jcr, &altbfd, alt_size); } alt_size = -1; /* Use an impossible value and set a proper one below */ @@ -263,10 +283,17 @@ void do_restore(JCR *jcr) Jmsg0(jcr, M_ERROR, 0, _("Logic error: output file should be open\n")); } /* Flush and deallocate previous stream's cipher context */ - if (cipher_ctx && prev_stream != STREAM_ENCRYPTED_SESSION_DATA) { - flush_cipher(jcr, &bfd, &fileAddr, flags, cipher_ctx, cipher_block_size); - crypto_cipher_free(cipher_ctx); - cipher_ctx = NULL; + if (cipher_ctx.cipher && prev_stream != STREAM_ENCRYPTED_SESSION_DATA) { + flush_cipher(jcr, &bfd, &fileAddr, flags, &cipher_ctx); + crypto_cipher_free(cipher_ctx.cipher); + cipher_ctx.cipher = NULL; + } + + /* Flush and deallocate previous stream's alt cipher context */ + if (alt_cipher_ctx.cipher && prev_stream != STREAM_ENCRYPTED_SESSION_DATA) { + flush_cipher(jcr, &altbfd, &alt_addr, alt_flags, &alt_cipher_ctx); + crypto_cipher_free(alt_cipher_ctx.cipher); + alt_cipher_ctx.cipher = NULL; } set_attributes(jcr, attr, &bfd); extract = false; @@ -289,6 +316,7 @@ void do_restore(JCR *jcr) crypto_session_free(cs); cs = NULL; } + jcr->ff->flags = 0; Dmsg0(30, "Stop extracting.\n"); } else if (is_bopen(&bfd)) { Jmsg0(jcr, M_ERROR, 0, _("Logic error: output file should not be open\n")); @@ -397,7 +425,7 @@ void do_restore(JCR *jcr) } /* Set up a decryption context */ - if ((cipher_ctx = crypto_cipher_new(cs, false, &cipher_block_size)) == NULL) { + if ((cipher_ctx.cipher = crypto_cipher_new(cs, false, &cipher_ctx.block_size)) == NULL) { Jmsg1(jcr, M_ERROR, 0, _("Failed to initialize decryption context for %s\n"), jcr->last_fname); crypto_session_free(cs); cs = NULL; @@ -446,8 +474,8 @@ void do_restore(JCR *jcr) flags |= FO_WIN32DECOMP; /* "decompose" BackupWrite data */ } - if (extract_data(jcr, &bfd, sd->msg, sd->msglen, &fileAddr, flags, - cipher_ctx, cipher_block_size) < 0) { + if (extract_data(jcr, &bfd, sd->msg, sd->msglen, &fileAddr, flags, + &cipher_ctx) < 0) { extract = false; bclose(&bfd); continue; @@ -458,9 +486,26 @@ void do_restore(JCR *jcr) /* Resource fork stream - only recorded after a file to be restored */ /* Silently ignore if we cannot write - we already reported that */ case STREAM_ENCRYPTED_MACOS_FORK_DATA: - flags |= FO_ENCRYPT; case STREAM_MACOS_FORK_DATA: #ifdef HAVE_DARWIN_OS + alt_flags = 0; + jcr->ff->flags |= FO_HFSPLUS; + + if (stream == STREAM_ENCRYPTED_MACOS_FORK_DATA) { + alt_flags |= FO_ENCRYPT; + + /* Set up a decryption context */ + if (!alt_cipher_ctx.cipher) { + if ((alt_cipher_ctx.cipher = crypto_cipher_new(cs, false, &alt_cipher_ctx.block_size)) == NULL) { + Jmsg1(jcr, M_ERROR, 0, _("Failed to initialize decryption context for %s\n"), jcr->last_fname); + crypto_session_free(cs); + cs = NULL; + extract = false; + continue; + } + } + } + if (extract) { if (prev_stream != stream) { if (bopen_rsrc(&altbfd, jcr->last_fname, O_WRONLY | O_TRUNC | O_BINARY, 0) < 0) { @@ -468,12 +513,13 @@ void do_restore(JCR *jcr) extract = false; continue; } + alt_size = rsrc_len; Dmsg0(30, "Restoring resource fork\n"); } - flags = 0; - if (extract_data(jcr, &altbfd, sd->msg, sd->msglen, &alt_addr, flags, - cipher_ctx, cipher_block_size) < 0) { + + if (extract_data(jcr, &altbfd, sd->msg, sd->msglen, &alt_addr, alt_flags, + &alt_cipher_ctx) < 0) { extract = false; bclose(&altbfd); continue; @@ -487,6 +533,7 @@ void do_restore(JCR *jcr) case STREAM_HFSPLUS_ATTRIBUTES: #ifdef HAVE_DARWIN_OS Dmsg0(30, "Restoring Finder Info\n"); + jcr->ff->flags |= FO_HFSPLUS; if (sd->msglen != 32) { Jmsg(jcr, M_ERROR, 0, _(" Invalid length of Finder Info (got %d, not 32)\n"), sd->msglen); continue; @@ -498,6 +545,7 @@ void do_restore(JCR *jcr) #else non_support_finfo++; #endif + break; case STREAM_UNIX_ATTRIBUTES_ACCESS_ACL: #ifdef HAVE_ACL @@ -552,11 +600,19 @@ void do_restore(JCR *jcr) Jmsg0(jcr, M_ERROR, 0, _("Logic error: output file should be open\n")); } /* Flush and deallocate cipher context */ - if (cipher_ctx) { - flush_cipher(jcr, &bfd, &fileAddr, flags, cipher_ctx, cipher_block_size); - crypto_cipher_free(cipher_ctx); - cipher_ctx = NULL; + if (cipher_ctx.cipher) { + flush_cipher(jcr, &bfd, &fileAddr, flags, &cipher_ctx); + crypto_cipher_free(cipher_ctx.cipher); + cipher_ctx.cipher = NULL; + } + + /* Flush and deallocate alt cipher context */ + if (alt_cipher_ctx.cipher) { + flush_cipher(jcr, &altbfd, &alt_addr, alt_flags, &alt_cipher_ctx); + crypto_cipher_free(alt_cipher_ctx.cipher); + alt_cipher_ctx.cipher = NULL; } + set_attributes(jcr, attr, &bfd); /* Verify the cryptographic signature if any */ @@ -589,11 +645,19 @@ void do_restore(JCR *jcr) } if (extract) { /* Flush and deallocate cipher context */ - if (cipher_ctx) { - flush_cipher(jcr, &bfd, &fileAddr, flags, cipher_ctx, cipher_block_size); - crypto_cipher_free(cipher_ctx); - cipher_ctx = NULL; + if (cipher_ctx.cipher) { + flush_cipher(jcr, &bfd, &fileAddr, flags, &cipher_ctx); + crypto_cipher_free(cipher_ctx.cipher); + cipher_ctx.cipher = NULL; } + + /* Flush and deallocate alt cipher context */ + if (alt_cipher_ctx.cipher) { + flush_cipher(jcr, &altbfd, &alt_addr, alt_flags, &alt_cipher_ctx); + crypto_cipher_free(alt_cipher_ctx.cipher); + alt_cipher_ctx.cipher = NULL; + } + set_attributes(jcr, attr, &bfd); /* Verify the cryptographic signature on the last file, if any */ @@ -627,19 +691,32 @@ ok_out: crypto_session_free(cs); cs = NULL; } - if (cipher_ctx) { - crypto_cipher_free(cipher_ctx); - cipher_ctx = NULL; + + /* Free file cipher restore context */ + if (cipher_ctx.cipher) { + crypto_cipher_free(cipher_ctx.cipher); + cipher_ctx.cipher = NULL; + } + if (cipher_ctx.buf) { + free_pool_memory(cipher_ctx.buf); + cipher_ctx.buf = NULL; + } + + /* Free alternate stream cipher restore context */ + if (alt_cipher_ctx.cipher) { + crypto_cipher_free(alt_cipher_ctx.cipher); + alt_cipher_ctx.cipher = NULL; } + if (alt_cipher_ctx.buf) { + free_pool_memory(alt_cipher_ctx.buf); + alt_cipher_ctx.buf = NULL; + } + if (jcr->compress_buf) { free(jcr->compress_buf); jcr->compress_buf = NULL; jcr->compress_buf_size = 0; } - if (jcr->crypto_buf) { - free_pool_memory(jcr->crypto_buf); - jcr->crypto_buf = NULL; - } bclose(&altbfd); bclose(&bfd); free_attr(attr); @@ -717,14 +794,14 @@ int verify_signature(JCR *jcr, SIGNATURE *sig) /* Checksum the entire file */ if (find_one_file(jcr, jcr->ff, do_file_digest, jcr, jcr->last_fname, (dev_t)-1, 1) != 0) { - Qmsg(jcr, M_ERROR, 0, _("Signature validation failed for %s: \n"), jcr->last_fname); + Jmsg(jcr, M_ERROR, 0, _("Signature validation failed for %s: \n"), jcr->last_fname); return false; } /* Verify the signature */ if ((err = crypto_sign_verify(sig, keypair, digest)) != CRYPTO_ERROR_NONE) { Dmsg1(100, "Bad signature on %s\n", jcr->last_fname); - Qmsg2(jcr, M_ERROR, 0, _("Signature validation failed for %s: %s\n"), jcr->last_fname, crypto_strerror(err)); + Jmsg2(jcr, M_ERROR, 0, _("Signature validation failed for %s: %s\n"), jcr->last_fname, crypto_strerror(err)); crypto_digest_free(digest); return false; } @@ -805,13 +882,13 @@ bool decompress_data(JCR *jcr, char **data, uint32_t *length) #endif } -static void unser_crypto_packet_len(JCR *jcr) +static void unser_crypto_packet_len(RESTORE_CIPHER_CTX *ctx) { unser_declare; - if (jcr->crypto_packet_len == 0 && jcr->crypto_buf_len >= CRYPTO_LEN_SIZE) { - unser_begin(&jcr->crypto_buf[0], CRYPTO_LEN_SIZE); - unser_uint32(jcr->crypto_packet_len); - jcr->crypto_packet_len += CRYPTO_LEN_SIZE; + if (ctx->packet_len == 0 && ctx->buf_len >= CRYPTO_LEN_SIZE) { + unser_begin(&ctx->buf[0], CRYPTO_LEN_SIZE); + unser_uint32(ctx->packet_len); + ctx->packet_len += CRYPTO_LEN_SIZE; } } @@ -841,7 +918,7 @@ bool store_data(JCR *jcr, BFILE *bfd, char *data, const int32_t length, bool win * Return value is the number of bytes written, or -1 on errors. */ int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen, - uint64_t *addr, int flags, CIPHER_CONTEXT *cipher, uint32_t cipher_block_size) + uint64_t *addr, int flags, RESTORE_CIPHER_CTX *cipher_ctx) { char *wbuf; /* write buffer */ uint32_t wsize; /* write size */ @@ -855,7 +932,7 @@ int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen, wbuf = buf; if (flags & FO_ENCRYPT) { - ASSERT(cipher); + ASSERT(cipher_ctx->cipher); /* NOTE: We must implement block preserving semantics for the * non-streaming compression and sparse code. */ @@ -865,14 +942,14 @@ int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen, * crypto_cipher_update() will process only whole blocks, * buffering the remaining input. */ - jcr->crypto_buf = check_pool_memory_size(jcr->crypto_buf, - jcr->crypto_buf_len + wsize + cipher_block_size); + cipher_ctx->buf = check_pool_memory_size(cipher_ctx->buf, + cipher_ctx->buf_len + wsize + cipher_ctx->block_size); /* Decrypt the input block */ - if (!crypto_cipher_update(cipher, + if (!crypto_cipher_update(cipher_ctx->cipher, (const u_int8_t *)wbuf, wsize, - (u_int8_t *)&jcr->crypto_buf[jcr->crypto_buf_len], + (u_int8_t *)&cipher_ctx->buf[cipher_ctx->buf_len], &decrypted_len)) { /* Decryption failed. Shouldn't happen. */ Jmsg(jcr, M_FATAL, 0, _("Decryption error\n")); @@ -886,26 +963,26 @@ int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen, Dmsg2(100, "decrypted len=%d encrypted len=%d\n", decrypted_len, wsize); - jcr->crypto_buf_len += decrypted_len; - wbuf = jcr->crypto_buf; + cipher_ctx->buf_len += decrypted_len; + wbuf = cipher_ctx->buf; /* If one full preserved block is available, write it to disk, * and then buffer any remaining data. This should be effecient * as long as Bacula's block size is not significantly smaller than the * encryption block size (extremely unlikely!) */ - unser_crypto_packet_len(jcr); - Dmsg1(500, "Crypto unser block size=%d\n", jcr->crypto_packet_len - CRYPTO_LEN_SIZE); + unser_crypto_packet_len(cipher_ctx); + Dmsg1(500, "Crypto unser block size=%d\n", cipher_ctx->packet_len - CRYPTO_LEN_SIZE); - if (jcr->crypto_packet_len == 0 || jcr->crypto_buf_len < jcr->crypto_packet_len) { + if (cipher_ctx->packet_len == 0 || cipher_ctx->buf_len < cipher_ctx->packet_len) { /* No full preserved block is available. */ return 0; } /* We have one full block, set up the filter input buffers */ - wsize = jcr->crypto_packet_len - CRYPTO_LEN_SIZE; + wsize = cipher_ctx->packet_len - CRYPTO_LEN_SIZE; wbuf = &wbuf[CRYPTO_LEN_SIZE]; /* Skip the block length header */ - jcr->crypto_buf_len -= jcr->crypto_packet_len; - Dmsg2(30, "Encryption writing full block, %u bytes, remaining %u bytes in buffer\n", wsize, jcr->crypto_buf_len); + cipher_ctx->buf_len -= cipher_ctx->packet_len; + Dmsg2(30, "Encryption writing full block, %u bytes, remaining %u bytes in buffer\n", wsize, cipher_ctx->buf_len); } if (flags & FO_SPARSE) { @@ -932,14 +1009,14 @@ int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen, /* Clean up crypto buffers */ if (flags & FO_ENCRYPT) { /* Move any remaining data to start of buffer */ - if (jcr->crypto_buf_len > 0) { - Dmsg1(30, "Moving %u buffered bytes to start of buffer\n", jcr->crypto_buf_len); - memmove(jcr->crypto_buf, &jcr->crypto_buf[jcr->crypto_packet_len], - jcr->crypto_buf_len); + if (cipher_ctx->buf_len > 0) { + Dmsg1(30, "Moving %u buffered bytes to start of buffer\n", cipher_ctx->buf_len); + memmove(cipher_ctx->buf, &cipher_ctx->buf[cipher_ctx->packet_len], + cipher_ctx->buf_len); } /* The packet was successfully written, reset the length so that the next * packet length may be re-read by unser_crypto_packet_len() */ - jcr->crypto_packet_len = 0; + cipher_ctx->packet_len = 0; } return wsize; @@ -950,8 +1027,8 @@ int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen, * writing it to bfd. * Return value is true on success, false on failure. */ -bool flush_cipher(JCR *jcr, BFILE *bfd, uint64_t *addr, int flags, CIPHER_CONTEXT *cipher, - uint32_t cipher_block_size) +bool flush_cipher(JCR *jcr, BFILE *bfd, uint64_t *addr, int flags, + RESTORE_CIPHER_CTX *cipher_ctx) { uint32_t decrypted_len; char *wbuf; /* write buffer */ @@ -959,36 +1036,36 @@ bool flush_cipher(JCR *jcr, BFILE *bfd, uint64_t *addr, int flags, CIPHER_CONTEX char ec1[50]; /* Buffer printing huge values */ /* Write out the remaining block and free the cipher context */ - jcr->crypto_buf = check_pool_memory_size(jcr->crypto_buf, jcr->crypto_buf_len + - cipher_block_size); + cipher_ctx->buf = check_pool_memory_size(cipher_ctx->buf, cipher_ctx->buf_len + + cipher_ctx->block_size); - if (!crypto_cipher_finalize(cipher, (uint8_t *)&jcr->crypto_buf[jcr->crypto_buf_len], + if (!crypto_cipher_finalize(cipher_ctx->cipher, (uint8_t *)&cipher_ctx->buf[cipher_ctx->buf_len], &decrypted_len)) { /* Writing out the final, buffered block failed. Shouldn't happen. */ Jmsg1(jcr, M_FATAL, 0, _("Decryption error for %s\n"), jcr->last_fname); } /* If nothing new was decrypted, and our output buffer is empty, return */ - if (decrypted_len == 0 && jcr->crypto_buf_len == 0) { + if (decrypted_len == 0 && cipher_ctx->buf_len == 0) { return true; } - jcr->crypto_buf_len += decrypted_len; + cipher_ctx->buf_len += decrypted_len; - unser_crypto_packet_len(jcr); - Dmsg1(500, "Crypto unser block size=%d\n", jcr->crypto_packet_len - CRYPTO_LEN_SIZE); - wsize = jcr->crypto_packet_len - CRYPTO_LEN_SIZE; - wbuf = &jcr->crypto_buf[CRYPTO_LEN_SIZE]; /* Decrypted, possibly decompressed output here. */ + unser_crypto_packet_len(cipher_ctx); + Dmsg1(500, "Crypto unser block size=%d\n", cipher_ctx->packet_len - CRYPTO_LEN_SIZE); + wsize = cipher_ctx->packet_len - CRYPTO_LEN_SIZE; + wbuf = &cipher_ctx->buf[CRYPTO_LEN_SIZE]; /* Decrypted, possibly decompressed output here. */ - if (jcr->crypto_buf_len != jcr->crypto_packet_len) { + if (cipher_ctx->buf_len != cipher_ctx->packet_len) { Jmsg2(jcr, M_FATAL, 0, _("Unexpected number of bytes remaining at end of file, received %u, expected %u\n"), - jcr->crypto_packet_len, jcr->crypto_buf_len); + cipher_ctx->packet_len, cipher_ctx->buf_len); return false; } - jcr->crypto_buf_len = 0; - jcr->crypto_packet_len = 0; + cipher_ctx->buf_len = 0; + cipher_ctx->packet_len = 0; if (flags & FO_SPARSE) { if (!sparse_data(jcr, bfd, addr, &wbuf, &wsize)) { diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index 5874faaf42..300c15c79e 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -293,8 +293,6 @@ public: uint8_t *pki_session_encoded; /* Cached DER-encoded copy of pki_session */ int32_t pki_session_encoded_size; /* Size of DER-encoded pki_session */ POOLMEM *crypto_buf; /* Encryption/Decryption buffer */ - int32_t crypto_buf_len; /* Count of bytes currently in crypto_buf */ - int32_t crypto_packet_len; /* Total bytes in packet */ DIRRES* director; /* Director resource */ bool runscript_after; /* Don't run After Script twice */ #endif /* FILE_DAEMON */