]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3/libadouble: stat path before calling openat_pathref_fsp() in ad_unconvert_open_ad()
authorRalph Boehme <slow@samba.org>
Mon, 1 Feb 2021 10:59:37 +0000 (11:59 +0100)
committerRalph Boehme <slow@samba.org>
Fri, 5 Feb 2021 06:22:35 +0000 (06:22 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/adouble.c

index 3be6f353bd8c45b7ed6f16b984b8b223b674db2e..6fd290a31b8ae5cf8499fc8686594ee8c6c0c1fd 100644 (file)
@@ -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 */