]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: stat path before calling openat_pathref_fsp() in open_pathref_base_fsp()
authorRalph Boehme <slow@samba.org>
Mon, 1 Feb 2021 11:04:01 +0000 (12:04 +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/smbd/files.c

index 448a284780ba1c870666263b334d36c41f9077a8..40af56402e42eed8ad637f1799b1f306b92259a9 100644 (file)
@@ -392,6 +392,7 @@ static NTSTATUS open_pathref_base_fsp(const struct files_struct *dirfsp,
 {
        struct smb_filename *smb_fname_base = NULL;
        NTSTATUS status;
+       int ret;
 
        smb_fname_base = synthetic_smb_fname(talloc_tos(),
                                             fsp->fsp_name->base_name,
@@ -403,6 +404,11 @@ static NTSTATUS open_pathref_base_fsp(const struct files_struct *dirfsp,
                return NT_STATUS_NO_MEMORY;
        }
 
+       ret = vfs_stat(fsp->conn, smb_fname_base);
+       if (ret != 0) {
+               return map_nt_error_from_unix(errno);
+       }
+
        status = openat_pathref_fsp(dirfsp, smb_fname_base);
        if (!NT_STATUS_IS_OK(status)) {
                TALLOC_FREE(smb_fname_base);