From: Eric Bollengier Date: Fri, 24 Apr 2020 15:59:08 +0000 (+0200) Subject: BEE Backport bacula/src/dird/restore.c X-Git-Tag: Release-11.3.2~1749 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf84e8a78c4e2c6249a2db4ec59e9c2ce501c4d6;p=thirdparty%2Fbacula.git BEE Backport bacula/src/dird/restore.c This commit is the result of the squash of the following main commits: Author: Norbert Bizet Date: Fri Dec 29 14:42:55 2017 +0100 initialize replace to avoid compiler warning. Author: Eric Bollengier 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 Date: Thu Jan 19 11:44:11 2017 +0100 Add jobuser/jobgroup restore options --- diff --git a/bacula/src/dird/restore.c b/bacula/src/dird/restore.c index e5ef321cf0..d2f5f83010 100644 --- a/bacula/src/dird/restore.c +++ b/bacula/src/dird/restore.c @@ -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;