From 8e1f2ee5f7c5b3ee4edfa7beca289889a4e99cca Mon Sep 17 00:00:00 2001 From: Samuel Cabrero Date: Tue, 12 Dec 2023 15:55:20 +0100 Subject: [PATCH] s3:winbind: Register a messaging filter foreach domain child Instead of registering the "classic" callback for MSG_SMB_CONF_UPDATED, install a message filter to allow other parts of the code to also listen for this message because classic callbacks are delivered only once (see commit a2436b67e5dd47d955a3bea2b83e0693b627ab96). Signed-off-by: Samuel Cabrero Reviewed-by: Alexander Bokovoy --- source3/winbindd/winbindd_dual.c | 34 +++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c index 313e11f149c..ff78b844688 100644 --- a/source3/winbindd/winbindd_dual.c +++ b/source3/winbindd/winbindd_dual.c @@ -922,14 +922,18 @@ void winbind_disconnect_dc_parent(struct messaging_context *msg_ctx, forall_children(winbind_msg_relay_fn, &state); } -static void winbindd_msg_reload_services_child(struct messaging_context *msg, - void *private_data, - uint32_t msg_type, - struct server_id server_id, - DATA_BLOB *data) +static bool winbindd_child_msg_filter(struct messaging_rec *rec, + void *private_data) { - DBG_DEBUG("Got reload-config message\n"); - winbindd_reload_services_file((const char *)private_data); + struct winbindd_child *child = talloc_get_type_abort(private_data, + struct winbindd_child); + + if (rec->msg_type == MSG_SMB_CONF_UPDATED) { + DBG_DEBUG("Got reload-config message\n"); + winbindd_reload_services_file(child->logfilename); + } + + return false; } /* React on 'smbcontrol winbindd reload-config' in the same way as on SIGHUP*/ @@ -1667,6 +1671,7 @@ static bool fork_domain_child(struct winbindd_child *child) NTSTATUS status; ssize_t nwritten; struct tevent_fd *fde; + struct tevent_req *req = NULL; if (child->domain) { DEBUG(10, ("fork_domain_child called for domain '%s'\n", @@ -1794,11 +1799,16 @@ static bool fork_domain_child(struct winbindd_child *child) messaging_register(global_messaging_context(), NULL, MSG_WINBIND_DISCONNECT_DC, winbind_msg_disconnect_dc); - messaging_register( - global_messaging_context(), - child->logfilename, - MSG_SMB_CONF_UPDATED, - winbindd_msg_reload_services_child); + + req = messaging_filtered_read_send(global_event_context(), + global_event_context(), + global_messaging_context(), + winbindd_child_msg_filter, + child); + if (req == NULL) { + DBG_ERR("messaging_filtered_read_send failed\n"); + _exit(1); + } primary_domain = find_our_domain(); -- 2.47.3