]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
BEE Backport bacula/src/dird/restore.c
authorEric Bollengier <eric@baculasystems.com>
Fri, 24 Apr 2020 15:59:08 +0000 (17:59 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 29 Apr 2021 08:44:17 +0000 (10:44 +0200)
This commit is the result of the squash of the following main commits:

Author: Norbert Bizet <norbert.bizet@baculasystems.com>
Date:   Fri Dec 29 14:42:55 2017 +0100

    initialize replace to avoid compiler warning.

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Mon Oct 9 17:38:40 2017 +0200

    Add PluginFeatures interface and the RestoreListFiles feature to the Director

    In this commit, we cleanup a lot of code that was not designed correctly. Plugins
    were able to create specific RestoreObjects to trigger special code on the Director
    side during the restore. Now, the Director will ask the Plugins directly if they
    need to receive the list of the selected files. A side effect is that if the test-plugin
    or the ndmp plugin are installed, we will send the list of files for each restore job.

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Thu Jan 19 11:44:11 2017 +0100

    Add jobuser/jobgroup restore options

bacula/src/dird/restore.c

index e5ef321cf08d9ea243a81e99cf7891717a9158ee..d2f5f8301074ca10dd601722e04d5ec133a4c5b9 100644 (file)
@@ -488,6 +488,9 @@ bool restore_bootstrap(JCR *jcr)
       /* Only pass "global" commands to the FD once */
       if (first_time) {
          first_time = false;
+         if (!send_job_permissions(jcr)) {
+            goto bail_out;
+         }
          if (!send_runscripts_commands(jcr)) {
             goto bail_out;
          }
@@ -499,6 +502,9 @@ bool restore_bootstrap(JCR *jcr)
             Pmsg0(000, "FAIL: Send restore objects\n");
             goto bail_out;
          }
+         if (!send_restore_file_list(jcr)) {
+            goto bail_out;
+         }
       }
 
       fd->fsend("%s", restore_cmd.c_str());
@@ -634,7 +640,7 @@ void restore_cleanup(JCR *jcr, int TermCode)
 {
    POOL_MEM where;
    char creplace;
-   const char *replace;
+   const char *replace = NULL;
    char sdt[MAX_TIME_LENGTH], edt[MAX_TIME_LENGTH];
    char ec1[30], ec2[30], ec3[30], ec4[30], elapsed[50];
    char term_code[100], fd_term_msg[100], sd_term_msg[100];
@@ -671,7 +677,7 @@ void restore_cleanup(JCR *jcr, int TermCode)
 
       } else if (jcr->JobErrors > 0 || jcr->SDErrors > 0) {
          term_msg = _("Restore OK -- with errors");
-
+         
       } else {
          term_msg = _("Restore OK");
       }
@@ -711,7 +717,6 @@ void restore_cleanup(JCR *jcr, int TermCode)
 
    get_restore_params(jcr, where, &creplace, NULL);
 
-   replace = ReplaceOptions[0].name;     /* default */
    for (int i=0; ReplaceOptions[i].name; i++) {
       if (ReplaceOptions[i].token == (int)creplace) {
          replace = ReplaceOptions[i].name;