summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/smbd/open.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index eb4323afc57..c4489b81391 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -3621,8 +3621,18 @@ static NTSTATUS open_directory(connection_struct *conn,
return status;
}
- /* Ensure there was no race condition. */
- if (!check_same_stat(&smb_dname->st, &fsp->fsp_name->st)) {
+ if(!S_ISDIR(fsp->fsp_name->st.st_ex_mode)) {
+ DEBUG(5,("open_directory: %s is not a directory !\n",
+ smb_fname_str_dbg(smb_dname)));
+ fd_close(fsp);
+ file_free(req, fsp);
+ return NT_STATUS_NOT_A_DIRECTORY;
+ }
+
+ /* Ensure there was no race condition. We need to check
+ * dev/inode but not permissions, as these can change
+ * legitimately */
+ if (!check_same_dev_ino(&smb_dname->st, &fsp->fsp_name->st)) {
DEBUG(5,("open_directory: stat struct differs for "
"directory %s.\n",
smb_fname_str_dbg(smb_dname)));