]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/filed/restore.c
Fix typo in buffer sizes off by factor of 10
[bacula/bacula] / bacula / src / filed / restore.c
index 95447e532f97113ad034a35faedeae4ab57ec49a..cb71562ab953c1894d4a3ebebd753207397cb89d 100644 (file)
@@ -6,7 +6,7 @@
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
    This program is Free Software; you can redistribute it and/or
-   modify it under the terms of version two of the GNU General Public
+   modify it under the terms of version three of the GNU Affero General Public
    License as published by the Free Software Foundation and included
    in the file LICENSE.
 
@@ -15,7 +15,7 @@
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
+   You should have received a copy of the GNU Affero General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
@@ -263,10 +263,12 @@ void do_restore(JCR *jcr)
        * First we expect a Stream Record Header
        */
       if (sscanf(sd->msg, rec_header, &VolSessionId, &VolSessionTime, &file_index,
-          &rctx.stream, &rctx.size) != 5) {
+          &rctx.full_stream, &rctx.size) != 5) {
          Jmsg1(jcr, M_FATAL, 0, _("Record header scan error: %s\n"), sd->msg);
          goto bail_out;
       }
+      /* Strip off new stream high bits */
+      rctx.stream = rctx.full_stream & STREAMMASK_TYPE;
       Dmsg5(150, "Got hdr: Files=%d FilInx=%d size=%d Stream=%d, %s.\n", 
             jcr->JobFiles, file_index, rctx.size, rctx.stream, stream_to_ascii(rctx.stream));
 
@@ -652,6 +654,9 @@ void do_restore(JCR *jcr)
       case STREAM_ACL_SOLARIS_ACLENT:
       case STREAM_ACL_SOLARIS_ACE:
       case STREAM_ACL_AFS_TEXT:
+      case STREAM_ACL_AIX_AIXC:
+      case STREAM_ACL_AIX_NFS4:
+      case STREAM_ACL_FREEBSD_NFS4_ACL:
          /*
           * Do not restore ACLs when
           * a) The current file is not extracted
@@ -685,6 +690,9 @@ void do_restore(JCR *jcr)
          }
          break;
 
+      case STREAM_XATTR_IRIX:
+      case STREAM_XATTR_TRU64:
+      case STREAM_XATTR_AIX:
       case STREAM_XATTR_OPENBSD:
       case STREAM_XATTR_SOLARIS_SYS:
       case STREAM_XATTR_SOLARIS:
@@ -762,6 +770,9 @@ void do_restore(JCR *jcr)
          plugin_name_stream(jcr, sd->msg);
          break;
 
+      case STREAM_RESTORE_OBJECT:
+         break;                    /* these are sent by Director */
+
       default:
          close_previous_stream(rctx);
          Jmsg(jcr, M_ERROR, 0, _("Unknown stream=%d ignored. This shouldn't happen!\n"),
@@ -1050,7 +1061,7 @@ bool sparse_data(JCR *jcr, BFILE *bfd, uint64_t *addr, char **data, uint32_t *le
       unser_declare;
       uint64_t faddr;
       char ec1[50];
-      unser_begin(*data, SPARSE_FADDR_SIZE);
+      unser_begin(*data, OFFSET_FADDR_SIZE);
       unser_uint64(faddr);
       if (*addr != faddr) {
          *addr = faddr;
@@ -1062,8 +1073,8 @@ bool sparse_data(JCR *jcr, BFILE *bfd, uint64_t *addr, char **data, uint32_t *le
             return false;
          }
       }
-      *data += SPARSE_FADDR_SIZE;
-      *length -= SPARSE_FADDR_SIZE;
+      *data += OFFSET_FADDR_SIZE;
+      *length -= OFFSET_FADDR_SIZE;
       return true;
 }
 
@@ -1225,7 +1236,7 @@ int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen,
       Dmsg2(130, "Encryption writing full block, %u bytes, remaining %u bytes in buffer\n", wsize, cipher_ctx->buf_len);
    }
 
-   if (flags & FO_SPARSE) {
+   if ((flags & FO_SPARSE) || (flags & FO_OFFSETS)) {
       if (!sparse_data(jcr, bfd, addr, &wbuf, &wsize)) {
          goto bail_out;
       }
@@ -1366,7 +1377,7 @@ again:
    cipher_ctx->buf_len -= cipher_ctx->packet_len;
    Dmsg2(130, "Encryption writing full block, %u bytes, remaining %u bytes in buffer\n", wsize, cipher_ctx->buf_len);
 
-   if (flags & FO_SPARSE) {
+   if ((flags & FO_SPARSE) || (flags & FO_OFFSETS)) {
       if (!sparse_data(jcr, bfd, addr, &wbuf, &wsize)) {
          return false;
       }