From cb79cc342e30bb2bbac33868836ea13d2d594c30 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 6 May 2014 13:39:12 +1200 Subject: s3-winbindd: Register winbindd with irpc Change-Id: Ie3c7109fef6982d95e8cad06870334565352e329 Signed-off-by: Andrew Bartlett Reviewed-by: Andreas Schneider --- source3/winbindd/winbindd.c | 32 ++++++++++++++++++++++++++++++++ source3/winbindd/winbindd_proto.h | 1 + source3/wscript_build | 1 + 3 files changed, 34 insertions(+) diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index a1647c947fa..8a2c09e5158 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -39,6 +39,9 @@ #include "messages.h" #include "../lib/util/pidfile.h" #include "util_cluster.h" +#include "source4/lib/messaging/irpc.h" +#include "source4/lib/messaging/messaging.h" +#include "lib/param/param.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_WINBIND @@ -89,6 +92,33 @@ struct messaging_context *winbind_messaging_context(void) return msg; } +struct imessaging_context *winbind_imessaging_context(void) +{ + static struct imessaging_context *msg = NULL; + struct loadparm_context *lp_ctx; + + if (msg != NULL) { + return msg; + } + + lp_ctx = loadparm_init_s3(NULL, loadparm_s3_helpers()); + if (lp_ctx == NULL) { + smb_panic("Could not load smb.conf to init winbindd's imessaging context.\n"); + } + + /* + * Note we MUST use the NULL context here, not the autofree context, + * to avoid side effects in forked children exiting. + */ + msg = imessaging_init(NULL, lp_ctx, procid_self(), winbind_event_context(), false); + talloc_unlink(NULL, lp_ctx); + + if (msg == NULL) { + smb_panic("Could not init winbindd's messaging context.\n"); + } + return msg; +} + /* Reload configuration */ static bool reload_services_file(const char *lfile) @@ -1588,6 +1618,8 @@ int main(int argc, const char **argv) exit_daemon("Winbindd failed to setup listeners", EPIPE); } + irpc_add_name(winbind_imessaging_context(), "winbind_server"); + TALLOC_FREE(frame); if (!interactive) { diff --git a/source3/winbindd/winbindd_proto.h b/source3/winbindd/winbindd_proto.h index 65553f70ed2..642aadd440d 100644 --- a/source3/winbindd/winbindd_proto.h +++ b/source3/winbindd/winbindd_proto.h @@ -27,6 +27,7 @@ /* The following definitions come from winbindd/winbindd.c */ struct messaging_context *winbind_messaging_context(void); +struct imessaging_context *winbind_imessaging_context(void); void request_error(struct winbindd_cli_state *state); void request_ok(struct winbindd_cli_state *state); bool winbindd_setup_sig_term_handler(bool parent); diff --git a/source3/wscript_build b/source3/wscript_build index b1a25d325ed..806a49712c2 100755 --- a/source3/wscript_build +++ b/source3/wscript_build @@ -970,6 +970,7 @@ bld.SAMBA3_BINARY('winbindd/winbindd', RPC_SERVER WB_REQTRANS TDB_VALIDATE + MESSAGING ''', enabled=bld.env.build_winbind, install_path='${SBINDIR}') -- cgit