summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/messages.h1
-rw-r--r--source3/smbd/proto.h2
-rw-r--r--source3/smbd/server.c25
3 files changed, 20 insertions, 8 deletions
diff --git a/source3/include/messages.h b/source3/include/messages.h
index 5ea27f3df1..083cd56256 100644
--- a/source3/include/messages.h
+++ b/source3/include/messages.h
@@ -133,6 +133,7 @@ void messaging_deregister(struct messaging_context *ctx, uint32_t msg_type,
NTSTATUS messaging_send(struct messaging_context *msg_ctx,
struct server_id server,
uint32_t msg_type, const DATA_BLOB *data);
+
NTSTATUS messaging_send_buf(struct messaging_context *msg_ctx,
struct server_id server, uint32_t msg_type,
const uint8 *buf, size_t len);
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index cf7c90450a..40281804cc 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -975,6 +975,8 @@ bool reload_services(struct messaging_context *msg_ctx, int smb_sock,
void exit_server(const char *const explanation);
void exit_server_cleanly(const char *const explanation);
void exit_server_fault(void);
+NTSTATUS messaging_send_to_children(struct messaging_context *msg_ctx,
+ uint32_t msg_type, DATA_BLOB* data);
/* The following definitions come from smbd/service.c */
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 668cafdb7b..7771c85784 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -173,6 +173,22 @@ static void msg_inject_fault(struct messaging_context *msg,
}
#endif /* DEVELOPER */
+NTSTATUS messaging_send_to_children(struct messaging_context *msg_ctx,
+ uint32_t msg_type, DATA_BLOB* data)
+{
+ NTSTATUS status;
+ struct child_pid *child;
+
+ for (child = children; child != NULL; child = child->next) {
+ status = messaging_send(msg_ctx, pid_to_procid(child->pid),
+ msg_type, data);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+ }
+ return NT_STATUS_OK;
+}
+
/*
* Parent smbd process sets its own debug level first and then
* sends a message to all the smbd children to adjust their debug
@@ -185,16 +201,9 @@ static void smbd_msg_debug(struct messaging_context *msg_ctx,
struct server_id server_id,
DATA_BLOB *data)
{
- struct child_pid *child;
-
debug_message(msg_ctx, private_data, MSG_DEBUG, server_id, data);
- for (child = children; child != NULL; child = child->next) {
- messaging_send_buf(msg_ctx, pid_to_procid(child->pid),
- MSG_DEBUG,
- data->data,
- strlen((char *) data->data) + 1);
- }
+ messaging_send_to_children(msg_ctx, MSG_DEBUG, data);
}
static void add_child_pid(pid_t pid)