From e0410fb9c58f2ce82fd18c2b617f57e1a28bb03a Mon Sep 17 00:00:00 2001 From: Mike M Pestorich Date: Fri, 19 Aug 2016 21:59:22 -0700 Subject: [PATCH] s3/rpc_server: Character Encode Spotlight Queries Fix path escaping in Spotlight so paths with spaces or special characters can be properly matched to tracker paths. Signed-off-by: Mike M Pestorich (similar to github.com/netatalk/netatalk/commit/90aa43d) --- source3/rpc_server/mdssvc/mdssvc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source3/rpc_server/mdssvc/mdssvc.c b/source3/rpc_server/mdssvc/mdssvc.c index 44d7703..53214d5 100644 --- a/source3/rpc_server/mdssvc/mdssvc.c +++ b/source3/rpc_server/mdssvc/mdssvc.c @@ -1135,7 +1135,7 @@ static bool slrpc_open_query(struct mds_ctx *mds_ctx, sl_cnids_t *cnids; struct sl_query *slq = NULL; int result; - char *querystring; + char *querystring, *scope; array = dalloc_zero(reply, sl_array_t); if (array == NULL) { @@ -1214,16 +1214,18 @@ static bool slrpc_open_query(struct mds_ctx *mds_ctx, goto error; } - slq->path_scope = dalloc_get(path_scope, "char *", 0); - if (slq->path_scope == NULL) { + scope = g_uri_escape_string(dalloc_get(path_scope, "char *", 0), + G_URI_RESERVED_CHARS_ALLOWED_IN_PATH, TRUE); + if (scope == NULL) { goto error; } - slq->path_scope = talloc_strdup(slq, slq->path_scope); + slq->path_scope = talloc_strdup(slq, scope); if (slq->path_scope == NULL) { goto error; } + g_free(scope); reqinfo = dalloc_value_for_key(query, "DALLOC_CTX", 0, "DALLOC_CTX", 1, "kMDAttributeArray"); -- 2.7.4 (Apple Git-66)