From: Ralph Boehme Date: Mon, 11 Jan 2021 08:57:26 +0000 (+0100) Subject: smbd: move S_ISDIR check up a bit in openat_pathref_fsp() X-Git-Tag: samba-4.14.0rc1~122 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=847465b3900ca78046ceaf08d89fdd4535e7193a;p=thirdparty%2Fsamba.git smbd: move S_ISDIR check up a bit in openat_pathref_fsp() This relies on the caller having stat()ed smb_fname instead of relying on fd_openat() fstat()ing fsp->fsp_name. Otherwise no change in behaviour. Signed-off-by: Ralph Boehme Reviewed-by: Anoop C S --- diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 57fd67ab426..dff6780259b 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -435,6 +435,9 @@ NTSTATUS openat_pathref_fsp(const struct files_struct *dirfsp, ZERO_STRUCT(conn->sconn->fsp_fi_cache); fsp->fsp_flags.is_pathref = true; + if (S_ISDIR(smb_fname->st.st_ex_mode)) { + fsp->fsp_flags.is_directory = true; + } full_fname = full_path_from_dirfsp_atname(talloc_tos(), dirfsp, @@ -519,9 +522,6 @@ NTSTATUS openat_pathref_fsp(const struct files_struct *dirfsp, } fsp->file_id = vfs_file_id_from_sbuf(conn, &fsp->fsp_name->st); - if (S_ISDIR(fsp->fsp_name->st.st_ex_mode)) { - fsp->fsp_flags.is_directory = true; - } fsp->fsp_name->fsp = fsp; smb_fname->fsp = fsp;