]> git.sur5r.net Git - bacula/bacula/commitdiff
kes Put make_catalog_backup SQL_BINDIR in an environment variable to
authorKern Sibbald <kern@sibbald.com>
Wed, 6 Dec 2006 18:30:08 +0000 (18:30 +0000)
committerKern Sibbald <kern@sibbald.com>
Wed, 6 Dec 2006 18:30:08 +0000 (18:30 +0000)
     make it easier for the user to change.
kes  Fail any backup job that tries to use encryption and sparse options.
     Hopefully this is a temporary change.
kes  Correct the EndJob return string for non-backup jobs.
kes  Review the encryption restore code.
kes  Implement a new encryption regression test with compression.

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

bacula/kernstodo
bacula/src/cats/make_catalog_backup.in
bacula/src/dird/backup.c
bacula/src/filed/backup.c
bacula/src/filed/job.c
bacula/src/filed/restore.c
bacula/technotes-1.39

index 381b4120249867475b923eb9dabd1128284a8199..9729fb87229a5cd87c2fd672567e168ca7482272 100644 (file)
@@ -41,13 +41,11 @@ Document:
  
 
 Priority:
+- Check if gnome-console works with TLS.
 - Ensure that the SD re-reads the Media record if the JobFiles
   does not match -- it may have been updated by another job.
 - Look at moving the Storage directive from the Job to the
   Pool in the default conf files.
-- Make sure the new level=Full syntax is used in all 
-  example conf files (especially in the manual).
-- Fix prog copyright (SD) all other files.
 - Migration Volume span bug
 - Rescue release
 - Bug reports
@@ -59,7 +57,6 @@ Priority:
 - Wrong jobbytes with query 12 (todo)
 - bacula-1.38.2-ssl.patch
 - Bare-metal recovery Windows (todo)
-- Document need for UTF-8 format
 
 
 
@@ -1749,3 +1746,8 @@ Block Position: 0
 - Make release unload any autochanger.
 - Arno's reservation deadlock.
 - Eric's SD patch
+- Make sure the new level=Full syntax is used in all 
+  example conf files (especially in the manual).
+- Fix prog copyright (SD) all other files.
+- Document need for UTF-8 format
+
index fcd060d4dff66644b7587be6d20d96cccc292d3d..1a5d2370b85ff8dcedaaa868f62e8521b69bcbd5 100755 (executable)
 #     (default "")
 #
 #
+BINDIR=@SQL_BINDIR@
+
 cd @working_dir@
 rm -f bacula.sql
 if test xsqlite = x@DB_NAME@ ; then
-  echo ".dump" | @SQL_BINDIR@/sqlite $1.db >$1.sql
+  echo ".dump" | ${BINDIR}/sqlite $1.db >$1.sql
 else
   if test xmysql = x@DB_NAME@ ; then
     if test $# -gt 2; then
@@ -22,23 +24,23 @@ else
     else
       MYSQLPASSWORD=""
     fi
-    @SQL_BINDIR@/mysqldump -u $2$MYSQLPASSWORD -f --opt $1 >$1.sql
+    ${BINDIR}/mysqldump -u $2$MYSQLPASSWORD -f --opt $1 >$1.sql
   else                       
     if test xpostgresql = x@DB_NAME@ ; then
       if test $# -gt 2; then
        PGPASSWORD=$3
        export PGPASSWORD
       fi
-      exec @SQL_BINDIR@/pg_dump -c -U $2 $1 >$1.sql
+      exec ${BINDIR}/pg_dump -c -U $2 $1 >$1.sql
     else
-      echo ".dump" | @SQL_BINDIR@/sqlite3 $1.db >$1.sql
+      echo ".dump" | ${BINDIR}/sqlite3 $1.db >$1.sql
     fi
   fi
 fi
 #
 #  To read back a MySQL database use: 
 #     cd @working_dir@
-#     rm -f @SQL_BINDIR@/../var/bacula/*
+#     rm -f ${BINDIR}/../var/bacula/*
 #     mysql <bacula.sql
 #
 #  To read back a SQLite database use:
index 1975e5b078789b50b0aec3c66202939166183b5d..979d35df15f063e9bd3cc8622f0293f680bdc529 100644 (file)
@@ -53,11 +53,11 @@ static char storaddr[]  = "storage address=%s port=%d ssl=%d\n";
 static char OKbackup[]   = "2000 OK backup\n";
 static char OKstore[]    = "2000 OK storage\n";
 static char EndJob[]     = "2800 End Job TermCode=%d JobFiles=%u "
-                           "ReadBytes=%lld JobBytes=%lld Errors=%u "  
+                           "ReadBytes=%llu JobBytes=%llu Errors=%u "  
                            "VSS=%d Encrypt=%d\n";
 /* Pre 1.39.29 (04Dec06) EndJob */
 static char OldEndJob[]  = "2800 End Job TermCode=%d JobFiles=%u "
-                           "ReadBytes=%lld JobBytes=%lld Errors=%u\n";
+                           "ReadBytes=%llu JobBytes=%llu Errors=%u\n";
 /* 
  * Called here before the job is run to do the job
  *   specific setup.
@@ -261,7 +261,8 @@ int wait_for_job_termination(JCR *jcr)
    BSOCK *fd = jcr->file_bsock;
    bool fd_ok = false;
    uint32_t JobFiles, Errors;
-   uint64_t ReadBytes, JobBytes;
+   uint64_t ReadBytes = 0;
+   uint64_t JobBytes = 0;
    int VSS = 0;
    int Encrypt = 0;
 
@@ -284,6 +285,7 @@ int wait_for_job_termination(JCR *jcr)
          break;
       }
    }
+
    if (is_bnet_error(fd)) {
       Jmsg(jcr, M_FATAL, 0, _("Network error with FD during %s: ERR=%s\n"),
           job_type_to_str(jcr->JobType), bnet_strerror(fd));
index 343552ed6c1bb2dd75988c931f8598a43006a304..aa69ec1270b0640d517e45185a5c5f196db2a67c 100644 (file)
@@ -662,11 +662,15 @@ int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest,
 #endif
 
    if (ff_pkt->flags & FO_ENCRYPT) {
+      if (ff_pkt->flags & FO_SPARSE) {
+         Jmsg0(jcr, M_FATAL, 0, _("Encrypting sparse data not supported.\n"));
+         goto err;
+      }
       /* Allocate the cipher context */
       if ((cipher_ctx = crypto_cipher_new(jcr->pki_session, true, 
            &cipher_block_size)) == NULL) {
          /* Shouldn't happen! */
-         Jmsg0(jcr, M_FATAL, 0, _("Failed to initialize encryption context\n"));
+         Jmsg0(jcr, M_FATAL, 0, _("Failed to initialize encryption context.\n"));
          goto err;
       }
 
index 6ceacea8966976aaffe7f178ca7466efa296b1a9..dbec9bd976120dad2292dc868ba4b2a93720d475 100644 (file)
@@ -1543,7 +1543,9 @@ static int verify_cmd(JCR *jcr)
    /* Send termination status back to Dir */
    bnet_fsend(dir, EndJob, jcr->JobStatus, jcr->JobFiles,
       edit_uint64(jcr->ReadBytes, ed1),
-      edit_uint64(jcr->JobBytes, ed2), jcr->Errors);
+      edit_uint64(jcr->JobBytes, ed2), jcr->Errors, 0,
+      jcr->pki_encrypt);
+   Dmsg1(110, "End FD msg: %s\n", dir->msg);
 
    /* Inform Director that we are done */
    bnet_sig(dir, BNET_TERMINATE);
@@ -1637,7 +1639,9 @@ bail_out:
    /* Send termination status back to Dir */
    bnet_fsend(dir, EndJob, jcr->JobStatus, jcr->JobFiles,
       edit_uint64(jcr->ReadBytes, ed1),
-      edit_uint64(jcr->JobBytes, ed2), jcr->Errors);
+      edit_uint64(jcr->JobBytes, ed2), jcr->Errors, 0,
+      jcr->pki_encrypt);
+   Dmsg1(110, "End FD msg: %s\n", dir->msg);
 
    /* Inform Director that we are done */
    bnet_sig(dir, BNET_TERMINATE);
index f10bda60370e035fd9139c1be2f47690a772e700..c2cebe8416319bc170f2c5000bdf89def1c0d284 100644 (file)
@@ -99,7 +99,6 @@ void do_restore(JCR *jcr)
    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 */
@@ -768,7 +767,7 @@ bool sparse_data(JCR *jcr, BFILE *bfd, uint64_t *addr, char **data, uint32_t *le
             Jmsg3(jcr, M_ERROR, 0, _("Seek to %s error on %s: ERR=%s\n"),
                   edit_uint64(*addr, ec1), jcr->last_fname, 
                   be.strerror(bfd->berrno));
-           return false;
+            return false;
          }
       }
       *data += SPARSE_FADDR_SIZE;
@@ -898,8 +897,8 @@ int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen,
       Dmsg1(500, "Crypto unser block size=%d\n", jcr->crypto_packet_len - CRYPTO_LEN_SIZE);
 
       if (jcr->crypto_packet_len == 0 || jcr->crypto_buf_len < jcr->crypto_packet_len) {
-        /* No full preserved block is available. */
-        return 0;
+         /* No full preserved block is available. */
+         return 0;
       }
 
       /* We have one full block, set up the filter input buffers */
@@ -910,9 +909,9 @@ int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen,
    }
 
    if (flags & FO_SPARSE) {
-       if (!sparse_data(jcr, bfd, addr, &wbuf, &wsize)) {
-          return -1;
-       }
+      if (!sparse_data(jcr, bfd, addr, &wbuf, &wsize)) {
+         return -1;
+      }
    }
 
    if (flags & FO_GZIP) {
@@ -934,9 +933,9 @@ int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen,
    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);
+         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);
       }
       /* The packet was successfully written, reset the length so that the next
        * packet length may be re-read by unser_crypto_packet_len() */
@@ -983,8 +982,8 @@ bool flush_cipher(JCR *jcr, BFILE *bfd, uint64_t *addr, int flags, CIPHER_CONTEX
 
    if (jcr->crypto_buf_len != jcr->crypto_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);
+            _("Unexpected number of bytes remaining at end of file, received %u, expected %u\n"),
+            jcr->crypto_packet_len, jcr->crypto_buf_len);
       return false;
    }
 
@@ -992,9 +991,9 @@ bool flush_cipher(JCR *jcr, BFILE *bfd, uint64_t *addr, int flags, CIPHER_CONTEX
    jcr->crypto_packet_len = 0;
 
    if (flags & FO_SPARSE) {
-       if (!sparse_data(jcr, bfd, addr, &wbuf, &wsize)) {
-          return false;
-       }
+      if (!sparse_data(jcr, bfd, addr, &wbuf, &wsize)) {
+         return false;
+      }
    }
 
    if (flags & FO_GZIP) {
index 96c755101c23f54ae1760e8c9a95083ef6901108..f75e441418a5408627439d0e41f3bf59e9a46ad2 100644 (file)
@@ -2,6 +2,13 @@
 
 General:
 06Dec06
+kes  Put make_catalog_backup SQL_BINDIR in an environment variable to
+     make it easier for the user to change.
+kes  Fail any backup job that tries to use encryption and sparse options.
+     Hopefully this is a temporary change.
+kes  Correct the EndJob return string for non-backup jobs.
+kes  Review the encryption restore code.
+kes  Implement a new encryption regression test with compression.
 kes  Modify migrate not to fail if nothing found to migrate. 
 kes  Add #undef HAVE_OPENSSL, HAVE_TLS, HAVE_CYRPTO to autoconf/config.h.in
      because they were not always set correctly.