]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Fix unexpected connection event sent by the FD when the Message resource is not confi...
authorEric Bollengier <eric@baculasystems.com>
Fri, 6 Nov 2020 20:27:05 +0000 (21:27 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:02:58 +0000 (09:02 +0100)
bacula/src/lib/message.c
bacula/src/lib/message.h

index 021899b315febace427295e21842764d704a29b1..4e4451b1d6163b46c10c6a67e18ed0ef9b403e79 100644 (file)
@@ -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),
index 37823422065bf5ed237731368c056b5bf7bacc5c..c474f423f28a709ae9623353b9842c353040a1e2 100644 (file)
@@ -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 */