s3-messaging: Fix messaging classes.
authorSimo Sorce <idra@samba.org>
Thu, 11 Aug 2011 03:10:48 +0000 (23:10 -0400)
committerAndreas Schneider <asn@samba.org>
Thu, 11 Aug 2011 12:58:01 +0000 (14:58 +0200)
This has been broken since ff0ac5b0 (May 2007).
Basically all messages were belonging to the General class except for CTDB
messages.
This fixed the message_send_all() function to correctly compute the class, and
fixes registrations to include all they need to cope with the fact not all
messages are of calss general (registrations rotted a bit because as long as
FLAG_MSG_GENERAL was defined the process woould receive all messages).

Signed-off-by: Andreas Schneider <asn@samba.org>
source3/include/messages.h
source3/lib/messages.c
source3/librpc/idl/messaging.idl
source3/nmbd/nmbd.c
source3/winbindd/winbindd.c

index 86402dc07b90c2ffa2ec137ba233c60ffcaa37c0..8ea6c89640f0c6d6f22bacc03e96b049900a3473 100644 (file)
@@ -42,7 +42,7 @@
 #define FLAG_MSG_GENERAL               0x0001
 #define FLAG_MSG_SMBD                  0x0002
 #define FLAG_MSG_NMBD                  0x0004
-/* #define FLAG_MSG_PRINT_NOTIFY               0x0008  Obsolete */
+#define FLAG_MSG_WINBIND               0x0008
 #define FLAG_MSG_PRINT_GENERAL         0x0010
 /* dbwrap messages 4001-4999 */
 #define FLAG_MSG_DBWRAP                        0x0020
index 0cdef63fdc24ab44d20868d1daef9281d652f727..57a2e22f72675983751480753c6d488b3fa1e0fc 100644 (file)
@@ -146,18 +146,21 @@ bool message_send_all(struct messaging_context *msg_ctx,
        struct msg_all msg_all;
 
        msg_all.msg_type = msg_type;
-       if (msg_type < 1000)
+       if (msg_type < 0x100) {
                msg_all.msg_flag = FLAG_MSG_GENERAL;
-       else if (msg_type > 1000 && msg_type < 2000)
+       } else if (msg_type > 0x100 && msg_type < 0x200) {
                msg_all.msg_flag = FLAG_MSG_NMBD;
-       else if (msg_type > 2100 && msg_type < 3000)
+       } else if (msg_type > 0x200 && msg_type < 0x300) {
                msg_all.msg_flag = FLAG_MSG_PRINT_GENERAL;
-       else if (msg_type > 3000 && msg_type < 4000)
+       } else if (msg_type > 0x300 && msg_type < 0x400) {
                msg_all.msg_flag = FLAG_MSG_SMBD;
-       else if (msg_type > 4000 && msg_type < 5000)
+       } else if (msg_type > 0x400 && msg_type < 0x600) {
+               msg_all.msg_flag = FLAG_MSG_WINBIND;
+       } else if (msg_type > 4000 && msg_type < 5000) {
                msg_all.msg_flag = FLAG_MSG_DBWRAP;
-       else
-               return False;
+       } else {
+               return false;
+       }
 
        msg_all.buf = buf;
        msg_all.len = len;
@@ -167,7 +170,7 @@ bool message_send_all(struct messaging_context *msg_ctx,
        serverid_traverse(traverse_fn, &msg_all);
        if (n_sent)
                *n_sent = msg_all.n_sent;
-       return True;
+       return true;
 }
 
 struct event_context *messaging_event_context(struct messaging_context *msg_ctx)
index 8e15bcecc152c7628688b39cde4477dc07afe6a1..309f0bb9f09cfc12447a04b54d86f714c63ad283 100644 (file)
@@ -94,7 +94,7 @@ interface messaging
                /* event messages */
                MSG_DUMP_EVENT_LIST             = 0x0500,
 
-               /* dbwrap messages 4001-4999 */
+               /* dbwrap messages 4001-4999 (0x0FA0 - 0x1387) */
                MSG_DBWRAP_TDB2_CHANGES         = 4001,
                MSG_DBWRAP_G_LOCK_RETRY         = 4002
        } messaging_type;
index ceec2fdf9d9eb2149b94255e19238c4989e56725..08a5504be42a037036dd7951bfc7f5a0aa5753fa 100644 (file)
@@ -932,7 +932,9 @@ static bool open_sockets(bool isdaemon, int port)
        /* get broadcast messages */
 
        if (!serverid_register(procid_self(),
-                              FLAG_MSG_GENERAL|FLAG_MSG_DBWRAP)) {
+                               FLAG_MSG_GENERAL |
+                               FLAG_MSG_NMBD |
+                               FLAG_MSG_DBWRAP)) {
                DEBUG(1, ("Could not register myself in serverid.tdb\n"));
                exit(1);
        }
index 0c07d4b1b6a8323d6369acc6e0b33d73f7cd8e40..cb9d70c5f38b627c399431ecb98af52827943231 100644 (file)
@@ -1045,7 +1045,9 @@ void winbindd_register_handlers(void)
        /* get broadcast messages */
 
        if (!serverid_register(procid_self(),
-                              FLAG_MSG_GENERAL|FLAG_MSG_DBWRAP)) {
+                              FLAG_MSG_GENERAL |
+                              FLAG_MSG_WINBIND |
+                              FLAG_MSG_DBWRAP)) {
                DEBUG(1, ("Could not register myself in serverid.tdb\n"));
                exit(1);
        }