[PATCH] Reintroduce support for RPC modules

Ralph Boehme rb at sernet.de
Fri Feb 19 12:39:47 UTC 2016


Hi!

As mentioned in the tevent-glib-glue thread, I have a small patchset
that reintroduces the possibilty to build RPC services as modules.

The first patch adds the machinery and the second patch modifies the
mdssvc RPC subsystem (Spotlight) to actually make use of it and allow
it to be built as a module. The default is still to link it
statically.

All other RPC subsystem are unmodified and can't be build as shared
module.

Being able to build the Spotlight RPC service as a shared module, is
important, because it allows isolating the library dependencies
(glib2, tracker-sparql and others).

Please review & push if ok. Thanks!

-Ralph

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de,mailto:kontakt@sernet.de
-------------- next part --------------
From cc37efd2626f3d57c15f40ba164d4c96006e6bac Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Sat, 24 Oct 2015 10:50:43 +0200
Subject: [PATCH 1/2] s3:rpc_server: allow building RPC services as shared
 modules

This is the general RPC subsystem change, existing modules must be
tweaked to support being loaded as a module.

The next commit shows how to do this for the Spotlight RPC service.

The general syntax is: --with-shared-modules=rpc_NAME_module

Signed-off-by: Ralph Boehme <slow at samba.org>
---
 source3/rpc_server/rpc_modules.c       | 144 +++++++++++++++++++++++++++++++++
 source3/rpc_server/rpc_modules.h       |  47 +++++++++++
 source3/rpc_server/rpc_service_setup.c |  24 +++++-
 source3/rpc_server/rpc_service_setup.h |   6 ++
 source3/rpc_server/wscript_build       |   3 +-
 source3/wscript                        |   2 +-
 6 files changed, 220 insertions(+), 6 deletions(-)
 create mode 100644 source3/rpc_server/rpc_modules.c
 create mode 100644 source3/rpc_server/rpc_modules.h

diff --git a/source3/rpc_server/rpc_modules.c b/source3/rpc_server/rpc_modules.c
new file mode 100644
index 0000000..f39b1db
--- /dev/null
+++ b/source3/rpc_server/rpc_modules.c
@@ -0,0 +1,144 @@
+/*
+ *  Unix SMB/CIFS implementation.
+ *
+ *  SMBD RPC modules
+ *
+ *  Copyright (c) 2015 Ralph Boehme <slow at samba.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "includes.h"
+#include "rpc_server/rpc_modules.h"
+
+static struct rpc_module *rpc_modules;
+
+struct rpc_module {
+	char *name;
+	struct rpc_module *prev, *next;
+	struct rpc_module_fns *fns;
+};
+
+static struct rpc_module *find_rpc_module(const char *name)
+{
+	struct rpc_module *module = rpc_modules;
+
+	while (module) {
+		if (strequal(module->name, name)) {
+			return module;
+		}
+		module = module->next;
+	}
+
+	return NULL;
+}
+
+NTSTATUS register_rpc_module(struct rpc_module_fns *fns,
+			     const char *name)
+{
+	struct rpc_module *module = NULL;
+
+	if (!name || !name[0]) {
+		DBG_ERR("called with NULL pointer or empty name!\n");
+		return NT_STATUS_INVALID_PARAMETER;
+	}
+
+	if (find_rpc_module(name)) {
+		DBG_ERR("RPC module %s already loaded!\n", name);
+		return NT_STATUS_OBJECT_NAME_COLLISION;
+	}
+
+	module = SMB_XMALLOC_P(struct rpc_module);
+	module->name = smb_xstrdup(name);
+	module->fns = fns;
+
+	DLIST_ADD(rpc_modules, module);
+	DBG_NOTICE("Successfully added RPC module '%s'\n", name);
+
+	return NT_STATUS_OK;
+}
+
+bool setup_rpc_module(struct tevent_context *ev_ctx,
+		      struct messaging_context *msg_ctx,
+		      const char *name)
+{
+	bool ok;
+	struct rpc_module *module = find_rpc_module(name);
+
+	if (module == NULL) {
+		return false;
+	}
+
+	ok = module->fns->setup(ev_ctx, msg_ctx);
+	if (!ok) {
+		DBG_ERR("calling setup for %s failed\n", name);
+	}
+
+	return true;
+}
+
+bool setup_rpc_modules(struct tevent_context *ev_ctx,
+		       struct messaging_context *msg_ctx)
+{
+	bool ok;
+	struct rpc_module *module = rpc_modules;
+
+	for (module = rpc_modules; module; module = module->next) {
+		ok = module->fns->setup(ev_ctx, msg_ctx);
+		if (!ok) {
+			DBG_ERR("calling setup for %s failed\n", module->name);
+		}
+	}
+
+	return true;
+}
+
+bool init_rpc_module(const char *name,
+		     const struct rpc_srv_callbacks *rpc_srv_cb)
+{
+	struct rpc_module *module = find_rpc_module(name);
+	NTSTATUS status;
+
+	if (module == NULL) {
+		return false;
+	}
+
+	status = module->fns->init(rpc_srv_cb);
+	if (!NT_STATUS_IS_OK(status)) {
+		DBG_ERR("calling init for %s failed %s\n",
+			name, nt_errstr(status));
+		return false;
+	}
+
+	return true;
+}
+
+bool shutdown_rpc_module(const char *name)
+{
+	struct rpc_module *module = find_rpc_module(name);
+	NTSTATUS status;
+
+	if (module == NULL) {
+		return false;
+	}
+
+	status = module->fns->shutdown();
+	if (!NT_STATUS_IS_OK(status)) {
+		DBG_ERR("calling shutdown for %s failed %s\n",
+			name, nt_errstr(status));
+		return false;
+	}
+
+	return true;
+}
diff --git a/source3/rpc_server/rpc_modules.h b/source3/rpc_server/rpc_modules.h
new file mode 100644
index 0000000..afac1d9
--- /dev/null
+++ b/source3/rpc_server/rpc_modules.h
@@ -0,0 +1,47 @@
+/*
+ *  Unix SMB/CIFS implementation.
+ *
+ *  SMBD RPC modules
+ *
+ *  Copyright (c) 2015 Ralph Boehme <slow at samba.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _RPC_MODULES_H
+#define _RPC_MODULES_H
+
+struct rpc_srv_callbacks;
+
+struct rpc_module_fns {
+	bool (*setup)(struct tevent_context *ev_ctx, struct messaging_context *msg_ctx);
+	NTSTATUS (*init)(const struct rpc_srv_callbacks *rpc_srv_cb);
+	NTSTATUS (*shutdown)(void);
+};
+
+NTSTATUS register_rpc_module(struct rpc_module_fns *fns,
+			     const char *name);
+
+bool setup_rpc_modules(struct tevent_context *ev_ctx,
+		       struct messaging_context *msg_ctx);
+
+bool setup_rpc_module(struct tevent_context *ev_ctx,
+		      struct messaging_context *msg_ctx,
+		      const char *name);
+
+bool init_rpc_module(const char *name,
+		     const struct rpc_srv_callbacks *rpc_srv_cb);
+
+bool shutdown_rpc_module(const char *name);
+#endif
diff --git a/source3/rpc_server/rpc_service_setup.c b/source3/rpc_server/rpc_service_setup.c
index ee995a8..d4918a6 100644
--- a/source3/rpc_server/rpc_service_setup.c
+++ b/source3/rpc_server/rpc_service_setup.c
@@ -53,13 +53,16 @@
 #include "rpc_server/rpc_ep_register.h"
 #include "rpc_server/rpc_server.h"
 #include "rpc_server/rpc_config.h"
+#include "rpc_server/rpc_modules.h"
 #include "rpc_server/epmapper/srv_epmapper.h"
 
+static_decl_rpc;
+
 /* Common routine for embedded RPC servers */
-static bool rpc_setup_embedded(struct tevent_context *ev_ctx,
-			       struct messaging_context *msg_ctx,
-			       const struct ndr_interface_table *t,
-			       const char *pipe_name)
+bool rpc_setup_embedded(struct tevent_context *ev_ctx,
+			struct messaging_context *msg_ctx,
+			const struct ndr_interface_table *t,
+			const char *pipe_name)
 {
 	struct dcerpc_binding_vector *v;
 	enum rpc_service_mode_e epm_mode = rpc_epmapper_mode();
@@ -500,6 +503,7 @@ bool dcesrv_ep_setup(struct tevent_context *ev_ctx,
 {
 	TALLOC_CTX *tmp_ctx;
 	bool ok;
+	init_module_fn *mod_init_fns = NULL;
 
 	tmp_ctx = talloc_stackframe();
 	if (tmp_ctx == NULL) {
@@ -585,6 +589,18 @@ bool dcesrv_ep_setup(struct tevent_context *ev_ctx,
 	}
 #endif
 
+	/* Initialize static subsystems */
+	static_init_rpc;
+
+	/* Initialize shared modules */
+	mod_init_fns = load_samba_modules(tmp_ctx, "rpc");
+	run_init_functions(mod_init_fns);
+
+	ok = setup_rpc_modules(ev_ctx, msg_ctx);
+	if (!ok) {
+		goto done;
+	}
+
 done:
 	talloc_free(tmp_ctx);
 	return ok;
diff --git a/source3/rpc_server/rpc_service_setup.h b/source3/rpc_server/rpc_service_setup.h
index 2e27995..da89cbc 100644
--- a/source3/rpc_server/rpc_service_setup.h
+++ b/source3/rpc_server/rpc_service_setup.h
@@ -23,6 +23,7 @@
 #define _RPC_EP_SETUP_H
 
 struct ndr_interface_table;
+struct rpc_srv_callbacks;
 
 /**
  * @brief Register an endpoint at the endpoint mapper.
@@ -51,6 +52,11 @@ NTSTATUS rpc_ep_setup_register(struct tevent_context *ev_ctx,
 bool dcesrv_ep_setup(struct tevent_context *ev_ctx,
 		     struct messaging_context *msg_ctx);
 
+bool rpc_setup_embedded(struct tevent_context *ev_ctx,
+			struct messaging_context *msg_ctx,
+			const struct ndr_interface_table *t,
+			const char *pipe_name);
+
 #endif /* _RPC_EP_SETUP_H */
 
 /* vim: set ts=8 sw=8 noet cindent ft=c.doxygen: */
diff --git a/source3/rpc_server/wscript_build b/source3/rpc_server/wscript_build
index 278e0bd..ae4c061 100755
--- a/source3/rpc_server/wscript_build
+++ b/source3/rpc_server/wscript_build
@@ -146,8 +146,9 @@ bld.SAMBA3_SUBSYSTEM('RPC_SERVER_REGISTER',
                     deps='samba-util')
 
 bld.SAMBA3_SUBSYSTEM('RPC_SERVICE',
-                    source='rpc_service_setup.c',
+                    source='rpc_service_setup.c rpc_modules.c',
                     deps='''
+                    rpc
                     RPC_SERVER
                     RPC_SERVER_REGISTER
                     RPC_SAMR
diff --git a/source3/wscript b/source3/wscript
index c6fdb1b..b65e3eb 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -1725,7 +1725,7 @@ main() {
     static_list = {}
     shared_list = {}
 
-    prefixes = ['vfs', 'pdb', 'auth', 'nss_info', 'charset', 'idmap', 'gpext', 'perfcount']
+    prefixes = ['vfs', 'pdb', 'auth', 'nss_info', 'charset', 'idmap', 'gpext', 'perfcount', 'rpc']
     conf.env['MODULE_PREFIXES'] = prefixes
     for p in prefixes:
         for m in final_static_modules:
-- 
2.5.0


From 10cbccb146a786dba591b1f2518f65c012871b6c Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Tue, 6 Oct 2015 13:45:33 +0200
Subject: [PATCH 2/2] s3:rpc_server: make it possible to build mdssvc as a
 shared module

Allow building mdssvc RPC service as shared module:

  --with-shared-modules=rpc_mdssvc_module

The default is to build it static.

Signed-off-by: Ralph Boehme <slow at samba.org>
---
 source3/rpc_server/mdssd.c                | 40 ++++---------------
 source3/rpc_server/mdssvc/srv_mdssvc_nt.c | 66 +++++++++++++++++++++++++++++++
 source3/rpc_server/rpc_service_setup.c    | 59 ---------------------------
 source3/rpc_server/wscript_build          | 29 ++++++++------
 source3/wscript                           |  1 +
 5 files changed, 90 insertions(+), 105 deletions(-)

diff --git a/source3/rpc_server/mdssd.c b/source3/rpc_server/mdssd.c
index f76d13e..e4c12cd 100644
--- a/source3/rpc_server/mdssd.c
+++ b/source3/rpc_server/mdssd.c
@@ -34,6 +34,7 @@
 #include "rpc_server/rpc_server.h"
 #include "rpc_server/rpc_ep_register.h"
 #include "rpc_server/rpc_sock_helper.h"
+#include "rpc_server/rpc_modules.h"
 
 #include "librpc/gen_ndr/srv_mdssvc.h"
 #include "rpc_server/mdssvc/srv_mdssvc_nt.h"
@@ -91,7 +92,7 @@ static void mdssd_sig_term_handler(struct tevent_context *ev,
 				   void *siginfo,
 				   void *private_data)
 {
-	rpc_mdssvc_shutdown();
+	shutdown_rpc_module("mdssvc");
 
 	DEBUG(0, ("termination signal\n"));
 	exit(0);
@@ -228,10 +229,9 @@ static bool mdssd_child_init(struct tevent_context *ev_ctx,
 	messaging_register(msg_ctx, ev_ctx,
 			   MSG_PREFORK_PARENT_EVENT, parent_ping);
 
-	status = rpc_mdssvc_init(NULL);
-	if (!NT_STATUS_IS_OK(status)) {
-		DEBUG(0, ("Failed to intialize RPC: %s\n",
-			  nt_errstr(status)));
+	ok = init_rpc_module("mdssvc", NULL);
+	if (!ok) {
+		DBG_ERR("Failed to de-intialize RPC\n");
 		return false;
 	}
 
@@ -608,27 +608,6 @@ done:
 	return ok;
 }
 
-static bool mdssvc_init_cb(void *ptr)
-{
-	struct messaging_context *msg_ctx =
-		talloc_get_type_abort(ptr, struct messaging_context);
-	bool ok;
-
-	ok = init_service_mdssvc(msg_ctx);
-	if (!ok) {
-		return false;
-	}
-
-	return true;
-}
-
-static bool mdssvc_shutdown_cb(void *ptr)
-{
-	shutdown_service_mdssvc();
-
-	return true;
-}
-
 void start_mdssd(struct tevent_context *ev_ctx,
 		 struct messaging_context *msg_ctx)
 {
@@ -638,7 +617,6 @@ void start_mdssd(struct tevent_context *ev_ctx,
 	pid_t pid;
 	int rc;
 	bool ok;
-	struct rpc_srv_callbacks mdssvc_cb;
 
 	DEBUG(1, ("Forking Metadata Service Daemon\n"));
 
@@ -720,12 +698,8 @@ void start_mdssd(struct tevent_context *ev_ctx,
 	messaging_register(msg_ctx, ev_ctx,
 			   MSG_PREFORK_CHILD_EVENT, child_ping);
 
-	mdssvc_cb.init         = mdssvc_init_cb;
-	mdssvc_cb.shutdown     = mdssvc_shutdown_cb;
-	mdssvc_cb.private_data = msg_ctx;
-
-	status = rpc_mdssvc_init(&mdssvc_cb);
-	if (!NT_STATUS_IS_OK(status)) {
+	ok = setup_rpc_module(ev_ctx, msg_ctx, "mdssvc");
+	if (!ok) {
 		exit(1);
 	}
 
diff --git a/source3/rpc_server/mdssvc/srv_mdssvc_nt.c b/source3/rpc_server/mdssvc/srv_mdssvc_nt.c
index cb0d759..37b13e7 100644
--- a/source3/rpc_server/mdssvc/srv_mdssvc_nt.c
+++ b/source3/rpc_server/mdssvc/srv_mdssvc_nt.c
@@ -19,6 +19,9 @@
 
 #include "includes.h"
 #include "ntdomain.h"
+#include "rpc_server/rpc_service_setup.h"
+#include "rpc_server/rpc_config.h"
+#include "rpc_server/rpc_modules.h"
 #include "rpc_server/mdssvc/srv_mdssvc_nt.h"
 #include "../librpc/gen_ndr/srv_mdssvc.h"
 #include "libcli/security/security_token.h"
@@ -28,6 +31,69 @@
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_RPC_SRV
 
+static bool mdssvc_init_cb(void *ptr)
+{
+	struct messaging_context *msg_ctx =
+		talloc_get_type_abort(ptr, struct messaging_context);
+	bool ok;
+
+	ok = init_service_mdssvc(msg_ctx);
+	if (!ok) {
+		return false;
+	}
+
+	return true;
+}
+
+static bool mdssvc_shutdown_cb(void *ptr)
+{
+	shutdown_service_mdssvc();
+
+	return true;
+}
+
+static bool rpc_setup_mdssvc(struct tevent_context *ev_ctx,
+			     struct messaging_context *msg_ctx)
+{
+	const struct ndr_interface_table *t = &ndr_table_mdssvc;
+	const char *pipe_name = "mdssvc";
+	struct rpc_srv_callbacks mdssvc_cb;
+	NTSTATUS status;
+	enum rpc_service_mode_e service_mode = rpc_service_mode(t->name);
+	enum rpc_daemon_type_e mdssvc_type = rpc_mdssd_daemon();
+
+	mdssvc_cb.init         = mdssvc_init_cb;
+	mdssvc_cb.shutdown     = mdssvc_shutdown_cb;
+	mdssvc_cb.private_data = msg_ctx;
+
+	status = rpc_mdssvc_init(&mdssvc_cb);
+	if (!NT_STATUS_IS_OK(status)) {
+		return false;
+	}
+
+	if (service_mode != RPC_SERVICE_MODE_EMBEDDED
+	    || mdssvc_type != RPC_DAEMON_EMBEDDED) {
+		return true;
+	}
+
+	return rpc_setup_embedded(ev_ctx, msg_ctx, t, pipe_name);
+}
+
+static struct rpc_module_fns rpc_module_mdssvc_fns = {
+	.setup = rpc_setup_mdssvc,
+	.init = rpc_mdssvc_init,
+	.shutdown = rpc_mdssvc_shutdown,
+};
+
+static_decl_rpc;
+NTSTATUS rpc_mdssvc_module_init(void)
+{
+	DBG_DEBUG("Registering mdsvc RPC service\n");
+
+	return register_rpc_module(&rpc_module_mdssvc_fns, "mdssvc");
+}
+
+
 bool init_service_mdssvc(struct messaging_context *msg_ctx)
 {
 	return mds_init(msg_ctx);
diff --git a/source3/rpc_server/rpc_service_setup.c b/source3/rpc_server/rpc_service_setup.c
index d4918a6..41ae1ac 100644
--- a/source3/rpc_server/rpc_service_setup.c
+++ b/source3/rpc_server/rpc_service_setup.c
@@ -38,14 +38,12 @@
 #include "../librpc/gen_ndr/srv_spoolss.h"
 #include "../librpc/gen_ndr/srv_svcctl.h"
 #include "../librpc/gen_ndr/srv_wkssvc.h"
-#include "../librpc/gen_ndr/srv_mdssvc.h"
 
 #include "printing/nt_printing_migrate_internal.h"
 #include "rpc_server/eventlog/srv_eventlog_reg.h"
 #include "rpc_server/svcctl/srv_svcctl_reg.h"
 #include "rpc_server/spoolss/srv_spoolss_nt.h"
 #include "rpc_server/svcctl/srv_svcctl_nt.h"
-#include "rpc_server/mdssvc/srv_mdssvc_nt.h"
 
 #include "librpc/rpc/dcerpc_ep.h"
 #include "rpc_server/rpc_sock_helper.h"
@@ -448,56 +446,6 @@ static bool rpc_setup_initshutdown(struct tevent_context *ev_ctx,
 	return rpc_setup_embedded(ev_ctx, msg_ctx, t, NULL);
 }
 
-#ifdef WITH_SPOTLIGHT
-static bool mdssvc_init_cb(void *ptr)
-{
-	struct messaging_context *msg_ctx =
-		talloc_get_type_abort(ptr, struct messaging_context);
-	bool ok;
-
-	ok = init_service_mdssvc(msg_ctx);
-	if (!ok) {
-		return false;
-	}
-
-	return true;
-}
-
-static bool mdssvc_shutdown_cb(void *ptr)
-{
-	shutdown_service_mdssvc();
-
-	return true;
-}
-
-static bool rpc_setup_mdssvc(struct tevent_context *ev_ctx,
-			     struct messaging_context *msg_ctx)
-{
-	const struct ndr_interface_table *t = &ndr_table_mdssvc;
-	const char *pipe_name = "mdssvc";
-	struct rpc_srv_callbacks mdssvc_cb;
-	NTSTATUS status;
-	enum rpc_service_mode_e service_mode = rpc_service_mode(t->name);
-	enum rpc_daemon_type_e mdssvc_type = rpc_mdssd_daemon();
-
-	if (service_mode != RPC_SERVICE_MODE_EMBEDDED
-	    || mdssvc_type != RPC_DAEMON_EMBEDDED) {
-		return true;
-	}
-
-	mdssvc_cb.init         = mdssvc_init_cb;
-	mdssvc_cb.shutdown     = mdssvc_shutdown_cb;
-	mdssvc_cb.private_data = msg_ctx;
-
-	status = rpc_mdssvc_init(&mdssvc_cb);
-	if (!NT_STATUS_IS_OK(status)) {
-		return false;
-	}
-
-	return rpc_setup_embedded(ev_ctx, msg_ctx, t, pipe_name);
-}
-#endif
-
 bool dcesrv_ep_setup(struct tevent_context *ev_ctx,
 		     struct messaging_context *msg_ctx)
 {
@@ -582,13 +530,6 @@ bool dcesrv_ep_setup(struct tevent_context *ev_ctx,
 		goto done;
 	}
 
-#ifdef WITH_SPOTLIGHT
-	ok = rpc_setup_mdssvc(ev_ctx, msg_ctx);
-	if (!ok) {
-		goto done;
-	}
-#endif
-
 	/* Initialize static subsystems */
 	static_init_rpc;
 
diff --git a/source3/rpc_server/wscript_build b/source3/rpc_server/wscript_build
index ae4c061..1d0facb 100755
--- a/source3/rpc_server/wscript_build
+++ b/source3/rpc_server/wscript_build
@@ -128,17 +128,21 @@ bld.SAMBA3_SUBSYSTEM('RPC_WKSSVC',
                     ../../librpc/gen_ndr/srv_wkssvc.c''',
                     deps='LIBNET')
 
-bld.SAMBA3_SUBSYSTEM('RPC_MDSSVC',
-                    source='''mdssvc/mdssvc.c
-                    mdssvc/dalloc.c
-                    mdssvc/marshalling.c
-                    mdssvc/sparql_mapping.c
-                    mdssvc/sparql_parser.c
-                    mdssvc/sparql_lexer.c
-                    mdssvc/srv_mdssvc_nt.c
-                    ../../librpc/gen_ndr/srv_mdssvc.c''',
-                    deps='samba-util ' + bld.env['libtracker'],
-                    enabled=bld.env.with_spotlight)
+bld.SAMBA3_MODULE('rpc_mdssvc_module',
+                  subsystem='rpc',
+                  allow_undefined_symbols=True,
+                  source='''mdssvc/mdssvc.c
+                  mdssvc/dalloc.c
+                  mdssvc/marshalling.c
+                  mdssvc/sparql_mapping.c
+                  mdssvc/sparql_parser.c
+                  mdssvc/sparql_lexer.c
+                  mdssvc/srv_mdssvc_nt.c
+                  ../../librpc/gen_ndr/srv_mdssvc.c''',
+                  init_function='',
+                  deps='samba-util ' + bld.env['libtracker'],
+                  internal_module=bld.SAMBA3_IS_STATIC_MODULE('rpc_mdssvc_module'),
+                  enabled=bld.SAMBA3_IS_ENABLED_MODULE('rpc_mdssvc_module'))
 
 # RPC_SERVICE
 bld.SAMBA3_SUBSYSTEM('RPC_SERVER_REGISTER',
@@ -168,7 +172,6 @@ bld.SAMBA3_SUBSYSTEM('RPC_SERVICE',
                     RPC_SERVER
                     RPC_EPMAPPER
 		    RPC_FSS_AGENT
-                    RPC_MDSSVC
                     ''')
 
 # RPC_DAEMONS
@@ -189,6 +192,6 @@ bld.SAMBA3_SUBSYSTEM('FSSD',
                     deps='samba-util')
 
 bld.SAMBA3_SUBSYSTEM('MDSSD',
-                    source='mdssd.c',
+                    source='mdssd.c rpc_modules.c',
                     deps='RPC_SOCK_HELPER samba-util',
                     enabled=bld.env.with_spotlight)
diff --git a/source3/wscript b/source3/wscript
index b65e3eb..c6504c6 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -1562,6 +1562,7 @@ main() {
         if not conf.env.with_spotlight:
             conf.fatal("Spotlight support requested but tracker-sparql library missing")
         Logs.info("building with Spotlight support")
+        default_static_modules.extend(TO_LIST('rpc_mdssvc_module'))
 
     forced_static_modules.extend(TO_LIST('auth_domain auth_builtin auth_sam auth_winbind'))
     default_static_modules.extend(TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam
-- 
2.5.0



More information about the samba-technical mailing list