From: Ralph Boehme Date: Mon, 1 Feb 2021 10:59:37 +0000 (+0100) Subject: s3/libadouble: stat path before calling openat_pathref_fsp() in ad_unconvert_open_ad() X-Git-Tag: tevent-0.11.0~1830 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4f30c04462fb1536323606dd4216fe5e32458ba5;p=thirdparty%2Fsamba.git s3/libadouble: stat path before calling openat_pathref_fsp() in ad_unconvert_open_ad() Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/lib/adouble.c b/source3/lib/adouble.c index 3be6f353bd8..6fd290a31b8 100644 --- a/source3/lib/adouble.c +++ b/source3/lib/adouble.c @@ -1505,13 +1505,18 @@ static bool ad_unconvert_open_ad(TALLOC_CTX *mem_ctx, NTSTATUS status; int ret; - status = openat_pathref_fsp(handle->conn->cwd_fsp, adpath); - if (!NT_STATUS_IS_OK(status) && - !NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) - { + ret = vfs_stat(handle->conn, adpath); + if (ret == -1 && errno != ENOENT) { return false; } + if (VALID_STAT(adpath->st)) { + status = openat_pathref_fsp(handle->conn->cwd_fsp, adpath); + if (!NT_STATUS_IS_OK(status)) { + return false; + } + } + status = SMB_VFS_CREATE_FILE( handle->conn, NULL, /* req */