The branch, v4-2-test has been updated
       via  0dd1749 smbd: Only check dev/inode in open_directory, not the full 
stat()
      from  ffccce5 s3:smbd: add negprot remote arch detection for OSX

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-2-test


- Log -----------------------------------------------------------------
commit 0dd174954988b1e4d6f59863088e95f5aa07eba6
Author: Andrew Bartlett <[email protected]>
Date:   Fri Mar 11 14:27:53 2016 +1300

    smbd: Only check dev/inode in open_directory, not the full stat()
    
    This is needed because the smb2.create.mkdir-dup test creates a race,
    and against an AD DC this can cause a flapping test if the lstat() and
    stat() calls are made either side of the chown() due to creation of a
    file by administrator.
    
    Fix based on original patches by myself, by Douglas Bagnall
    <[email protected]>.  and Jeremy Allison <[email protected]>
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11780
    
    Signed-off-by: Andrew Bartlett <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>
    
    Autobuild-User(master): Jeremy Allison <[email protected]>
    Autobuild-Date(master): Sat Mar 12 09:43:21 CET 2016 on sn-devel-144
    
    (cherry picked from commit 5fc6d2dabdf2aeef74fdefaa67eae0348bbf7a44)
    
    Autobuild-User(v4-2-test): Karolin Seeger <[email protected]>
    Autobuild-Date(v4-2-test): Mon Mar 21 15:33:32 CET 2016 on sn-devel-104

-----------------------------------------------------------------------

Summary of changes:
 source3/smbd/open.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index eb4323a..c4489b8 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)));


-- 
Samba Shared Repository

Reply via email to