mdssvc: fix kMDScopeArray parsing
authorRalph Boehme <slow@samba.org>
Wed, 18 Jan 2023 15:21:16 +0000 (16:21 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 2 Feb 2023 20:14:36 +0000 (20:14 +0000)
In macOS Ventura marshalling of kMDScopeArray in the "openQueryWithParams"
request has changed from

  string: kMDScopeArray
  sl_array_t(#1): {
    string: /foo/bar
  }

to:

  string: kMDScopeArray
  sl_array_t(#1): {
    sl_array_t(#1): {
      string: /foo/bar
    }
  }

With this patch we check both encodings. Bug fixed according to user feedback.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15299
RN: Spotlight doesn't work with latest macOS Ventura

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/rpc_server/mdssvc/mdssvc.c

index 01713722126e8132322060f0471100e680302ccb..9b32c99b8b3a0cef2ceddc1d4883c3d17f29a4e0 100644 (file)
@@ -919,6 +919,12 @@ static bool slrpc_open_query(struct mds_ctx *mds_ctx,
 
        scope = dalloc_get(path_scope, "char *", 0);
        if (scope == NULL) {
+               scope = dalloc_get(path_scope,
+                                  "DALLOC_CTX", 0,
+                                  "char *", 0);
+       }
+       if (scope == NULL) {
+               DBG_ERR("Failed to parse kMDScopeArray\n");
                goto error;
        }