From c31fe2f9e7d65409229b7ad73418793ab34d359d Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Mon, 1 Feb 2021 12:04:01 +0100 Subject: [PATCH] smbd: stat path before calling openat_pathref_fsp() in open_pathref_base_fsp() Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- source3/smbd/files.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 448a284780b..40af56402e4 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -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); -- 2.34.1