summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2019-04-16 14:17:11 +0200
committerJeremy Allison <jra@samba.org>2019-08-08 20:24:33 +0000
commit5750f38ca7834254268a93193d72184d03990c1b (patch)
tree7f1cb32ce8297e24203a0c83b1ef0af3f5ec7aeb /source3/rpc_server
parent017af5d583175ff9f15c64fa7cc631eb4512367b (diff)
downloadsamba-5750f38ca7834254268a93193d72184d03990c1b.tar.gz
s3:mdssvc: fix error handling of mdssvc RPC requests
It seems for certain error cases macOS just sends an empty response blob. So if our mdssvc request processing fails, we should just return an empty response blob, but not fail the mdssvc request at the DCERPC layer. Example, passing "xxx" as sharename which does not exist at the server: $ bin/rpcclient -U slow%pass macmini -c "fetch_attributes xxx /foo/bar 123" -d 10 .... Got pdu len 56, data_len 32 rpc_api_pipe: got frag len of 56 at offset 0: NT_STATUS_OK rpc_api_pipe: host macmini returned 32 bytes. mdssvc_cmd: struct mdssvc_cmd out: struct mdssvc_cmd fragment : * fragment : 0x00000000 (0) response_blob : * response_blob: struct mdssvc_blob length : 0x00000000 (0) size : 0x00010000 (65536) spotlight_blob : * spotlight_blob: ARRAY(0) unkn9 : * unkn9 : 0x00000000 (0) ... Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/mdssvc/mdssvc.c31
1 files changed, 12 insertions, 19 deletions
diff --git a/source3/rpc_server/mdssvc/mdssvc.c b/source3/rpc_server/mdssvc/mdssvc.c
index 48461eab46f..5b1f291d054 100644
--- a/source3/rpc_server/mdssvc/mdssvc.c
+++ b/source3/rpc_server/mdssvc/mdssvc.c
@@ -1661,28 +1661,21 @@ bool mds_dispatch(struct mds_ctx *mds_ctx,
goto cleanup;
}
- /*
- * If these functions return an error, they hit something like
- * a non recoverable talloc error
- */
ok = slcmd->function(mds_ctx, query, reply);
- if (!ok) {
- DEBUG(1, ("error in Spotlight RPC handler\n"));
- goto cleanup;
- }
-
- DEBUG(5, ("%s", dalloc_dump(reply, 0)));
-
- len = sl_pack(reply, (char *)response_blob->spotlight_blob,
- response_blob->size);
- if (len == -1) {
- DEBUG(1, ("error packing Spotlight RPC reply\n"));
- ok = false;
- goto cleanup;
+ if (ok) {
+ DBG_DEBUG("%s", dalloc_dump(reply, 0));
+
+ len = sl_pack(reply,
+ (char *)response_blob->spotlight_blob,
+ response_blob->size);
+ if (len == -1) {
+ DBG_ERR("error packing Spotlight RPC reply\n");
+ ok = false;
+ goto cleanup;
+ }
+ response_blob->length = len;
}
- response_blob->length = len;
-
cleanup:
talloc_free(query);
talloc_free(reply);