From: Volker Lendecke Date: Tue, 8 Mar 2022 11:57:13 +0000 (+0100) Subject: smbd: Mark fsp as directory after calling fstat() X-Git-Tag: tevent-0.12.0~455 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e70b754a9cabb5d31d78e7d4a3f18028db07e99;p=thirdparty%2Fsamba.git smbd: Mark fsp as directory after calling fstat() Everything else is racy, and this is cheap to check. Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 8d18339fb92..187e0bf6b2d 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -475,7 +475,6 @@ NTSTATUS openat_pathref_fsp(const struct files_struct *dirfsp, fsp->fsp_flags.is_pathref = true; if (S_ISDIR(smb_fname->st.st_ex_mode)) { - fsp->fsp_flags.is_directory = true; open_flags |= O_DIRECTORY; } @@ -559,6 +558,8 @@ NTSTATUS openat_pathref_fsp(const struct files_struct *dirfsp, */ smb_fname->st = fsp->fsp_name->st; + fsp->fsp_flags.is_directory = S_ISDIR(fsp->fsp_name->st.st_ex_mode); + fsp->file_id = vfs_file_id_from_sbuf(conn, &fsp->fsp_name->st); status = fsp_smb_fname_link(fsp,