From: Michal Rakowski Date: Fri, 23 Jul 2021 14:57:53 +0000 (+0200) Subject: Fix #6986 About mail wariables not working after conf reload X-Git-Tag: Release-11.3.2~426 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=20bba22a5a0c0f5ed95f13c3e44241520d76581c;p=thirdparty%2Fbacula.git Fix #6986 About mail wariables not working after conf reload Callback for changing job codes was changed from being a global one to per-jcr, so that when reload is executed it is not cleared and stays until end of the job. --- diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index f8ef5c314..b1014c522 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -230,6 +230,7 @@ public: void my_thread_send_signal(int sig); /* in lib/jcr.c */ void set_killable(bool killable); /* in lib/jcr.c */ bool is_killable() const { return my_thread_killable; }; + job_code_callback_t job_code_callback; /* Callback sending messages defined by the user */ /* Global part of JCR common to all daemons */ dlink link; /* JCR chain link */ diff --git a/bacula/src/lib/message.c b/bacula/src/lib/message.c index b27876be1..309d26053 100644 --- a/bacula/src/lib/message.c +++ b/bacula/src/lib/message.c @@ -66,7 +66,6 @@ brwlock_t con_lock; /* Console lock structure */ bool dbg_timestamp = false; /* print timestamp in debug output */ bool dbg_thread = false; /* add thread_id to details */ bool prt_kaboom = false; /* Print kaboom output */ -job_code_callback_t message_job_code_callback = NULL; /* Job code callback. Only used by director. */ /* Forward referenced functions */ @@ -363,7 +362,9 @@ init_msg(JCR *jcr, MSGS *msg, job_code_callback_t job_code_callback) set_jcr_in_tsd(INVALID_JCR); } - message_job_code_callback = job_code_callback; + if (jcr) { + jcr->job_code_callback = job_code_callback; + } #if !defined(HAVE_WIN32) /* @@ -574,7 +575,7 @@ static BPIPE *open_mail_pipe(JCR *jcr, POOLMEM *&cmd, DEST *d) BPIPE *bpipe; if (d->mail_cmd) { - cmd = edit_job_codes(jcr, cmd, d->mail_cmd, d->where, message_job_code_callback); + cmd = edit_job_codes(jcr, cmd, d->mail_cmd, d->where, jcr ? jcr->job_code_callback : NULL); } else { Mmsg(cmd, "/usr/lib/sendmail -F Bacula %s", d->where); }