s3:mdssvc: fix error handling of mdssvc RPC requests
authorRalph Boehme <slow@samba.org>
Tue, 16 Apr 2019 12:17:11 +0000 (14:17 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 8 Aug 2019 20:24:33 +0000 (20:24 +0000)
commit5750f38ca7834254268a93193d72184d03990c1b
tree7f1cb32ce8297e24203a0c83b1ef0af3f5ec7aeb
parent017af5d583175ff9f15c64fa7cc631eb4512367b
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>
source3/rpc_server/mdssvc/mdssvc.c