]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/filed/restore.c
First compiling version of AIX 5.3 and later acl code using the new aclx_get and...
[bacula/bacula] / bacula / src / filed / restore.c
index a9e072975b5acacb285996575209ae9332daf692..0bdbeb2c9bab83fdac46c0c018bea11a5f56cb69 100644 (file)
@@ -1,12 +1,12 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2010 Free Software Foundation Europe e.V.
 
    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.
@@ -126,7 +126,7 @@ bool restore_finderinfo(JCR *jcr, POOLMEM *buf, int32_t buflen)
    Dmsg0(130, "Restoring Finder Info\n");
    jcr->ff->flags |= FO_HFSPLUS;
    if (buflen != 32) {
-      Jmsg(jcr, M_ERROR, 0, _("Invalid length of Finder Info (got %d, not 32)\n"), sd->msglen);
+      Jmsg(jcr, M_ERROR, 0, _("Invalid length of Finder Info (got %d, not 32)\n"), buflen);
       return false;
    }
 
@@ -267,7 +267,7 @@ void do_restore(JCR *jcr)
          Jmsg1(jcr, M_FATAL, 0, _("Record header scan error: %s\n"), sd->msg);
          goto bail_out;
       }
-      Dmsg5(50, "Got hdr: Files=%d FilInx=%d size=%d Stream=%d, %s.\n", 
+      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));
 
       /*
@@ -319,24 +319,25 @@ void do_restore(JCR *jcr)
          if (rctx.type == FT_DELETED) { /* deleted file */
             continue;
          }
+         /*
+          * Restore objects should be ignored here -- they are
+          * returned at the beginning of the restore. 
+          */
+         if (rctx.type == FT_RESTORE_FIRST) {
+            continue;
+         }
 
          /*
           * Unpack attributes and do sanity check them
           */
-         if (!unpack_attributes_record(jcr, rctx.stream, sd->msg, attr)) {
+         if (!unpack_attributes_record(jcr, rctx.stream, sd->msg, sd->msglen, attr)) {
             goto bail_out;
          }
-#ifdef xxx
-         if (file_index != attr->file_index) {
-            Jmsg(jcr, M_FATAL, 0, _("Record header file index %ld not equal record index %ld\n"),
-                 file_index, attr->file_index);
-            Dmsg0(200, "File index error\n");
-            goto bail_out;
-         }
-#endif
 
-         Dmsg3(200, "File %s\nattrib=%s\nattribsEx=%s\n", attr->fname,
+         Dmsg3(100, "File %s\nattrib=%s\nattribsEx=%s\n", attr->fname,
                attr->attr, attr->attrEx);
+         Dmsg3(100, "=== msglen=%d attrExlen=%d msg=%s\n", sd->msglen,
+               strlen(attr->attrEx), sd->msg);
 
          attr->data_stream = decode_stat(attr->attr, &attr->statp, &attr->LinkFI);
 
@@ -650,6 +651,7 @@ void do_restore(JCR *jcr)
       case STREAM_ACL_TRU64_ACCESS_ACL:
       case STREAM_ACL_SOLARIS_ACLENT:
       case STREAM_ACL_SOLARIS_ACE:
+      case STREAM_ACL_AFS_TEXT:
          /*
           * Do not restore ACLs when
           * a) The current file is not extracted
@@ -671,7 +673,7 @@ void do_restore(JCR *jcr)
                 * print the error message set by the lower level routine in jcr->errmsg.
                 */
                if (jcr->acl_data->nr_errors < ACL_REPORT_ERR_MAX_PER_JOB) {
-                  Qmsg(jcr, M_WARNING, 0, "%s", jcr->errmsg);
+                  Jmsg(jcr, M_WARNING, 0, "%s", jcr->errmsg);
                }
                jcr->acl_data->nr_errors++;
                break;
@@ -683,6 +685,7 @@ void do_restore(JCR *jcr)
          }
          break;
 
+      case STREAM_XATTR_OPENBSD:
       case STREAM_XATTR_SOLARIS_SYS:
       case STREAM_XATTR_SOLARIS:
       case STREAM_XATTR_DARWIN:
@@ -710,7 +713,7 @@ void do_restore(JCR *jcr)
                 * print the error message set by the lower level routine in jcr->errmsg.
                 */
                if (jcr->xattr_data->nr_errors < XATTR_REPORT_ERR_MAX_PER_JOB) {
-                  Qmsg(jcr, M_WARNING, 0, "%s", jcr->errmsg);
+                  Jmsg(jcr, M_WARNING, 0, "%s", jcr->errmsg);
                }
                jcr->xattr_data->nr_errors++;
                break;
@@ -759,6 +762,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"),
@@ -1084,7 +1090,7 @@ bool decompress_data(JCR *jcr, char **data, uint32_t *length)
       /*
        * The buffer size is too small, try with a bigger one
        */
-      compress_len = jcr->compress_buf_size = jcr->compress_buf_size + jcr->compress_buf_size >> 1;
+      compress_len = jcr->compress_buf_size = jcr->compress_buf_size + (jcr->compress_buf_size >> 1);
       Dmsg2(200, "Comp_len=%d msglen=%d\n", compress_len, *length);
       jcr->compress_buf = check_pool_memory_size(jcr->compress_buf,
                                                  compress_len);