From: Jeremy Allison Date: Tue, 8 Jun 2021 03:55:44 +0000 (-0700) Subject: s3: smbd: In open_file(), remove post-open check for opening a directory. X-Git-Tag: tevent-0.11.0~641 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2d52ebb6ccadc5b1287935b245a8b06abe03cb9;p=thirdparty%2Fsamba.git s3: smbd: In open_file(), remove post-open check for opening a directory. 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 Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index ed180efa1e3..70190c7641d 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -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;