r22908: All callers of message_init now also call messaging_init. Unify those.
authorVolker Lendecke <vlendec@samba.org>
Tue, 15 May 2007 15:14:32 +0000 (15:14 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:22:07 +0000 (12:22 -0500)
(This used to be commit 330946ad2307ca34f0a8d068a0193fcb8a0d6036)

source3/lib/debug.c
source3/lib/messages.c
source3/libsmb/clidgram.c
source3/nmbd/nmbd.c
source3/nsswitch/winbindd.c
source3/smbd/server.c
source3/torture/msgtest.c
source3/utils/smbcontrol.c

index d231f55585440c2e5d269411ac639b6ad447365b..5ef07f806b677781de7044f81d253e87ce29c830 100644 (file)
@@ -491,19 +491,6 @@ static void debug_message(int msg_type, struct server_id src,
        debug_parse_levels(params_str);
 }
 
-/****************************************************************************
- Send a "set debug level" message.
-****************************************************************************/
-
-void debug_message_send(pid_t pid, const char *params_str)
-{
-       if (!params_str)
-               return;
-       message_send_pid(pid_to_procid(pid), MSG_DEBUG,
-                        params_str, strlen(params_str) + 1,
-                        False);
-}
-
 /****************************************************************************
  Return current debug level.
 ****************************************************************************/
@@ -539,14 +526,17 @@ void debug_init(void)
 
        initialised = True;
 
-       message_register(MSG_DEBUG, debug_message, NULL);
-       message_register(MSG_REQ_DEBUGLEVEL, debuglevel_message, NULL);
-
        for(p = default_classname_table; *p; p++) {
                debug_add_class(*p);
        }
 }
 
+void debug_register_msgs(void)
+{
+       message_register(MSG_DEBUG, debug_message, NULL);
+       message_register(MSG_REQ_DEBUGLEVEL, debuglevel_message, NULL);
+}
+
 /***************************************************************************
  Get ready for syslog stuff
 **************************************************************************/
index 16d3a61343f67cca30641166fd4c99d0a092aa23..63c136db61c50971a66995ee6b04d4533523149d 100644 (file)
@@ -117,7 +117,7 @@ static void ping_message(int msg_type, struct server_id src,
  Initialise the messaging functions. 
 ****************************************************************************/
 
-BOOL message_init(void)
+static BOOL message_init(struct messaging_context *msg_ctx)
 {
        sec_init();
 
@@ -144,6 +144,7 @@ BOOL message_init(void)
 
        register_msg_pool_usage();
        register_dmalloc_msgs();
+       debug_register_msgs();
 
        return True;
 }
@@ -757,6 +758,12 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
 
        ctx->id = server_id;
        talloc_set_destructor(ctx, messaging_context_destructor);
+
+       if (!message_init(ctx)) {
+               DEBUG(0, ("message_init failed: %s\n", strerror(errno)));
+               TALLOC_FREE(ctx);
+       }
+
        return ctx;
 }
 
index 15125eb07770a8ee133efafab190fd104df28426..2208378863331e8fa374dadb1f2f385befd4993c 100644 (file)
@@ -45,9 +45,6 @@ BOOL cli_send_mailslot(struct messaging_context *msg_ctx,
                return False;
        }
 
-       if (!message_init())
-               return False;
-
        memset((char *)&p, '\0', sizeof(p));
 
        /*
index f328673a5593dfd30b20657310279fcea84a1214..ba05316d71278f2c1d9373f68f7d24bbd1cd0f19 100644 (file)
@@ -753,7 +753,6 @@ static BOOL open_sockets(enum smb_server_mode server_mode, int port)
                setpgid( (pid_t)0, (pid_t)0 );
 #endif
 
-       message_init();
        if (nmbd_messaging_context() == NULL) {
                return 1;
        }
index ae1078fe02a67d12545d5da6677c2f1c04dd1949..f4405981d291322dbcae4cedfb066397515f5e38 100644 (file)
@@ -1125,7 +1125,7 @@ int main(int argc, char **argv, char **envp)
 
        /* Initialise messaging system */
 
-       if (!message_init()) {
+       if (winbind_messaging_context() == NULL) {
                DEBUG(0, ("unable to initialize messaging system\n"));
                exit(1);
        }
index ca54b2471d199fa9a0a73dce9388aca84d3d28be..f227579c0478fbefcbed46948b7b4cfb9743c10a 100644 (file)
@@ -967,7 +967,7 @@ extern void build_options(BOOL screen);
        }
 
        /* Setup all the TDB's - including CLEAR_IF_FIRST tdb's. */
-       if (!message_init())
+       if (smbd_messaging_context() == NULL)
                exit(1);
 
        /* Initialise the password backed before the global_sam_sid
index 18674ef0f5d9fca9dafcd1166506ee1d339b369e..20e5230a60fa188cc514ad9fc913fa1d6700034b 100644 (file)
@@ -52,8 +52,6 @@ static void pong_message(struct messaging_context *msg_ctx,
        
        lp_load(dyn_CONFIGFILE,False,False,False,True);
 
-       message_init();
-
        if (!(evt_ctx = event_context_init(NULL)) ||
            !(msg_ctx = messaging_init(NULL, server_id_self(), evt_ctx))) {
                fprintf(stderr, "could not init messaging context\n");
index c4d71361fde7e494d3bbbb7e86d0626d9972d1b4..7dfa385306c5ab928249890c016c16a1e46c996d 100644 (file)
@@ -55,9 +55,6 @@ static BOOL send_message(struct messaging_context *msg_ctx,
        BOOL ret;
        int n_sent = 0;
 
-       if (!message_init())
-               return False;
-
        if (procid_to_pid(&pid) != 0)
                return NT_STATUS_IS_OK(
                        messaging_send_buf(msg_ctx, pid, msg_type,