The branch, master has been updated
       via  5fc6d2d smbd: Only check dev/inode in open_directory, not the full 
stat()
       via  2e2f811 lib/socket/interfaces: Fix some uninitialied bytes.
      from  2ef0eed selftest: mark samba4.winbind.struct.domain_info.ad_member 
as flapping

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 5fc6d2dabdf2aeef74fdefaa67eae0348bbf7a44
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

commit 2e2f81134c86ef3146781d62d9f561f496b74ee2
Author: Günther Deschner <[email protected]>
Date:   Wed Mar 2 18:32:53 2016 +0100

    lib/socket/interfaces: Fix some uninitialied bytes.
    
    Valgrind reports the following:
    
    ==26599== Syscall param ioctl(SIOCETHTOOL) points to uninitialised byte(s)
    ==26599==    at 0x7014707: ioctl (in /usr/lib64/libc-2.22.so)
    ==26599==    by 0x79D1585: query_iface_speed_from_name (interfaces.c:152)
    ==26599==    by 0x79D1BBA: _get_interfaces (interfaces.c:277)
    ==26599==    by 0x79D1E80: get_interfaces (interfaces.c:368)
    ==26599==    by 0x508A7E3: load_interfaces (interface.c:612)
    ==26599==    by 0x150B30: main (net.c:963)
    ==26599==  Address 0xffefff0d8 is on thread 1's stack
    ==26599==  in frame #1, created by query_iface_speed_from_name
    (interfaces.c:130)
    ==26599==
    ==26599== Syscall param ioctl(SIOCETHTOOL) points to uninitialised byte(s)
    ==26599==    at 0x7014707: ioctl (in /usr/lib64/libc-2.22.so)
    ==26599==    by 0x79D15CC: query_iface_speed_from_name (interfaces.c:164)
    ==26599==    by 0x79D1BBA: _get_interfaces (interfaces.c:277)
    ==26599==    by 0x79D1E80: get_interfaces (interfaces.c:368)
    ==26599==    by 0x508A7E3: load_interfaces (interface.c:612)
    ==26599==    by 0x150B30: main (net.c:963)
    ==26599==  Address 0xffefff0d8 is on thread 1's stack
    ==26599==  in frame #1, created by query_iface_speed_from_name
    (interfaces.c:130)
    
    Guenther
    
    Signed-off-by: Guenther Deschner <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

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

Summary of changes:
 lib/socket/interfaces.c |  1 +
 source3/smbd/open.c     | 14 ++++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/socket/interfaces.c b/lib/socket/interfaces.c
index 2cabf46..dacd118 100644
--- a/lib/socket/interfaces.c
+++ b/lib/socket/interfaces.c
@@ -145,6 +145,7 @@ static void query_iface_speed_from_name(const char *name, 
uint64_t *speed)
                goto done;
        }
 
+       ZERO_STRUCT(ifr);
        strncpy(ifr.ifr_name, name, IF_NAMESIZE);
 
        ifr.ifr_data = (void *)&edata;
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index baebd7c..e5503f5 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -3635,8 +3635,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