]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/fd_cmds.c
Add new files
[bacula/bacula] / bacula / src / dird / fd_cmds.c
index 2d08770bc42209224d74752cb3f26b10f58cfe97..0aa9e4ae9bae1b374fbfe7d4f2094ac399c161cb 100644 (file)
@@ -42,9 +42,10 @@ static char jobcmd[]      = "JobId=%d Job=%s SDid=%u SDtime=%u Authorization=%s\
 
 
 /* Responses received from File daemon */
-static char OKinc[]      = "2000 OK include\n";
-static char OKexc[]      = "2000 OK exclude\n";
-static char OKjob[]      = "2000 OK Job";
+static char OKinc[]       = "2000 OK include\n";
+static char OKexc[]       = "2000 OK exclude\n";
+static char OKjob[]       = "2000 OK Job";
+static char OKbootstrap[] = "2000 OK bootstrap\n";
 
 /* Forward referenced functions */
 
@@ -271,6 +272,45 @@ int send_exclude_list(JCR *jcr)
 }
 
 
+/*
+ * Send bootstrap file if any to the File daemon.
+ *  This is used for restore and verify VolumeToCatalog
+ */
+int send_bootstrap_file(JCR *jcr)
+{
+   FILE *bs;
+   char buf[1000];
+   BSOCK *fd = jcr->file_bsock;
+   char *bootstrap = "bootstrap\n";
+
+   Dmsg1(400, "send_bootstrap_file: %s\n", jcr->RestoreBootstrap);
+   if (!jcr->RestoreBootstrap) {
+      return 1;
+   }
+   bs = fopen(jcr->RestoreBootstrap, "r");
+   if (!bs) {
+      Jmsg(jcr, M_FATAL, 0, _("Could not open bootstrap file %s: ERR=%s\n"), 
+        jcr->RestoreBootstrap, strerror(errno));
+      set_jcr_job_status(jcr, JS_ErrorTerminated);
+      return 0;
+   }
+   strcpy(fd->msg, bootstrap); 
+   fd->msglen = strlen(fd->msg);
+   bnet_send(fd);
+   while (fgets(buf, sizeof(buf), bs)) {
+      fd->msglen = Mmsg(&fd->msg, "%s", buf);
+      bnet_send(fd);      
+   }
+   bnet_sig(fd, BNET_EOD);
+   fclose(bs);
+   if (!response(jcr, fd, OKbootstrap, "Bootstrap", DISPLAY_ERROR)) {
+      set_jcr_job_status(jcr, JS_ErrorTerminated);
+      return 0;
+   }
+   return 1;
+}
+
+
 /* 
  * Read the attributes from the File daemon for
  * a Verify job and store them in the catalog.
@@ -321,7 +361,7 @@ msglen=%d msg=%s\n"), len, fd->msglen, fd->msg);
       *fn = *p++;                    /* term filename and point to attribs */
       attr = p;
 
-      if (stream == STREAM_UNIX_ATTRIBUTES || stream == STREAM_WIN32_ATTRIBUTES) {
+      if (stream == STREAM_UNIX_ATTRIBUTES || stream == STREAM_UNIX_ATTRIBUTES_EX) {
         jcr->JobFiles++;
         jcr->FileIndex = file_index;
         ar.attr = attr;