]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/fd_cmds.c
Big backport from Enterprise
[bacula/bacula] / bacula / src / dird / fd_cmds.c
index efb5596dc6d892dd69ec7260818f45a4c39ce559..e6fd2930a26ebbb14ff81fd6e069b0f774a358f8 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2000-2017 Kern Sibbald
 
    The original author of Bacula is Kern Sibbald, with contributions
    from many others, a complete list can be found in the file AUTHORS.
@@ -101,7 +101,7 @@ int connect_to_file_daemon(JCR *jcr, int retry_interval, int max_retry_time,
       bstrncat(name, jcr->client->name(), sizeof(name));
 
       fd->set_source_address(director->DIRsrc_addr);
-      if (!fd->connect(jcr,retry_interval,max_retry_time, heart_beat, name, jcr->client->address,
+      if (!fd->connect(jcr,retry_interval,max_retry_time, heart_beat, name, jcr->client->address(),
            NULL, jcr->client->FDport, verbose)) {
          fd->close();
          jcr->setJobStatus(JS_ErrorTerminated);
@@ -275,16 +275,16 @@ void get_level_since_time(JCR *jcr, char *since, int since_len)
 
             /* Get the end time of our most recent successfull backup for this job */
             /* This will be used to see if there have been any failures since then */
-           if (db_find_last_job_end_time(jcr, jcr->db, &jcr->jr, &etime, prev_job)) {
+            if (db_find_last_job_end_time(jcr, jcr->db, &jcr->jr, &etime, prev_job)) {
 
-              /* See if there are any failed Differential/Full backups since the completion */
+               /* See if there are any failed Differential/Full backups since the completion */
                /* of our last successful backup for this job                                 */
                if (db_find_failed_job_since(jcr, jcr->db, &jcr->jr,
                                          etime, JobLevel)) {
                  /* If our job is an Incremental and we have a failed job then upgrade.              */
                  /* If our job is a Differential and the failed job is a Full then upgrade.          */
                  /* Otherwise there is no reason to upgrade.                                         */
-                if ((jcr->getJobLevel() == L_INCREMENTAL) || 
+                 if ((jcr->getJobLevel() == L_INCREMENTAL) || 
                      ((jcr->getJobLevel() == L_DIFFERENTIAL) && (JobLevel == L_FULL))) {
                     Jmsg(jcr, M_INFO, 0, _("Prior failed job found in catalog. Upgrading to %s.\n"),
                        level_to_str(JobLevel));
@@ -574,7 +574,7 @@ static bool send_list_item(JCR *jcr, const char *code, char *item, BSOCK *fd)
       break;
    case '<':
       p++;                      /* skip over < */
-      if ((ffd = fopen(p, "rb")) == NULL) {
+      if ((ffd = bfopen(p, "rb")) == NULL) {
          berrno be;
          Jmsg(jcr, M_FATAL, 0, _("Cannot open included file: %s. ERR=%s\n"),
             p, be.bstrerror());
@@ -625,6 +625,30 @@ bool send_include_list(JCR *jcr)
    return true;
 }
 
+/*
+ *
+ * Send a include list with only one directory and recurse=no
+ * TODO: Need to display the plugin somewhere
+ *       The main point is that we don't introduce any protocol change
+ */
+bool send_ls_fileset(JCR *jcr, const char *path)
+{
+   BSOCK *fd = jcr->file_bsock;
+   fd->fsend(filesetcmd, "" /* no vss */, "" /* no snapshot */);
+
+   fd->fsend("I\n");
+   fd->fsend("O h\n");         /* Limit recursion to one directory */
+   fd->fsend("N\n");
+   fd->fsend("F %s\n", path);
+   fd->fsend("N\n");
+   fd->signal(BNET_EOD);              /* end of data */
+
+   if (!response(jcr, fd, OKinc, "Include", DISPLAY_ERROR)) {
+      return false;
+   }
+   return true;
+}
+
 /*
  * Send exclude list to File daemon
  *   Under the new scheme, the Exclude list