]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
mdssvc: return all-zero policy handle if spotlight is disabled
authorRalph Boehme <slow@samba.org>
Wed, 25 May 2022 15:37:22 +0000 (17:37 +0200)
committerNoel Power <npower@samba.org>
Tue, 12 Jul 2022 15:42:52 +0000 (15:42 +0000)
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

selftest/knownfail.d/samba3.rpc.mdssvc [deleted file]
source3/rpc_server/mdssvc/mdssvc.c
source3/rpc_server/mdssvc/srv_mdssvc_nt.c

diff --git a/selftest/knownfail.d/samba3.rpc.mdssvc b/selftest/knownfail.d/samba3.rpc.mdssvc
deleted file mode 100644 (file)
index 7a6ed0f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-^samba3.rpc.mdssvc.rpccmd.open_spotlight_disabled\(fileserver\)
index fafbd5e784104c6202775d13dbd707b041b39113..01713722126e8132322060f0471100e680302ccb 100644 (file)
@@ -1591,6 +1591,10 @@ NTSTATUS mds_init_ctx(TALLOC_CTX *mem_ctx,
        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;
@@ -1603,9 +1607,6 @@ NTSTATUS mds_init_ctx(TALLOC_CTX *mem_ctx,
        }
 
        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;
index 2d572a887d0b17a43f32fa23bea36ee4d9c0b405..2fca15cb8a8dde732bc389def8ac22c5eb32b645 100644 (file)
@@ -61,8 +61,8 @@ static NTSTATUS create_mdssvc_policy_handle(TALLOC_CTX *mem_ctx,
                              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;
        }
 
@@ -109,6 +109,11 @@ void _mdssvc_open(struct pipes_struct *p, struct mdssvc_open *r)
                                             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);