1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

s3-mdssvc: add Spotlight RPC stubs

'mdssvc' aka 'Metadata Search Service' is an RPC service used by Apple
for passing marshalled Spotlight search queries and results between
client to server.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Ralph Boehme 2014-07-23 09:58:45 +02:00 committed by Ralph Böhme
parent 5c6e2b2b1f
commit 63dd793cde
6 changed files with 147 additions and 0 deletions

View File

@ -0,0 +1,31 @@
/*
Unix SMB/CIFS implementation.
Main metadata server / Spotlight routines
Copyright (C) Ralph Boehme 2012-2014
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 "mdssvc.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_SRV
int mds_dispatch(void)
{
DEBUG(10, ("mds_dispatch\n"));
return 0;
}

View File

@ -0,0 +1,21 @@
/*
Unix SMB/CIFS implementation.
Main metadata server / Spotlight routines
Copyright (C) Ralph Boehme 2012-2014
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/>.
*/
int mds_dispatch(void);

View File

@ -0,0 +1,57 @@
/*
* Unix SMB/CIFS implementation.
* RPC Pipe client / server routines for mdssvc
* Copyright (C) Ralph Boehme 2014
*
* 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 "mdssvc.h"
#include "ntdomain.h"
#include "../librpc/gen_ndr/srv_mdssvc.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_SRV
void _mdssvc_open(struct pipes_struct *p, struct mdssvc_open *r)
{
DEBUG(10, ("%s\n", __func__));
p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
return;
}
void _mdssvc_unknown1(struct pipes_struct *p, struct mdssvc_unknown1 *r)
{
DEBUG(10, ("%s\n", __func__));
p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
return;
}
void _mdssvc_cmd(struct pipes_struct *p, struct mdssvc_cmd *r)
{
DEBUG(10, ("%s\n", __func__));
p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
mds_dispatch();
return;
}
void _mdssvc_close(struct pipes_struct *p, struct mdssvc_close *r)
{
DEBUG(10, ("%s\n", __func__));
p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
return;
}

View File

@ -31,6 +31,7 @@ struct rpc_service_defaults {
const char *def_mode; const char *def_mode;
} rpc_service_defaults[] = { } rpc_service_defaults[] = {
{ "epmapper", "disabled" }, { "epmapper", "disabled" },
{ "mdssvc", "disabled" },
/* { "spoolss", "embedded" }, */ /* { "spoolss", "embedded" }, */
/* { "lsarpc", "embedded" }, */ /* { "lsarpc", "embedded" }, */
/* { "samr", "embedded" }, */ /* { "samr", "embedded" }, */

View File

@ -38,6 +38,7 @@
#include "../librpc/gen_ndr/srv_spoolss.h" #include "../librpc/gen_ndr/srv_spoolss.h"
#include "../librpc/gen_ndr/srv_svcctl.h" #include "../librpc/gen_ndr/srv_svcctl.h"
#include "../librpc/gen_ndr/srv_wkssvc.h" #include "../librpc/gen_ndr/srv_wkssvc.h"
#include "../librpc/gen_ndr/srv_mdssvc.h"
#include "printing/nt_printing_migrate_internal.h" #include "printing/nt_printing_migrate_internal.h"
#include "rpc_server/eventlog/srv_eventlog_reg.h" #include "rpc_server/eventlog/srv_eventlog_reg.h"
@ -443,6 +444,27 @@ static bool rpc_setup_initshutdown(struct tevent_context *ev_ctx,
return rpc_setup_embedded(ev_ctx, msg_ctx, t, NULL); return rpc_setup_embedded(ev_ctx, msg_ctx, t, NULL);
} }
#ifdef WITH_SPOTLIGHT
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";
NTSTATUS status;
enum rpc_service_mode_e service_mode = rpc_service_mode(t->name);
if (service_mode != RPC_SERVICE_MODE_EMBEDDED) {
return true;
}
status = rpc_mdssvc_init(NULL);
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, bool dcesrv_ep_setup(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx) struct messaging_context *msg_ctx)
{ {
@ -526,6 +548,13 @@ bool dcesrv_ep_setup(struct tevent_context *ev_ctx,
goto done; goto done;
} }
#ifdef WITH_SPOTLIGHT
ok = rpc_setup_mdssvc(ev_ctx, msg_ctx);
if (!ok) {
goto done;
}
#endif
done: done:
talloc_free(tmp_ctx); talloc_free(tmp_ctx);
return ok; return ok;

View File

@ -128,6 +128,13 @@ bld.SAMBA3_SUBSYSTEM('RPC_WKSSVC',
../../librpc/gen_ndr/srv_wkssvc.c''', ../../librpc/gen_ndr/srv_wkssvc.c''',
deps='LIBNET') deps='LIBNET')
bld.SAMBA3_SUBSYSTEM('RPC_MDSSVC',
source='''mdssvc/mdssvc.c
mdssvc/srv_mdssvc_nt.c
../../librpc/gen_ndr/srv_mdssvc.c''',
deps='samba-util ' + bld.env['libtracker'],
enabled=bld.env.with_spotlight)
# RPC_SERVICE # RPC_SERVICE
bld.SAMBA3_SUBSYSTEM('RPC_SERVER_REGISTER', bld.SAMBA3_SUBSYSTEM('RPC_SERVER_REGISTER',
source='rpc_ep_register.c ../librpc/rpc/dcerpc_ep.c', source='rpc_ep_register.c ../librpc/rpc/dcerpc_ep.c',
@ -155,6 +162,7 @@ bld.SAMBA3_SUBSYSTEM('RPC_SERVICE',
RPC_SERVER RPC_SERVER
RPC_EPMAPPER RPC_EPMAPPER
RPC_FSS_AGENT RPC_FSS_AGENT
RPC_MDSSVC
''') ''')
# RPC_DAEMONS # RPC_DAEMONS