From: Eric Bollengier Date: Fri, 6 Nov 2020 20:27:05 +0000 (+0100) Subject: Fix unexpected connection event sent by the FD when the Message resource is not confi... X-Git-Tag: Release-11.3.2~848 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd926fc4671b054234fd3d5957bc05d303d87763;p=thirdparty%2Fbacula.git Fix unexpected connection event sent by the FD when the Message resource is not configured --- diff --git a/bacula/src/lib/message.c b/bacula/src/lib/message.c index 021899b31..4e4451b1d 100644 --- a/bacula/src/lib/message.c +++ b/bacula/src/lib/message.c @@ -390,7 +390,7 @@ init_msg(JCR *jcr, MSGS *msg, job_code_callback_t job_code_callback) if (msg == NULL) { daemon_msgs = (MSGS *)malloc(sizeof(MSGS)); memset(daemon_msgs, 0, sizeof(MSGS)); - for (i=1; i<=M_MAX; i++) { + for (i=3; i<=M_MAX; i++) { add_msg_dest(daemon_msgs, MD_STDOUT, i, NULL, NULL); } Dmsg1(050, "Create daemon global message resource %p\n", daemon_msgs); @@ -1540,7 +1540,7 @@ Jmsg(JCR *jcr, int type, utime_t mtime, const char *fmt,...) * This allow commands such as "estimate" to work. * It probably should be restricted to work only in the FD. */ - if (jcr && jcr->JobId == 0 && jcr->dir_bsock && type != M_SECURITY) { + if (jcr && jcr->JobId == 0 && jcr->dir_bsock && type != M_SECURITY && type != M_EVENTS) { BSOCK *dir = jcr->dir_bsock; va_start(arg_ptr, fmt); dir->msglen = bvsnprintf(dir->msg, sizeof_pool_memory(dir->msg), diff --git a/bacula/src/lib/message.h b/bacula/src/lib/message.h index 378234220..c474f423f 100644 --- a/bacula/src/lib/message.h +++ b/bacula/src/lib/message.h @@ -80,6 +80,7 @@ enum { /* Keep M_ABORT=1 for dlist.h */ M_ABORT = 1, /* MUST abort immediately */ M_DEBUG, /* debug message */ + M_EVENTS, /* Event messages use event_send_msg() */ M_FATAL, /* Fatal error, stopping job */ M_ERROR, /* Error, but recoverable */ M_WARNING, /* Warning message */ @@ -93,11 +94,10 @@ enum { M_RESTORED, /* ls -l of restored files */ M_SECURITY, /* security violation */ M_ALERT, /* tape alert messages */ - M_VOLMGMT, /* Volume management messages */ - M_EVENTS /* Event messages use event_send_msg() */ + M_VOLMGMT /* Volume management messages */ }; -#define M_MAX M_EVENTS /* keep this updated ! */ +#define M_MAX M_VOLMGMT /* keep this updated ! */ #define M_ALL M_MAX+1 /* We cannot store more than this amount of custom events */