From: Ralph Boehme Date: Tue, 16 Apr 2019 17:25:09 +0000 (+0200) Subject: s3:mdssvc: initialize the returned share_path with the empty string X-Git-Tag: tdb-1.4.2~207 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fef3a4c75f9cad1a81201257f0208b241a93f6c9;p=thirdparty%2Fsamba.git s3:mdssvc: initialize the returned share_path with the empty string macOS returns the empty path for an unknown share. This paves the way for that change. Currently we still fail the RPC request if the share is not known with DCERPC_FAULT_CANT_PERFORM, but this is wrong and is going to be changed in the next commit. Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/rpc_server/mdssvc/srv_mdssvc_nt.c b/source3/rpc_server/mdssvc/srv_mdssvc_nt.c index 289167e0975..49a26fac678 100644 --- a/source3/rpc_server/mdssvc/srv_mdssvc_nt.c +++ b/source3/rpc_server/mdssvc/srv_mdssvc_nt.c @@ -145,6 +145,7 @@ static NTSTATUS create_mdssvc_policy_handle(TALLOC_CTX *mem_ctx, void _mdssvc_open(struct pipes_struct *p, struct mdssvc_open *r) { int snum; + char *outpath = discard_const_p(char, r->out.share_path); char *path; NTSTATUS status; @@ -153,6 +154,7 @@ void _mdssvc_open(struct pipes_struct *p, struct mdssvc_open *r) *r->out.device_id = *r->in.device_id; *r->out.unkn2 = *r->in.unkn2; *r->out.unkn3 = *r->out.unkn3; + outpath[0] = '\0'; snum = lp_servicenumber(r->in.share_name); if (!VALID_SNUM(snum)) { @@ -184,7 +186,7 @@ void _mdssvc_open(struct pipes_struct *p, struct mdssvc_open *r) return; } - strlcpy(discard_const_p(char, r->out.share_path), path, 1024); + strlcpy(outpath, path, 1024); talloc_free(path); }