[SCM] Samba Shared Repository - branch master updated

Michael Adam obnox at samba.org
Tue Feb 21 11:52:02 MST 2012


The branch, master has been updated
       via  77889f6 s4:torture:smb2: add a durable-open.open-oplock test
       via  1f1ff1c s4:torture:smb2: extend and prettify comment for durable-open.open-lease test
       via  0d3d825 s4:torture:smb2:durable-open: rename the open test to open-lease
       via  a36e257 s4:torture:smb2: move some initialization and call to smb2_create together in durable-open.open test
       via  65da3b7 s4:torture:smb2: fix a typo in the durable-open.open test file name
      from  7906d0b s3: Fix smbd -i

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


- Log -----------------------------------------------------------------
commit 77889f63e6cf66553e615dbe9a4eba09ad046553
Author: Michael Adam <obnox at samba.org>
Date:   Tue Feb 21 18:09:14 2012 +0100

    s4:torture:smb2: add a durable-open.open-oplock test
    
    this is a variant of the open-lease test that does the initial
    durable open with a batch oplock instead of a RH lease.
    
    This is e.g. useful do analyse a (mis?) behaviour with current
    windows 8 preview versions, compared to w2k8r2
    
    Autobuild-User: Michael Adam <obnox at samba.org>
    Autobuild-Date: Tue Feb 21 19:51:21 CET 2012 on sn-devel-104

commit 1f1ff1cf0a5608d98b4a1ff4900b95b6d6e34dd2
Author: Michael Adam <obnox at samba.org>
Date:   Tue Feb 21 18:03:27 2012 +0100

    s4:torture:smb2: extend and prettify comment for durable-open.open-lease test

commit 0d3d8256d86be9e0173a34c204bdad891dfbf9eb
Author: Michael Adam <obnox at samba.org>
Date:   Tue Feb 21 18:01:57 2012 +0100

    s4:torture:smb2:durable-open: rename the open test to open-lease

commit a36e25716008ad4c90efd8e0ba21522365efce6c
Author: Michael Adam <obnox at samba.org>
Date:   Tue Feb 21 18:00:30 2012 +0100

    s4:torture:smb2: move some initialization and call to smb2_create together in durable-open.open test

commit 65da3b74fab684bf6521735700a57a0ca2aa68c8
Author: Michael Adam <obnox at samba.org>
Date:   Tue Feb 21 14:48:03 2012 +0100

    s4:torture:smb2: fix a typo in the durable-open.open test file name

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

Summary of changes:
 source4/torture/smb2/durable_open.c |  117 ++++++++++++++++++++++++++++++-----
 1 files changed, 102 insertions(+), 15 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/torture/smb2/durable_open.c b/source4/torture/smb2/durable_open.c
index f54e41c..6ef5a32 100644
--- a/source4/torture/smb2/durable_open.c
+++ b/source4/torture/smb2/durable_open.c
@@ -971,17 +971,17 @@ bool test_durable_open_lock(struct torture_context *tctx,
 	return ret;
 }
 
-/*
-  Open, disconnect, open in another tree, reconnect.
-
-  This test actually demonstrates a minimum level of respect for the durable
-  open in the face of another open. As long as this test shows an inability to
-  reconnect after an open, the oplock/lease tests above will certainly
-  demonstrate an error on reconnect.
-*/
-bool test_durable_open_open(struct torture_context *tctx,
-			    struct smb2_tree *tree1,
-			    struct smb2_tree *tree2)
+/**
+ * Open with a RH lease, disconnect, open in another tree, reconnect.
+ *
+ * This test actually demonstrates a minimum level of respect for the durable
+ * open in the face of another open. As long as this test shows an inability to
+ * reconnect after an open, the oplock/lease tests above will certainly
+ * demonstrate an error on reconnect.
+ */
+bool test_durable_open_open_lease(struct torture_context *tctx,
+				  struct smb2_tree *tree1,
+				  struct smb2_tree *tree2)
 {
 	TALLOC_CTX *mem_ctx = talloc_new(tctx);
 	struct smb2_create io1, io2;
@@ -997,7 +997,8 @@ bool test_durable_open_open(struct torture_context *tctx,
 	 * little funky.
 	 */
 	lease = random();
-	snprintf(fname, 256, "durable_open_lock_%s.dat", generate_random_str(tctx, 8));
+	snprintf(fname, 256, "durable_open_open_lease_%s.dat",
+		 generate_random_str(tctx, 8));
 
 	/* Clean slate */
 	smb2_util_unlink(tree1, fname);
@@ -1009,8 +1010,6 @@ bool test_durable_open_open(struct torture_context *tctx,
 				smb2_util_lease_state("RH"));
 	io1.in.durable_open = true;
 
-	smb2_oplock_create(&io2, fname, SMB2_OPLOCK_LEVEL_NONE);
-
 	status = smb2_create(tree1, mem_ctx, &io1);
 	CHECK_STATUS(status, NT_STATUS_OK);
 	h1 = io1.out.file.handle;
@@ -1028,6 +1027,8 @@ bool test_durable_open_open(struct torture_context *tctx,
 	tree1 = NULL;
 
 	/* Open the file in tree2 */
+	smb2_oplock_create(&io2, fname, SMB2_OPLOCK_LEVEL_NONE);
+
 	status = smb2_create(tree2, mem_ctx, &io2);
 	CHECK_STATUS(status, NT_STATUS_OK);
 	h2 = io2.out.file.handle;
@@ -1066,6 +1067,89 @@ bool test_durable_open_open(struct torture_context *tctx,
 	return ret;
 }
 
+/**
+ * Open with a batch oplock, disconnect, open in another tree, reconnect.
+ *
+ * This test actually demonstrates a minimum level of respect for the durable
+ * open in the face of another open. As long as this test shows an inability to
+ * reconnect after an open, the oplock/lease tests above will certainly
+ * demonstrate an error on reconnect.
+ */
+bool test_durable_open_open_oplock(struct torture_context *tctx,
+				   struct smb2_tree *tree1,
+				   struct smb2_tree *tree2)
+{
+	TALLOC_CTX *mem_ctx = talloc_new(tctx);
+	struct smb2_create io1, io2;
+	struct smb2_lease ls;
+	struct smb2_handle h1, h2;
+	NTSTATUS status;
+	char fname[256];
+	bool ret = true;
+	uint64_t lease;
+
+	/*
+	 * Choose a random name and random lease in case the state is left a
+	 * little funky.
+	 */
+	lease = random();
+	snprintf(fname, 256, "durable_open_open_oplock_%s.dat",
+		 generate_random_str(tctx, 8));
+
+	/* Clean slate */
+	smb2_util_unlink(tree1, fname);
+
+	/* Create with batch oplock */
+	smb2_oplock_create(&io1, fname, SMB2_OPLOCK_LEVEL_BATCH);
+	io1.in.durable_open = true;
+
+	status = smb2_create(tree1, mem_ctx, &io1);
+	CHECK_STATUS(status, NT_STATUS_OK);
+	h1 = io1.out.file.handle;
+	CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
+	CHECK_VAL(io1.out.durable_open, true);
+	CHECK_VAL(io1.out.oplock_level, SMB2_OPLOCK_LEVEL_BATCH);
+
+	/* Disconnect */
+	talloc_free(tree1);
+	tree1 = NULL;
+
+	/* Open the file in tree2 */
+	smb2_oplock_create(&io2, fname, SMB2_OPLOCK_LEVEL_NONE);
+
+	status = smb2_create(tree2, mem_ctx, &io2);
+	CHECK_STATUS(status, NT_STATUS_OK);
+	h2 = io2.out.file.handle;
+	CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
+
+	/* Reconnect */
+	if (!torture_smb2_connection(tctx, &tree1)) {
+		torture_warning(tctx, "couldn't reconnect, bailing\n");
+		ret = false;
+		goto done;
+	}
+
+	ZERO_STRUCT(io1);
+	io1.in.fname = fname;
+	io1.in.durable_handle = &h1;
+	io1.in.lease_request = &ls;
+
+	status = smb2_create(tree1, mem_ctx, &io1);
+	CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+	h1 = io1.out.file.handle;
+
+ done:
+	smb2_util_close(tree2, h2);
+	smb2_util_unlink(tree2, fname);
+	smb2_util_close(tree1, h1);
+	smb2_util_unlink(tree1, fname);
+
+	talloc_free(tree1);
+	talloc_free(tree2);
+
+	return ret;
+}
+
 struct torture_suite *torture_smb2_durable_open_init(void)
 {
 	struct torture_suite *suite =
@@ -1082,7 +1166,10 @@ struct torture_suite *torture_smb2_durable_open_init(void)
 	torture_suite_add_2smb2_test(suite, "oplock", test_durable_open_oplock);
 	torture_suite_add_2smb2_test(suite, "lease", test_durable_open_lease);
 	torture_suite_add_1smb2_test(suite, "lock", test_durable_open_lock);
-	torture_suite_add_2smb2_test(suite, "open", test_durable_open_open);
+	torture_suite_add_2smb2_test(suite, "open-lease",
+				     test_durable_open_open_lease);
+	torture_suite_add_2smb2_test(suite, "open-oplock",
+				     test_durable_open_open_oplock);
 
 	suite->description = talloc_strdup(suite, "SMB2-DURABLE-OPEN tests");
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list