diff options
author | Abhidnya Joshi <achirmul@in.ibm.com> | 2014-01-22 17:02:15 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-01-23 03:56:35 +0100 |
commit | 7638f521456f1c7e615591dff4c403902cd4ddac (patch) | |
tree | 41406667d790b01d04c5032aef5fd786ed1e162c /source3/smbd/open.c | |
parent | b04e8b7557b82a4b96cf74db04742fb017edb3ba (diff) | |
download | samba-7638f521456f1c7e615591dff4c403902cd4ddac.tar.gz |
s3: Don't open the dir for stat/attr/acl related mask
Signed-off-by: Abhidnya Joshi <achirmul@in.ibm.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jan 23 03:56:35 CET 2014 on sn-devel-104
Diffstat (limited to 'source3/smbd/open.c')
-rw-r--r-- | source3/smbd/open.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 200c1ce08ce..cce8be29fcc 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -3211,19 +3211,30 @@ 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)) { #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; + 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))); } status = vfs_stat_fsp(fsp); |