mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
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@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Sun Feb 21 22:28:41 CET 2016 on sn-devel-144
This commit is contained in:
parent
593abe5f6b
commit
6018a7756f
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user