]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: In open_file(), remove post-open check for opening a directory.
authorJeremy Allison <jra@samba.org>
Tue, 8 Jun 2021 03:55:44 +0000 (20:55 -0700)
committerRalph Boehme <slow@samba.org>
Wed, 9 Jun 2021 13:14:29 +0000 (13:14 +0000)
Now we do an early check for opening a directory, this code
could never have been triggered.

The only case we need to consider now is when the filesystem
object exists as a file when we enter open_file() and another
smbd removes and then re-creates the object as a directory before we
call reopen_from_fsp(). In that case, we will open the object,
and come back out to open_file_ntcreate(), where the race
condition detection code that calls check_same_dev_ino()
will catch the case and error out the client request.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/open.c

index ed180efa1e311b1cd953f8e6e95b756733f1c4e5..70190c7641dc92207d56f88ce8919d8ff73fd911 100644 (file)
@@ -1623,17 +1623,6 @@ static NTSTATUS open_file(files_struct *fsp,
                }
        }
 
-       /*
-        * POSIX allows read-only opens of directories. We don't
-        * want to do this (we use a different code path for this)
-        * so catch a directory open and return an EISDIR. JRA.
-        */
-
-       if(S_ISDIR(smb_fname->st.st_ex_mode)) {
-               fd_close(fsp);
-               return NT_STATUS_FILE_IS_A_DIRECTORY;
-       }
-
        fsp->file_id = vfs_file_id_from_sbuf(conn, &smb_fname->st);
        fsp->vuid = req ? req->vuid : UID_FIELD_INVALID;
        fsp->file_pid = req ? req->smbpid : 0;