From 392d8a1682acb6f0918d7190b4ff5b080277f4b8 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 21 Apr 2014 13:58:49 -0700 Subject: [PATCH] s3: srvsvc pipe - We should return WERR_BADFILE in _srvsvc_NetShareAdd if the path does not exist. Windows capture trace shows this. Signed-off-by: Richard Sharpe Reviewed-by: Jeremy Allison --- source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c index 39d5e05..e030b98 100644 --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c @@ -1946,6 +1946,7 @@ WERROR _srvsvc_NetShareAdd(struct pipes_struct *p, struct security_descriptor *psd = NULL; bool is_disk_op; int max_connections = 0; + SMB_STRUCT_STAT st; TALLOC_CTX *ctx = p->mem_ctx; DEBUG(5,("_srvsvc_NetShareAdd: %d\n", __LINE__)); @@ -2045,6 +2046,16 @@ WERROR _srvsvc_NetShareAdd(struct pipes_struct *p, return WERR_OBJECT_PATH_INVALID; } + ret = sys_lstat(path, &st, false); + if (ret == -1 && (errno != EACCES)) { + /* + * If path has any other than permission + * problem, return WERR_BADFILE (as Windows + * does. + */ + return WERR_BADFILE; + } + /* Ensure share name, pathname and comment don't contain '"' characters. */ string_replace(share_name_in, '"', ' '); string_replace(share_name, '"', ' '); -- 1.9.1.423.g4596e3a