Add a new default backend that, while allowing mdsvc RPC and search queries from
clients, always returns no results.
Shares using this backend will behave the same way as shares on a macOS SMB
server where indexing is disabled.
This change will later also allow us to compile the Spotlight RPC service by
default which is a big step in the direction of adding tests to CI.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
<para>
Spotlight search backend. Available backends:
+ <itemizedlist>
+ <listitem><para><constant>noindex</constant> -
+ a backend that returns no results.
+ </para></listitem>
+
+ </itemizedlist>
+
<itemizedlist>
<listitem><para><constant>tracker</constant> -
Gnome Tracker.
</itemizedlist>
</para>
</description>
-<value type="default">tracker</value>
+<value type="default">noindex</value>
</samba:parameter>
lpcfg_do_global_parameter(lp_ctx, "debug encryption", "no");
- lpcfg_do_global_parameter(lp_ctx, "spotlight backend", "tracker");
+ lpcfg_do_global_parameter(lp_ctx, "spotlight backend", "noindex");
for (i = 0; parm_table[i].label; i++) {
if (!(lp_ctx->flags[i] & FLAG_CMDLINE)) {
/* Spotlight backend options */
enum spotlight_backend_options {
+ SPOTLIGHT_BACKEND_NOINDEX,
SPOTLIGHT_BACKEND_TRACKER,
};
};
static const struct enum_list enum_spotlight_backend[] = {
+ {SPOTLIGHT_BACKEND_NOINDEX, "noindex"},
{SPOTLIGHT_BACKEND_TRACKER, "tracker"},
{-1, NULL}
};
.param_opt = NULL,
.smbd_search_ask_sharemode = true,
.smbd_getinfo_ask_sharemode = true,
- .spotlight_backend = SPOTLIGHT_BACKEND_TRACKER,
+ .spotlight_backend = SPOTLIGHT_BACKEND_NOINDEX,
.dummy = ""
};
#include "lib/dbwrap/dbwrap_rbt.h"
#include "libcli/security/dom_sid.h"
#include "mdssvc.h"
+#include "mdssvc_noindex.h"
#ifdef HAVE_SPOTLIGHT_BACKEND_TRACKER
#include "mdssvc_tracker.h"
#endif
mdssvc_ctx->ev_ctx = ev;
+ ok = mdsscv_backend_noindex.init(mdssvc_ctx);
+ if (!ok) {
+ DBG_ERR("backend init failed\n");
+ TALLOC_FREE(mdssvc_ctx);
+ return NULL;
+ }
+
#ifdef HAVE_SPOTLIGHT_BACKEND_TRACKER
ok = mdsscv_backend_tracker.init(mdssvc_ctx);
if (!ok) {
return false;
}
+ ok = mdsscv_backend_noindex.shutdown(mdssvc_ctx);
+ if (!ok) {
+ goto fail;
+ }
#ifdef HAVE_SPOTLIGHT_BACKEND_TRACKER
ok = mdsscv_backend_tracker.shutdown(mdssvc_ctx);
if (!ok) {
backend = lp_spotlight_backend(snum);
switch (backend) {
+ case SPOTLIGHT_BACKEND_NOINDEX:
+ mds_ctx->backend = &mdsscv_backend_noindex;
+ break;
#ifdef HAVE_SPOTLIGHT_BACKEND_TRACKER
case SPOTLIGHT_BACKEND_TRACKER:
mds_ctx->backend = &mdsscv_backend_tracker;
--- /dev/null
+/*
+ Unix SMB/CIFS implementation.
+ Main metadata server / Spotlight routines / noindex backend
+
+ Copyright (C) Ralph Boehme 2019
+
+ 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"
+
+static bool mdssvc_noindex_init(struct mdssvc_ctx *mdssvc_ctx)
+{
+ return true;
+}
+
+static bool mdssvc_noindex_shutdown(struct mdssvc_ctx *mdssvc_ctx)
+{
+ return true;
+}
+
+static bool mds_noindex_connect(struct mds_ctx *mds_ctx)
+{
+ return true;
+}
+
+static bool mds_noindex_search_start(struct sl_query *slq)
+{
+ slq->state = SLQ_STATE_DONE;
+ return true;
+}
+
+static bool mds_noindex_search_cont(struct sl_query *slq)
+{
+ slq->state = SLQ_STATE_DONE;
+ return true;
+}
+
+struct mdssvc_backend mdsscv_backend_noindex = {
+ .init = mdssvc_noindex_init,
+ .shutdown = mdssvc_noindex_shutdown,
+ .connect = mds_noindex_connect,
+ .search_start = mds_noindex_search_start,
+ .search_cont = mds_noindex_search_cont,
+};
--- /dev/null
+/*
+ Unix SMB/CIFS implementation.
+ Main metadata server / Spotlight routines / noindex backend
+
+ Copyright (C) Ralph Boehme 2019
+
+ 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 _MDSSVC_NOINDEX_H_
+#define _MDSSVC_NOINDEX_H_
+
+extern struct mdssvc_backend mdsscv_backend_noindex;
+
+#endif /* _MDSSVC_VOID_H_ */
rpc_mdssvc_sources = '''
mdssvc/mdssvc.c
+ mdssvc/mdssvc_noindex.c
mdssvc/srv_mdssvc_nt.c
../../librpc/gen_ndr/srv_mdssvc.c
'''
conf.env.with_spotlight = False
if Options.options.with_spotlight:
- backends = []
+ backends = ['noindex']
if conf.CONFIG_SET('HAVE_TRACKER') and conf.CONFIG_SET('HAVE_GLIB'):
conf.env.spotlight_backend_tracker = True
backends.append('tracker')
conf.fatal("Missing support for Unicode normalisation. "
"Try installing icu-dev or libicu-devel.")
- if not conf.env.with_spotlight:
- if not conf.CONFIG_SET('HAVE_TRACKER'):
- Logs.warn('Missing libtracker-sparql development files for Spotlight backend "tracker"')
- if not conf.CONFIG_SET('HAVE_GLIB'):
- Logs.warn('Missing glib-2.0 development files for Spotlight backend "tracker"')
- conf.fatal("Spotlight support requested, but dependencies missing")
+ if not conf.CONFIG_SET('HAVE_TRACKER'):
+ Logs.warn('Missing libtracker-sparql development files for Spotlight backend "tracker"')
+ if not conf.CONFIG_SET('HAVE_GLIB'):
+ Logs.warn('Missing glib-2.0 development files for Spotlight backend "tracker"')
Logs.info("Building with Spotlight support, available backends: %s" % ', '.join(backends))
default_static_modules.extend(TO_LIST('rpc_mdssvc_module'))