[SCM] Samba Shared Repository - branch master updated - tevent-0-9-8-858-gb2bcfaa

Steven Danneman sdanneman at samba.org
Thu Oct 1 16:00:49 MDT 2009


The branch, master has been updated
       via  b2bcfaaeed44af3a60667894ce0d7647f0382a26 (commit)
       via  1160d680620d71a7d5632b73c76d516f89696b65 (commit)
       via  49fdeaeaf6eca052378b88cdf726f8eef753fe86 (commit)
      from  a58bc2c9a93597f3625dc8b64221c601b6f59833 (commit)

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


- Log -----------------------------------------------------------------
commit b2bcfaaeed44af3a60667894ce0d7647f0382a26
Author: Steven Danneman <steven.danneman at isilon.com>
Date:   Thu Oct 1 13:47:28 2009 -0700

    s4/torture: rename oplocks.c to oplock.c to match SMB1 file layout

commit 1160d680620d71a7d5632b73c76d516f89696b65
Author: Steven Danneman <steven.danneman at isilon.com>
Date:   Thu Jul 30 15:10:50 2009 -0700

    s4/torture: Ported SMB oplock torture tests to SMB2
    
    I've ported all applicable SMB oplock torture tests to SMB2, giving us
    a good base for SMB2 oplock testing.
    
    There are several differences between oplocks in SMB and SMB2, mostly
    because of differences in W2K3 and W2K8.  The existing SMB oplock
    tests all pass against W2K3, but several fail against W2K8.  These
    same tests were failing in SMB2, util I reworked them.
    
    BATCH19, BATCH20: In W2K3/SMB a setfileinfo - rename command wouldn't
    cause a sharing violation or break an existing oplock.  It appears that
    in W2K8/SMB2 a sharing violation is raised.
    
    BATCH22: In W2K3/SMB when a second opener was waiting the full timeout
    of an oplock break, it would receive NT_STATUS_SHARING_VIOLATION after
    about 35 seconds.  This bug has been fixed in W2K8/SMB2 and instead
    the second opener succeeds.
    
    LEVELII500: Added 1 new test checking that the server returns a proper
    error code when a client improperly replies to a levelII to none break
    notification.
    
    STREAM1: W2K8 now grants oplocks on alternate data streams.

commit 49fdeaeaf6eca052378b88cdf726f8eef753fe86
Author: Steven Danneman <steven.danneman at isilon.com>
Date:   Thu Oct 1 11:35:17 2009 -0700

    s4/torture: fix typo in test comment

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

Summary of changes:
 source4/libcli/smb2/util.c     |    9 ++
 source4/torture/raw/oplock.c   |    2 +-
 source4/torture/smb2/config.mk |    2 +-
 source4/torture/smb2/oplocks.c |  177 ----------------------------------------
 source4/torture/smb2/smb2.c    |    4 +-
 5 files changed, 14 insertions(+), 180 deletions(-)
 delete mode 100644 source4/torture/smb2/oplocks.c


Changeset truncated at 500 lines:

diff --git a/source4/libcli/smb2/util.c b/source4/libcli/smb2/util.c
index 8602c91..9b8d688 100644
--- a/source4/libcli/smb2/util.c
+++ b/source4/libcli/smb2/util.c
@@ -220,3 +220,12 @@ int smb2_deltree(struct smb2_tree *tree, const char *dname)
 
 	return total_deleted;
 }
+
+/*
+  check if two SMB2 file handles are the same
+*/
+bool smb2_util_handle_equal(const struct smb2_handle h1,
+			    const struct smb2_handle h2)
+{
+	return (h1.data[0] == h2.data[0]) && (h1.data[1] == h2.data[1]);
+}
diff --git a/source4/torture/raw/oplock.c b/source4/torture/raw/oplock.c
index da9fcf3..8623042 100644
--- a/source4/torture/raw/oplock.c
+++ b/source4/torture/raw/oplock.c
@@ -3043,7 +3043,7 @@ static bool test_raw_oplock_stream1(struct torture_context *tctx,
 
 		if (open_base_file) {
 			torture_comment(tctx, "Opening base file: %s with "
-			    "%d\n", fname_base, oplock_req);
+			    "%d\n", fname_base, batch_req);
 			io.ntcreatex.in.fname = fname_base;
 			io.ntcreatex.in.flags = batch_req;
 			status = smb_raw_open(cli2->tree, tctx, &io);
diff --git a/source4/torture/smb2/config.mk b/source4/torture/smb2/config.mk
index 2aba86a..f617f70 100644
--- a/source4/torture/smb2/config.mk
+++ b/source4/torture/smb2/config.mk
@@ -20,7 +20,7 @@ TORTURE_SMB2_OBJ_FILES = $(addprefix $(torturesrcdir)/smb2/, \
 		notify.o \
 		smb2.o \
 		durable_open.o \
-		oplocks.o \
+		oplock.o \
 		dir.o \
 		lease.o \
 		create.o \
diff --git a/source4/torture/smb2/oplocks.c b/source4/torture/smb2/oplocks.c
deleted file mode 100644
index 3fee0b4..0000000
--- a/source4/torture/smb2/oplocks.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
-   Unix SMB/CIFS implementation.
-
-   test suite for SMB2 oplocks
-
-   Copyright (C) Stefan Metzmacher 2008
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "includes.h"
-#include "librpc/gen_ndr/security.h"
-#include "libcli/smb2/smb2.h"
-#include "libcli/smb2/smb2_calls.h"
-#include "torture/torture.h"
-#include "torture/smb2/proto.h"
-
-#define CHECK_VAL(v, correct) do { \
-	if ((v) != (correct)) { \
-		torture_result(tctx, TORTURE_FAIL, "(%s): wrong value for %s got 0x%x - should be 0x%x\n", \
-				__location__, #v, (int)v, (int)correct); \
-		ret = false; \
-	}} while (0)
-
-#define CHECK_STATUS(status, correct) do { \
-	if (!NT_STATUS_EQUAL(status, correct)) { \
-		torture_result(tctx, TORTURE_FAIL, __location__": Incorrect status %s - should be %s", \
-		       nt_errstr(status), nt_errstr(correct)); \
-		ret = false; \
-		goto done; \
-	}} while (0)
-
-static struct {
-	struct smb2_handle handle;
-	uint8_t level;
-	struct smb2_break br;
-	int count;
-	int failures;
-} break_info;
-
-static void torture_oplock_break_callback(struct smb2_request *req)
-{
-	NTSTATUS status;
-	struct smb2_break br;
-
-	ZERO_STRUCT(br);
-	status = smb2_break_recv(req, &break_info.br);
-	if (!NT_STATUS_IS_OK(status)) {
-		break_info.failures++;
-	}
-
-	return;
-}
-
-/* a oplock break request handler */
-static bool torture_oplock_handler(struct smb2_transport *transport,
-				   const struct smb2_handle *handle,
-				   uint8_t level, void *private_data)
-{
-	struct smb2_tree *tree = private_data;
-	const char *name;
-	struct smb2_request *req;
-
-	break_info.handle	= *handle;
-	break_info.level	= level;
-	break_info.count++;
-
-	switch (level) {
-	case SMB2_OPLOCK_LEVEL_II:
-		name = "level II";
-		break;
-	case SMB2_OPLOCK_LEVEL_NONE:
-		name = "none";
-		break;
-	default:
-		name = "unknown";
-		break_info.failures++;
-	}
-	printf("Acking to %s [0x%02X] in oplock handler\n",
-		name, level);
-
-	ZERO_STRUCT(break_info.br);
-	break_info.br.in.file.handle	= *handle;
-	break_info.br.in.oplock_level	= level;
-	break_info.br.in.reserved	= 0;
-	break_info.br.in.reserved2	= 0;
-
-	req = smb2_break_send(tree, &break_info.br);
-	req->async.fn = torture_oplock_break_callback;
-	req->async.private_data = NULL;
-
-	return true;
-}
-
-bool torture_smb2_oplock_batch1(struct torture_context *tctx,
-				struct smb2_tree *tree)
-{
-	TALLOC_CTX *mem_ctx = talloc_new(tctx);
-	struct smb2_handle h1, h2;
-	struct smb2_create io;
-	NTSTATUS status;
-	const char *fname = "oplock.dat";
-	bool ret = true;
-
-	tree->session->transport->oplock.handler	= torture_oplock_handler;
-	tree->session->transport->oplock.private_data	= tree;
-
-	smb2_util_unlink(tree, fname);
-
-	ZERO_STRUCT(break_info);
-
-	ZERO_STRUCT(io);
-	io.in.security_flags		= 0x00;
-	io.in.oplock_level		= SMB2_OPLOCK_LEVEL_BATCH;
-	io.in.impersonation_level	= NTCREATEX_IMPERSONATION_IMPERSONATION;
-	io.in.create_flags		= 0x00000000;
-	io.in.reserved			= 0x00000000;
-	io.in.desired_access		= SEC_RIGHTS_FILE_ALL;
-	io.in.file_attributes		= FILE_ATTRIBUTE_NORMAL;
-	io.in.share_access		= NTCREATEX_SHARE_ACCESS_READ |
-					  NTCREATEX_SHARE_ACCESS_WRITE |
-					  NTCREATEX_SHARE_ACCESS_DELETE;
-	io.in.create_disposition	= NTCREATEX_DISP_OPEN_IF;
-	io.in.create_options		= NTCREATEX_OPTIONS_SEQUENTIAL_ONLY |
-					  NTCREATEX_OPTIONS_ASYNC_ALERT	|
-					  NTCREATEX_OPTIONS_NON_DIRECTORY_FILE |
-					  0x00200000;
-	io.in.fname			= fname;
-
-	status = smb2_create(tree, mem_ctx, &io);
-	CHECK_STATUS(status, NT_STATUS_OK);
-	CHECK_VAL(io.out.oplock_level, SMB2_OPLOCK_LEVEL_BATCH);
-	/*CHECK_VAL(io.out.reserved, 0);*/
-	CHECK_VAL(io.out.create_action, NTCREATEX_ACTION_CREATED);
-	CHECK_VAL(io.out.alloc_size, 0);
-	CHECK_VAL(io.out.size, 0);
-	CHECK_VAL(io.out.file_attr, FILE_ATTRIBUTE_ARCHIVE);
-	CHECK_VAL(io.out.reserved2, 0);
-	CHECK_VAL(break_info.count, 0);
-
-	h1 = io.out.file.handle;
-
-	ZERO_STRUCT(io.in.blobs);
-	status = smb2_create(tree, mem_ctx, &io);
-	CHECK_VAL(break_info.count, 1);
-	CHECK_VAL(break_info.failures, 0);
-	CHECK_VAL(break_info.level, SMB2_OPLOCK_LEVEL_II);
-	CHECK_STATUS(status, NT_STATUS_OK);
-	CHECK_VAL(io.out.oplock_level, SMB2_OPLOCK_LEVEL_II);
-	/*CHECK_VAL(io.out.reserved, 0);*/
-	CHECK_VAL(io.out.create_action, NTCREATEX_ACTION_EXISTED);
-	CHECK_VAL(io.out.alloc_size, 0);
-	CHECK_VAL(io.out.size, 0);
-	CHECK_VAL(io.out.file_attr, FILE_ATTRIBUTE_ARCHIVE);
-	CHECK_VAL(io.out.reserved2, 0);
-
-	h2 = io.out.file.handle;
-
-done:
-	talloc_free(mem_ctx);
-
-	smb2_util_close(tree, h1);
-	smb2_util_close(tree, h2);
-	smb2_util_unlink(tree, fname);
-	return ret;
-}
diff --git a/source4/torture/smb2/smb2.c b/source4/torture/smb2/smb2.c
index 4a3ca14..2430b09 100644
--- a/source4/torture/smb2/smb2.c
+++ b/source4/torture/smb2/smb2.c
@@ -139,10 +139,12 @@ NTSTATUS torture_smb2_init(void)
 	torture_suite_add_suite(suite, torture_smb2_create_init());
 	torture_suite_add_simple_test(suite, "NOTIFY", torture_smb2_notify);
 	torture_suite_add_suite(suite, torture_smb2_durable_open_init());
-	torture_suite_add_1smb2_test(suite, "OPLOCK-BATCH1", torture_smb2_oplock_batch1);
 	torture_suite_add_suite(suite, torture_smb2_dir_init());
 	torture_suite_add_suite(suite, torture_smb2_lease_init());
 	torture_suite_add_suite(suite, torture_smb2_compound_init());
+	torture_suite_add_suite(suite, torture_smb2_oplocks_init());
+	torture_suite_add_1smb2_test(suite, "BENCH-OPLOCK", test_smb2_bench_oplock);
+	torture_suite_add_1smb2_test(suite, "HOLD-OPLOCK", test_smb2_hold_oplock);
 
 	suite->description = talloc_strdup(suite, "SMB2-specific tests");
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list