summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2014-05-06 13:39:12 +1200
committerAndrew Bartlett <abartlet@samba.org>2014-06-11 10:18:26 +0200
commitcb79cc342e30bb2bbac33868836ea13d2d594c30 (patch)
tree6f240cc45ccddd8b5b29e885a96fc932104b1cf4
parent597d2a7a29f768f51cbcbc13de56a4dc349e20e4 (diff)
downloadsamba-cb79cc342e30bb2bbac33868836ea13d2d594c30.tar.gz
samba-cb79cc342e30bb2bbac33868836ea13d2d594c30.tar.xz
samba-cb79cc342e30bb2bbac33868836ea13d2d594c30.zip
s3-winbindd: Register winbindd with irpc
Change-Id: Ie3c7109fef6982d95e8cad06870334565352e329 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
-rw-r--r--source3/winbindd/winbindd.c32
-rw-r--r--source3/winbindd/winbindd_proto.h1
-rwxr-xr-xsource3/wscript_build1
3 files changed, 34 insertions, 0 deletions
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}')