The branch, v4-1-test has been updated
       via  4c32263 selftest/knownfail: ignore samba3.smb2.oplock.exclusive5 
failures in v4-1-*
       via  f2da72f smbd: Remove 2 indentation levels
       via  f8af687 s3: smbd - Prevent file truncation on an open that fails 
with share mode violation.
      from  610320e s4:dsdb/repl_meta_data: make sure objectGUID can't be 
deleted

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-1-test


- Log -----------------------------------------------------------------
commit 4c32263756ae08cfafd3ec8e8fc8ef416227d4aa
Author: Stefan Metzmacher <me...@samba.org>
Date:   Tue Jul 15 12:57:29 2014 +0200

    selftest/knownfail: ignore samba3.smb2.oplock.exclusive5 failures in v4-1-*
    
    This is fixed by 20669d4a75386eef4fdcea07fb99812c4e09de13 in master.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10671
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    
    Autobuild-User(v4-1-test): Karolin Seeger <ksee...@samba.org>
    Autobuild-Date(v4-1-test): Thu Jul 17 11:07:08 CEST 2014 on sn-devel-104

commit f2da72f95646329a4aacb4378b84280e5f763ec6
Author: Volker Lendecke <v...@samba.org>
Date:   Wed Jun 25 08:36:47 2014 +0000

    smbd: Remove 2 indentation levels
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: David Disseldorp <dd...@samba.org>
    (cherry picked from commit 1dc5c20c8f7d8aa96fa0601bf5bf6dc69fb79d9f)

commit f8af6870a061758a37bb6c63d09ce23ab971c6ce
Author: Jeremy Allison <j...@samba.org>
Date:   Tue Jun 24 14:19:30 2014 -0700

    s3: smbd - Prevent file truncation on an open that fails with share mode 
violation.
    
    Fix from Volker, really - just tidied up a little.
    The S_ISFIFO check may not be strictly neccessary,
    but doesn't hurt (might make the code a bit more complex
    than it needs to be).
    
    Fixes bug #10671 - Samba file corruption as a result of failed lock check.
    
    https://bugzilla.samba.org/show_bug.cgi?id=10671
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: David Disseldorp <dd...@samba.org>
    (cherry picked from commit 31b3427a417217e5e869baafdf63e633efc39d12)
    [dd...@samba.org: 4.1 backport]

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

Summary of changes:
 selftest/knownfail  |    1 +
 source3/smbd/open.c |   22 ++++++++++++++++++++--
 2 files changed, 21 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/selftest/knownfail b/selftest/knownfail
index 54b7456..3768f82 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -204,6 +204,7 @@
 ^samba3.smb2.lease.oplock
 ^samba3.smb2.lease.multibreak
 ^samba3.smb2.lease.v2_request
+^samba3.smb2.oplock.exclusive5
 ^samba3.smb2.oplock.batch12
 ^samba3.smb2.oplock.batch20
 ^samba3.smb2.oplock.stream1
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 5f7bff9..16d4307 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -839,8 +839,11 @@ static NTSTATUS open_file(files_struct *fsp,
                        }
                }
 
-               /* Actually do the open */
-               status = fd_open_atomic(conn, fsp, local_flags,
+               /*
+                * Actually do the open - if O_TRUNC is needed handle it
+                * below under the share mode lock.
+                */
+               status = fd_open_atomic(conn, fsp, local_flags & ~O_TRUNC,
                                unx_mode, p_file_created);
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(3,("Error opening file %s (%s) (local_flags=%d) "
@@ -2646,6 +2649,21 @@ static NTSTATUS open_file_ntcreate(connection_struct 
*conn,
                return status;
        }
 
+       /* Should we atomically (to the client at least) truncate ? */
+       if ((!new_file_created) &&
+           (flags2 & O_TRUNC) &&
+           (!S_ISFIFO(fsp->fsp_name->st.st_ex_mode))) {
+               int ret;
+
+               ret = vfs_set_filelen(fsp, 0);
+               if (ret != 0) {
+                       status = map_nt_error_from_unix(errno);
+                       TALLOC_FREE(lck);
+                       fd_close(fsp);
+                       return status;
+               }
+       }
+
        grant_fsp_oplock_type(fsp,
                              oplock_request,
                              got_level2_oplock,


-- 
Samba Shared Repository

Reply via email to