diff options
author | Jeremy Allison <jra@samba.org> | 2011-02-07 20:46:36 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2011-02-08 06:34:41 +0100 |
commit | e68f6adca9494166bf7c24c358ea1af718970b0d (patch) | |
tree | 59e037538cbd333b367615c690ed218f93b66878 /source3/smbd/open.c | |
parent | dd7313a1307aa2b3e7d10678a2bce6690e1c2125 (diff) | |
download | samba-e68f6adca9494166bf7c24c358ea1af718970b0d.tar.gz samba-e68f6adca9494166bf7c24c358ea1af718970b0d.tar.bz2 samba-e68f6adca9494166bf7c24c358ea1af718970b0d.zip |
If possible (O_DIRECTORY exists) open an fd for a directory open.
Start of the move towards handle-based code for directory access.
Currently makes fstat/fchown code work for directories rather than
falling back to pathnames.
Jeremy.
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Tue Feb 8 06:34:41 CET 2011 on sn-devel-104
Diffstat (limited to 'source3/smbd/open.c')
-rw-r--r-- | source3/smbd/open.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c index e6a70bcebc..ded3d344c5 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -2726,12 +2726,25 @@ static NTSTATUS open_directory(connection_struct *conn, mtimespec = smb_dname->st.st_ex_mtime; +#ifdef O_DIRECTORY + status = fd_open(conn, fsp, O_RDONLY|O_DIRECTORY, 0); + 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; + } +#endif + lck = get_share_mode_lock(talloc_tos(), fsp->file_id, conn->connectpath, smb_dname, &mtimespec); if (lck == NULL) { DEBUG(0, ("open_directory: Could not get share mode lock for " "%s\n", smb_fname_str_dbg(smb_dname))); + fd_close(fsp); file_free(req, fsp); return NT_STATUS_SHARING_VIOLATION; } @@ -2742,6 +2755,7 @@ static NTSTATUS open_directory(connection_struct *conn, if (!NT_STATUS_IS_OK(status)) { TALLOC_FREE(lck); + fd_close(fsp); file_free(req, fsp); return status; } @@ -2754,6 +2768,7 @@ static NTSTATUS open_directory(connection_struct *conn, status = can_set_delete_on_close(fsp, 0); if (!NT_STATUS_IS_OK(status) && !NT_STATUS_EQUAL(status, NT_STATUS_DIRECTORY_NOT_EMPTY)) { TALLOC_FREE(lck); + fd_close(fsp); file_free(req, fsp); return status; } |