[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Wed Sep 10 13:52:04 MDT 2014


The branch, master has been updated
       via  c7c1f64 s4:torture:base: slightly more generous timing in the defer_open test
       via  8ae8c63 s3:smbd: fix a race in open code
       via  551ae16 smbd: Fix a typo
      from  868e8f4 s4:torture: fix multi_smb_test child status tracking.

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


- Log -----------------------------------------------------------------
commit c7c1f6490e04e24544c663a73261b4e680252af9
Author: Michael Adam <obnox at samba.org>
Date:   Wed Sep 10 01:03:57 2014 +0200

    s4:torture:base: slightly more generous timing in the defer_open test
    
    This copes with cases where the server is very busy and
    can't provide tortures more tight time scaling..
    This is an attepmt to remove the flapping character of this test.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Revieed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Wed Sep 10 21:51:42 CEST 2014 on sn-devel-104

commit 8ae8c63da19459fd4f1166e11406da2c919b7ed0
Author: Michael Adam <obnox at samba.org>
Date:   Wed Sep 10 00:31:25 2014 +0200

    s3:smbd: fix a race in open code
    
    The race is when a file vanishes between
    existence check and acl check.
    
    In this case, open_file_ncreate() returns
    OBJECT_NAME_NOT_FOUND even if the create
    was called with disposition OPEN_IF.
    But in this case, the file should be created.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 551ae16ab3be301ce5402e60f63f736960335d9f
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Sep 9 10:45:38 2014 +0000

    smbd: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 source3/smbd/open.c          |   61 +++++++++++++++++++++++++++++------------
 source4/torture/basic/base.c |    2 +-
 2 files changed, 44 insertions(+), 19 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 2762519..a33cce1 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -819,24 +819,49 @@ static NTSTATUS open_file(files_struct *fsp,
 						smb_fname,
 						false,
 						access_mask);
-			} else if (local_flags & O_CREAT){
-				status = check_parent_access(conn,
-						smb_fname,
-						SEC_DIR_ADD_FILE);
-			} else {
-				/* File didn't exist and no O_CREAT. */
-				return NT_STATUS_OBJECT_NAME_NOT_FOUND;
+
+				if (!NT_STATUS_IS_OK(status)) {
+					DEBUG(10, ("open_file: "
+						   "smbd_check_access_rights "
+						   "on file %s returned %s\n",
+						   smb_fname_str_dbg(smb_fname),
+						   nt_errstr(status)));
+				}
+
+				if (!NT_STATUS_IS_OK(status) &&
+				    !NT_STATUS_EQUAL(status,
+					NT_STATUS_OBJECT_NAME_NOT_FOUND))
+				{
+					return status;
+				}
+
+				if (!NT_STATUS_IS_OK(status)) {
+					DEBUG(10, ("open_file: "
+						"file %s vanished since we "
+						"checked for existence.\n",
+						smb_fname_str_dbg(smb_fname)));
+					file_existed = false;
+					SET_STAT_INVALID(fsp->fsp_name->st);
+				}
 			}
-			if (!NT_STATUS_IS_OK(status)) {
-				DEBUG(10,("open_file: "
-					"%s on file "
-					"%s returned %s\n",
-					file_existed ?
-						"smbd_check_access_rights" :
-						"check_parent_access",
-					smb_fname_str_dbg(smb_fname),
-					nt_errstr(status) ));
-				return status;
+
+			if (!file_existed) {
+				if (!(local_flags & O_CREAT)) {
+					/* File didn't exist and no O_CREAT. */
+					return NT_STATUS_OBJECT_NAME_NOT_FOUND;
+				}
+
+				status = check_parent_access(conn,
+							     smb_fname,
+							     SEC_DIR_ADD_FILE);
+				if (!NT_STATUS_IS_OK(status)) {
+					DEBUG(10, ("open_file: "
+						   "check_parent_access on "
+						   "file %s returned %s\n",
+						   smb_fname_str_dbg(smb_fname),
+						   nt_errstr(status) ));
+					return status;
+				}
 			}
 		}
 
@@ -3921,7 +3946,7 @@ static NTSTATUS create_file_unixpath(connection_struct *conn,
 				   nt_errstr(status)));
 			goto fail;
 		}
-		/* we don't need to low level fd */
+		/* we don't need the low level fd */
 		fd_close(base_fsp);
 	}
 
diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c
index bd9a304..6a792b2 100644
--- a/source4/torture/basic/base.c
+++ b/source4/torture/basic/base.c
@@ -697,7 +697,7 @@ static bool run_deferopen(struct torture_context *tctx, struct smbcli_state *cli
 				torture_comment(tctx, "pid %u: create[%d,%d] "
 						"time elapsed: %.2f (1 sec = %.2f)\n",
 						(unsigned)getpid(), i, j, e, sec);
-				if (e < (0.5 * sec) || e > ((1.5 * sec) + 1)) {
+				if (e < (0.5 * sec) || e > ((1.5 * sec) + 1.5)) {
 					torture_comment(tctx, "pid %u: create[%d,%d] "
 							"timing incorrect\n",
 							(unsigned)getpid(), i, j);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list