summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/lib/debug.c22
-rw-r--r--source3/lib/messages.c9
-rw-r--r--source3/libsmb/clidgram.c3
-rw-r--r--source3/nmbd/nmbd.c1
-rw-r--r--source3/nsswitch/winbindd.c2
-rw-r--r--source3/smbd/server.c2
-rw-r--r--source3/torture/msgtest.c2
-rw-r--r--source3/utils/smbcontrol.c3
8 files changed, 16 insertions, 28 deletions
diff --git a/source3/lib/debug.c b/source3/lib/debug.c
index d231f55585..5ef07f806b 100644
--- a/source3/lib/debug.c
+++ b/source3/lib/debug.c
@@ -492,19 +492,6 @@ static void debug_message(int msg_type, struct server_id src,
}
/****************************************************************************
- 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
**************************************************************************/
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index 16d3a61343..63c136db61 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -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;
}
diff --git a/source3/libsmb/clidgram.c b/source3/libsmb/clidgram.c
index 15125eb077..2208378863 100644
--- a/source3/libsmb/clidgram.c
+++ b/source3/libsmb/clidgram.c
@@ -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));
/*
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index f328673a55..ba05316d71 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -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;
}
diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c
index ae1078fe02..f4405981d2 100644
--- a/source3/nsswitch/winbindd.c
+++ b/source3/nsswitch/winbindd.c
@@ -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);
}
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index ca54b2471d..f227579c04 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -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
diff --git a/source3/torture/msgtest.c b/source3/torture/msgtest.c
index 18674ef0f5..20e5230a60 100644
--- a/source3/torture/msgtest.c
+++ b/source3/torture/msgtest.c
@@ -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");
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
index c4d71361fd..7dfa385306 100644
--- a/source3/utils/smbcontrol.c
+++ b/source3/utils/smbcontrol.c
@@ -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,