summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2019-06-28 10:20:35 -0700
committerRalph Boehme <slow@samba.org>2019-06-30 11:32:17 +0000
commitcd66614a4e8a8f93e1debb8a87dd2afd46b02990 (patch)
treeeda1035779b63bea453e1c511c8bcd442dfa340d
parent98e34c299ddd8b24f3daeeafe45ab136ad015a47 (diff)
downloadsamba-cd66614a4e8a8f93e1debb8a87dd2afd46b02990.tar.gz
s3: smbd: Make open_directory() always open a fd.
As we never use kernel oplocks on directory handles, there is no reason not to always open file descriptors (no more "stat" opens on directories). Preparing to have SMB1search use real directory opens. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
-rw-r--r--source3/smbd/open.c34
1 files changed, 10 insertions, 24 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 095d8c2427d..411c917e55f 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -4237,33 +4237,19 @@ static NTSTATUS open_directory(connection_struct *conn,
*/
ZERO_STRUCT(mtimespec);
- if (access_mask & (FILE_LIST_DIRECTORY|
- FILE_ADD_FILE|
- FILE_ADD_SUBDIRECTORY|
- FILE_TRAVERSE|
- DELETE_ACCESS|
- FILE_DELETE_CHILD|
- WRITE_DAC_ACCESS|
- WRITE_OWNER_ACCESS|
- READ_CONTROL_ACCESS)) {
#ifdef O_DIRECTORY
- status = fd_open(conn, fsp, O_RDONLY|O_DIRECTORY, 0);
+ status = fd_open(conn, fsp, O_RDONLY|O_DIRECTORY, 0);
#else
- /* POSIX allows us to open a directory with O_RDONLY. */
- status = fd_open(conn, fsp, O_RDONLY, 0);
+ /* POSIX allows us to open a directory with O_RDONLY. */
+ status = fd_open(conn, fsp, O_RDONLY, 0);
#endif
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(5, ("open_directory: Could not open fd for "
- "%s (%s)\n",
- smb_fname_str_dbg(smb_dname),
- nt_errstr(status)));
- file_free(req, fsp);
- return status;
- }
- } else {
- fsp->fh->fd = -1;
- DEBUG(10, ("Not opening Directory %s\n",
- smb_fname_str_dbg(smb_dname)));
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_INFO("Could not open fd for "
+ "%s (%s)\n",
+ smb_fname_str_dbg(smb_dname),
+ nt_errstr(status));
+ file_free(req, fsp);
+ return status;
}
status = vfs_stat_fsp(fsp);