A Mac SMB server returns an all zero handle and an empty path if Spotlight is
disabled on a share. We must return the exact same error return in order to
trigger client-side searching.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=15086
pcap: https://www.samba.org/~slow/pcaps/mac-bigsur-smbserver-spotlight-disabled.pcapng.gz
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Tue Jul 12 15:42:52 UTC 2022 on sn-devel-184
+++ /dev/null
-^samba3.rpc.mdssvc.rpccmd.open_spotlight_disabled\(fileserver\)
smb_iconv_t iconv_hnd = (smb_iconv_t)-1;
NTSTATUS status;
+ if (!lp_spotlight(snum)) {
+ return NT_STATUS_WRONG_VOLUME;
+ }
+
mds_ctx = talloc_zero(mem_ctx, struct mds_ctx);
if (mds_ctx == NULL) {
return NT_STATUS_NO_MEMORY;
}
backend = lp_spotlight_backend(snum);
- if (!lp_spotlight(snum)) {
- backend = SPOTLIGHT_BACKEND_NOINDEX;
- }
switch (backend) {
case SPOTLIGHT_BACKEND_NOINDEX:
mds_ctx->backend = &mdsscv_backend_noindex;
path,
&mds_ctx);
if (!NT_STATUS_IS_OK(status)) {
- DBG_WARNING("mds_init_ctx() path [%s] failed: %s\n",
- path, nt_errstr(status));
+ DBG_DEBUG("mds_init_ctx() path [%s] failed: %s\n",
+ path, nt_errstr(status));
return status;
}
r->in.share_name,
path,
r->out.handle);
+ if (NT_STATUS_EQUAL(status, NT_STATUS_WRONG_VOLUME)) {
+ ZERO_STRUCTP(r->out.handle);
+ talloc_free(path);
+ return;
+ }
if (!NT_STATUS_IS_OK(status)) {
DBG_ERR("Couldn't create policy handle for %s\n",
r->in.share_name);