The branch, master has been updated
       via  518247b s3: smbd - open logic fix.
      from  4e5a6b1 ctdb-locking: Set real-time priority for lock helpers

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


- Log -----------------------------------------------------------------
commit 518247bf80372eb003cb67036b9d9e7fe8aac303
Author: Jeremy Allison <[email protected]>
Date:   Thu Sep 11 10:03:01 2014 -0700

    s3: smbd - open logic fix.
    
    As we atomically create using O_CREAT|O_EXCL,
    then if new_file_created is true, then
    file_existed *MUST* have been false (even
    if the file was previously detected as being
    there.
    
    We use the variable file_existed again in logic
    below this statement, so we must set file_existed = false,
    if new_file_created returns are true from open_file().
    
    Based on a fix from Michael Adam.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=10809
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Michael Adam <[email protected]>
    Reviewed-by: Michael Adam <[email protected]>
    
    Autobuild-User(master): Michael Adam <[email protected]>
    Autobuild-Date(master): Thu Sep 11 22:29:22 CEST 2014 on sn-devel-104

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

Summary of changes:
 source3/smbd/open.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 6261a44..f077210 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -2489,6 +2489,17 @@ static NTSTATUS open_file_ntcreate(connection_struct 
*conn,
                return fsp_open;
        }
 
+       if (new_file_created) {
+               /*
+                * As we atomically create using O_CREAT|O_EXCL,
+                * then if new_file_created is true, then
+                * file_existed *MUST* have been false (even
+                * if the file was previously detected as being
+                * there).
+                */
+               file_existed = false;
+       }
+
        if (file_existed && !check_same_dev_ino(&saved_stat, &smb_fname->st)) {
                /*
                 * The file did exist, but some other (local or NFS)


-- 
Samba Shared Repository

Reply via email to