]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Mark fsp as directory after calling fstat()
authorVolker Lendecke <vl@samba.org>
Tue, 8 Mar 2022 11:57:13 +0000 (12:57 +0100)
committerRalph Boehme <slow@samba.org>
Fri, 11 Mar 2022 18:22:28 +0000 (18:22 +0000)
Everything else is racy, and this is cheap to check.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/files.c

index 8d18339fb922f6ae104fae62265631795da858ea..187e0bf6b2d6eea74843fc5e2a2a56a8224d1b1b 100644 (file)
@@ -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,