[SCM] Samba Shared Repository - branch master updated

Steven Danneman sdanneman at samba.org
Tue Nov 17 18:07:42 MST 2009


The branch, master has been updated
       via  15d93a5... s4/torture: Port SMBv1 Change Notify tests to SMBv2
       via  7447138... s4/libcli: add a FILE_NOTIFY_CHANGE_ALL macro
       via  f7e3809... s4/torture: add a new ulong parameteric torture option
       via  c14b0ce... torture/smb2: make SMB2 BRL tests pass against W2K8R2
      from  7407b52... Start removing SMB_STRUCT_STAT variables except for the directory enumeration code (which needs it). Jeremy.

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


- Log -----------------------------------------------------------------
commit 15d93a5d8e21893e1cca5c989dbf97010aae1622
Author: Aravind Srinivasan <aravind.srinivasan at isilon.com>
Date:   Tue Nov 17 15:30:11 2009 -0800

    s4/torture: Port SMBv1 Change Notify tests to SMBv2
    
    * Ported all tests from raw/notify.c to smb2/notify.c
    * Parameterized the max_buffer_size so it can be set on a
      per-target basis.
    * Fixed CHECK macros to use torture_result
    * Created a SMB2-NOTIFY test suite

commit 74471387e03c9a0b12198275826ee56ee68994ab
Author: Aravind Srinivasan <aravind.srinivasan at isilon.com>
Date:   Tue Nov 17 15:24:40 2009 -0800

    s4/libcli: add a FILE_NOTIFY_CHANGE_ALL macro
    
    This macro encompasses all possible file notifications that can
    be raised.

commit f7e3809d66c54e26a7b8f8bc93b530bc9fc35f40
Author: Aravind Srinivasan <aravind.srinivasan at isilon.com>
Date:   Tue Nov 17 15:23:23 2009 -0800

    s4/torture: add a new ulong parameteric torture option

commit c14b0cea488f78fc2fb88646d0cc674c6154c008
Author: Steven Danneman <steven.danneman at isilon.com>
Date:   Fri Nov 13 15:13:19 2009 -0800

    torture/smb2: make SMB2 BRL tests pass against W2K8R2
    
    The BRL tests previously based their results off several bugs in the
    W2K8 byte range lock code.  I've fixed up the tests to pass against
    Win7 which has fixed these bugs, and assume that the Win7 behavior
    is the default.
    
    I have inverted the test behavior for >63-bit lock requests.  The
    tests previously expected NT_STATUS_OK as their default in this
    case.  I've changed that default to expect STATUS_INVALID_LOCK_RANGE.
    This may requires some changing of make test to compensate.
    
    I've also removed a few test scenarios from VALID-REQUEST in preparation
    of replacing them with separate tests ported from RAW-LOCK.

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

Summary of changes:
 lib/torture/torture.c         |    8 +
 source4/libcli/raw/smb.h      |    8 +
 source4/torture/smb2/lock.c   |  201 +++---
 source4/torture/smb2/notify.c | 1869 ++++++++++++++++++++++++++++++++++++++++-
 source4/torture/smb2/smb2.c   |    2 +-
 source4/torture/smbtorture.c  |    4 +
 source4/torture/smbtorture.h  |   16 +
 7 files changed, 1966 insertions(+), 142 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/torture/torture.c b/lib/torture/torture.c
index 392cb0a..672726e 100644
--- a/lib/torture/torture.c
+++ b/lib/torture/torture.c
@@ -425,6 +425,14 @@ int torture_setting_int(struct torture_context *test, const char *name,
 	return lp_parm_int(test->lp_ctx, NULL, "torture", name, default_value);
 }
 
+unsigned long torture_setting_ulong(struct torture_context *test,
+				    const char *name,
+				    unsigned long default_value)
+{
+	return lp_parm_ulong(test->lp_ctx, NULL, "torture", name,
+			     default_value);
+}
+
 double torture_setting_double(struct torture_context *test, const char *name, 
 							double default_value)
 {
diff --git a/source4/libcli/raw/smb.h b/source4/libcli/raw/smb.h
index d4091ac..4fbf76f 100644
--- a/source4/libcli/raw/smb.h
+++ b/source4/libcli/raw/smb.h
@@ -464,6 +464,14 @@
 #define FILE_NOTIFY_CHANGE_NAME \
 	(FILE_NOTIFY_CHANGE_FILE_NAME|FILE_NOTIFY_CHANGE_DIR_NAME)
 
+#define FILE_NOTIFY_CHANGE_ALL \
+	(FILE_NOTIFY_CHANGE_FILE_NAME   | FILE_NOTIFY_CHANGE_DIR_NAME | \
+	 FILE_NOTIFY_CHANGE_ATTRIBUTES  | FILE_NOTIFY_CHANGE_SIZE | \
+	 FILE_NOTIFY_CHANGE_LAST_WRITE  | FILE_NOTIFY_CHANGE_LAST_ACCESS | \
+	 FILE_NOTIFY_CHANGE_CREATION    | FILE_NOTIFY_CHANGE_EA | \
+	 FILE_NOTIFY_CHANGE_SECURITY	| FILE_NOTIFY_CHANGE_STREAM_NAME | \
+	 FILE_NOTIFY_CHANGE_STREAM_SIZE | FILE_NOTIFY_CHANGE_STREAM_WRITE)
+
 /* change notify action results */
 #define NOTIFY_ACTION_ADDED 1
 #define NOTIFY_ACTION_REMOVED 2
diff --git a/source4/torture/smb2/lock.c b/source4/torture/smb2/lock.c
index 033e12f..211578b 100644
--- a/source4/torture/smb2/lock.c
+++ b/source4/torture/smb2/lock.c
@@ -27,8 +27,9 @@
 #include "torture/smb2/proto.h"
 
 
-#define TARGET_IS_WINDOWS(_tctx) (torture_setting_bool(_tctx, "win7", false) || torture_setting_bool(torture, "windows", false))
-#define TARGET_IS_WIN7(_tctx) (torture_setting_bool(_tctx, "win7", false))
+#define TARGET_SUPPORTS_INVALID_LOCK_RANGE(_tctx) \
+    (torture_setting_bool(_tctx, "invalid_lock_range_support", true))
+#define TARGET_IS_W2K8(_tctx) (torture_setting_bool(_tctx, "w2k8", false))
 
 #define CHECK_STATUS(status, correct) do { \
 	if (!NT_STATUS_EQUAL(status, correct)) { \
@@ -65,6 +66,8 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree
 
 	lck.in.locks		= el;
 
+	torture_comment(torture, "Test request with 0 locks.\n");
+
 	lck.in.lock_count	= 0x0000;
 	lck.in.reserved		= 0x00000000;
 	lck.in.file.handle	= h;
@@ -75,6 +78,16 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree
 	status = smb2_lock(tree, &lck);
 	CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
 
+	lck.in.lock_count	= 0x0000;
+	lck.in.reserved		= 0x00000000;
+	lck.in.file.handle	= h;
+	el[0].offset		= 0;
+	el[0].length		= 0;
+	el[0].reserved		= 0x00000000;
+	el[0].flags		= SMB2_LOCK_FLAG_SHARED;
+	status = smb2_lock(tree, &lck);
+	CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+
 	lck.in.lock_count	= 0x0001;
 	lck.in.reserved		= 0x00000000;
 	lck.in.file.handle	= h;
@@ -83,8 +96,15 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree
 	el[0].reserved		= 0x00000000;
 	el[0].flags		= SMB2_LOCK_FLAG_NONE;
 	status = smb2_lock(tree, &lck);
-	CHECK_STATUS(status, NT_STATUS_OK);
-	CHECK_VALUE(lck.out.reserved, 0);
+	if (TARGET_IS_W2K8(torture)) {
+		CHECK_STATUS(status, NT_STATUS_OK);
+		torture_warning(torture, "Target has bug validating lock flags "
+					 "parameter.\n");
+	} else {
+		CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+	}
+
+	torture_comment(torture, "Test >63-bit lock requests.\n");
 
 	lck.in.file.handle.data[0] +=1;
 	status = smb2_lock(tree, &lck);
@@ -97,58 +117,25 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree
 	el[0].offset		= UINT64_MAX;
 	el[0].length		= UINT64_MAX;
 	el[0].reserved		= 0x00000000;
-	el[0].flags		= SMB2_LOCK_FLAG_EXCLUSIVE|SMB2_LOCK_FLAG_FAIL_IMMEDIATELY;
+	el[0].flags		= SMB2_LOCK_FLAG_EXCLUSIVE |
+				  SMB2_LOCK_FLAG_FAIL_IMMEDIATELY;
 	status = smb2_lock(tree, &lck);
-	if (TARGET_IS_WIN7(torture)) {
+	if (TARGET_SUPPORTS_INVALID_LOCK_RANGE(torture)) {
 		CHECK_STATUS(status, NT_STATUS_INVALID_LOCK_RANGE);
 	} else {
 		CHECK_STATUS(status, NT_STATUS_OK);
+		CHECK_VALUE(lck.out.reserved, 0);
 	}
-	CHECK_VALUE(lck.out.reserved, 0);
 
 	lck.in.reserved		= 0x123ab2;
 	status = smb2_lock(tree, &lck);
-	if (TARGET_IS_WIN7(torture)) {
-		CHECK_STATUS(status, NT_STATUS_INVALID_LOCK_RANGE);
-	} else if (TARGET_IS_WINDOWS(torture)) {
-		CHECK_STATUS(status, NT_STATUS_OK);
-	} else {
-		CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
-	}
-	CHECK_VALUE(lck.out.reserved, 0);
-
-	lck.in.reserved		= 0x123ab3;
-	status = smb2_lock(tree, &lck);
-	if (TARGET_IS_WIN7(torture)) {
+	if (TARGET_SUPPORTS_INVALID_LOCK_RANGE(torture)) {
 		CHECK_STATUS(status, NT_STATUS_INVALID_LOCK_RANGE);
-	} else if (TARGET_IS_WINDOWS(torture)) {
-		CHECK_STATUS(status, NT_STATUS_OK);
 	} else {
 		CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
 	}
-	CHECK_VALUE(lck.out.reserved, 0);
 
-	lck.in.reserved		= 0x123ab4;
-	status = smb2_lock(tree, &lck);
-	if (TARGET_IS_WIN7(torture)) {
-		CHECK_STATUS(status, NT_STATUS_INVALID_LOCK_RANGE);
-	} else if (TARGET_IS_WINDOWS(torture)) {
-		CHECK_STATUS(status, NT_STATUS_OK);
-	} else {
-		CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
-	}
-	CHECK_VALUE(lck.out.reserved, 0);
-
-	lck.in.reserved		= 0x123ab5;
-	status = smb2_lock(tree, &lck);
-	if (TARGET_IS_WIN7(torture)) {
-		CHECK_STATUS(status, NT_STATUS_INVALID_LOCK_RANGE);
-	} else if (TARGET_IS_WINDOWS(torture)) {
-		CHECK_STATUS(status, NT_STATUS_OK);
-	} else {
-		CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
-	}
-	CHECK_VALUE(lck.out.reserved, 0);
+	torture_comment(torture, "Test basic lock stacking.\n");
 
 	lck.in.lock_count	= 0x0001;
 	lck.in.reserved		= 0x12345678;
@@ -156,43 +143,13 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree
 	el[0].offset		= UINT32_MAX;
 	el[0].length		= UINT32_MAX;
 	el[0].reserved		= 0x87654321;
-	el[0].flags		= SMB2_LOCK_FLAG_EXCLUSIVE|SMB2_LOCK_FLAG_FAIL_IMMEDIATELY;
-	status = smb2_lock(tree, &lck);
-	CHECK_STATUS(status, NT_STATUS_OK);
-	CHECK_VALUE(lck.out.reserved, 0);
-
-	status = smb2_lock(tree, &lck);
-	CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
-
-	status = smb2_lock(tree, &lck);
-	if (TARGET_IS_WINDOWS(torture)) {
-		CHECK_STATUS(status, NT_STATUS_OK);
-	} else {
-		CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
-	}
-	CHECK_VALUE(lck.out.reserved, 0);
-
-	status = smb2_lock(tree, &lck);
-	CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
-
-	status = smb2_lock(tree, &lck);
-	if (TARGET_IS_WINDOWS(torture)) {
-		CHECK_STATUS(status, NT_STATUS_OK);
-	} else {
-		CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
-	}
-	CHECK_VALUE(lck.out.reserved, 0);
-
-	el[0].flags		= 0x00000000;
-	status = smb2_lock(tree, &lck);
-	CHECK_STATUS(status, NT_STATUS_OK);
-	CHECK_VALUE(lck.out.reserved, 0);
-
+	el[0].flags		= SMB2_LOCK_FLAG_EXCLUSIVE |
+				  SMB2_LOCK_FLAG_FAIL_IMMEDIATELY;
 	status = smb2_lock(tree, &lck);
 	CHECK_STATUS(status, NT_STATUS_OK);
 	CHECK_VALUE(lck.out.reserved, 0);
 
-	el[0].flags		= 0x00000001;
+	el[0].flags		= SMB2_LOCK_FLAG_SHARED;
 	status = smb2_lock(tree, &lck);
 	CHECK_STATUS(status, NT_STATUS_OK);
 	CHECK_VALUE(lck.out.reserved, 0);
@@ -224,12 +181,10 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree
 	status = smb2_lock(tree, &lck);
 	CHECK_STATUS(status, NT_STATUS_OK);
 	status = smb2_lock(tree, &lck);
-	CHECK_STATUS(status, NT_STATUS_OK);
-	status = smb2_lock(tree, &lck);
-	CHECK_STATUS(status, NT_STATUS_OK);
-	status = smb2_lock(tree, &lck);
 	CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
 
+	torture_comment(torture, "Test flags field permutations.\n");
+
 	lck.in.lock_count	= 0x0001;
 	lck.in.reserved		= 0;
 	lck.in.file.handle	= h;
@@ -239,27 +194,47 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree
 	el[0].flags		= ~SMB2_LOCK_FLAG_ALL_MASK;
 
 	status = smb2_lock(tree, &lck);
-	CHECK_STATUS(status, NT_STATUS_OK);
+	if (TARGET_IS_W2K8(torture)) {
+		CHECK_STATUS(status, NT_STATUS_OK);
+		torture_warning(torture, "Target has bug validating lock flags "
+					 "parameter.\n");
+	} else {
+		CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+	}
 
-	el[0].flags		= SMB2_LOCK_FLAG_UNLOCK;
-	status = smb2_lock(tree, &lck);
-	CHECK_STATUS(status, NT_STATUS_OK);
+	if (TARGET_IS_W2K8(torture)) {
+		el[0].flags		= SMB2_LOCK_FLAG_UNLOCK;
+		status = smb2_lock(tree, &lck);
+		CHECK_STATUS(status, NT_STATUS_OK);
+	}
 
 	el[0].flags		= SMB2_LOCK_FLAG_UNLOCK;
 	status = smb2_lock(tree, &lck);
 	CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
 
-	el[0].flags		= SMB2_LOCK_FLAG_UNLOCK | SMB2_LOCK_FLAG_EXCLUSIVE;
+	el[0].flags		= SMB2_LOCK_FLAG_UNLOCK |
+				  SMB2_LOCK_FLAG_EXCLUSIVE;
 	status = smb2_lock(tree, &lck);
 	CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
 
-	el[0].flags		= SMB2_LOCK_FLAG_UNLOCK | SMB2_LOCK_FLAG_SHARED;
+	el[0].flags		= SMB2_LOCK_FLAG_UNLOCK |
+				  SMB2_LOCK_FLAG_SHARED;
 	status = smb2_lock(tree, &lck);
 	CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
 
-	el[0].flags		= SMB2_LOCK_FLAG_UNLOCK | SMB2_LOCK_FLAG_FAIL_IMMEDIATELY;
+	el[0].flags		= SMB2_LOCK_FLAG_UNLOCK |
+				  SMB2_LOCK_FLAG_FAIL_IMMEDIATELY;
 	status = smb2_lock(tree, &lck);
-	CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
+	if (TARGET_IS_W2K8(torture)) {
+		CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
+		torture_warning(torture, "Target has bug validating lock flags "
+					 "parameter.\n");
+	} else {
+		CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+	}
+
+	torture_comment(torture, "Test return error when 2 locks are "
+				 "requested\n");
 
 	lck.in.lock_count	= 2;
 	lck.in.reserved		= 0;
@@ -281,13 +256,25 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree
 	el[0].flags		= 0;
 	el[1].flags		= 0;
 	status = smb2_lock(tree, &lck);
-	CHECK_STATUS(status, NT_STATUS_OK);
+	if (TARGET_IS_W2K8(torture)) {
+		CHECK_STATUS(status, NT_STATUS_OK);
+		torture_warning(torture, "Target has bug validating lock flags "
+					 "parameter.\n");
+	} else {
+		CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+	}
 
 	lck.in.lock_count	= 2;
 	el[0].flags		= SMB2_LOCK_FLAG_UNLOCK;
 	el[1].flags		= 0;
 	status = smb2_lock(tree, &lck);
-	CHECK_STATUS(status, NT_STATUS_OK);
+	if (TARGET_IS_W2K8(torture)) {
+		CHECK_STATUS(status, NT_STATUS_OK);
+		torture_warning(torture, "Target has bug validating lock flags "
+					 "parameter.\n");
+	} else {
+		CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
+	}
 
 	lck.in.lock_count	= 1;
 	el[0].flags		= SMB2_LOCK_FLAG_UNLOCK;
@@ -305,7 +292,7 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree
 	CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
 
 	lck.in.lock_count	= 1;
-	el[0].flags		= 0;
+	el[0].flags		= SMB2_LOCK_FLAG_SHARED;
 	status = smb2_lock(tree, &lck);
 	CHECK_STATUS(status, NT_STATUS_OK);
 
@@ -322,7 +309,6 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree
 	el[0].flags		= SMB2_LOCK_FLAG_UNLOCK;
 	status = smb2_lock(tree, &lck);
 	CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
-	
 
 done:
 	return ret;
@@ -463,7 +449,8 @@ done:
 	return ret;
 }
 
-static bool test_lock_rw_none(struct torture_context *torture, struct smb2_tree *tree)
+static bool test_lock_rw_none(struct torture_context *torture,
+			      struct smb2_tree *tree)
 {
 	struct test_lock_read_write_state s = {
 		.fname			= "lock_rw_none.dat",
@@ -474,10 +461,18 @@ static bool test_lock_rw_none(struct torture_context *torture, struct smb2_tree
 		.read_h2_status		= NT_STATUS_OK,
 	};
 
+	if (!TARGET_IS_W2K8(torture)) {
+		torture_skip(torture, "RW-NONE tests the behavior of a "
+			     "NONE-type lock, which is the same as a SHARED "
+			     "lock but is granted due to a bug in W2K8.  If "
+			     "target is not W2K8 we skip this test.\n");
+	}
+
 	return test_lock_read_write(torture, tree, &s);
 }
 
-static bool test_lock_rw_shared(struct torture_context *torture, struct smb2_tree *tree)
+static bool test_lock_rw_shared(struct torture_context *torture,
+				struct smb2_tree *tree)
 {
 	struct test_lock_read_write_state s = {
 		.fname			= "lock_rw_shared.dat",
@@ -491,10 +486,11 @@ static bool test_lock_rw_shared(struct torture_context *torture, struct smb2_tre
 	return test_lock_read_write(torture, tree, &s);
 }
 
-static bool test_lock_rw_exclusiv(struct torture_context *torture, struct smb2_tree *tree)
+static bool test_lock_rw_exclusive(struct torture_context *torture,
+				   struct smb2_tree *tree)
 {
 	struct test_lock_read_write_state s = {
-		.fname			= "lock_rw_exclusiv.dat",
+		.fname			= "lock_rw_exclusive.dat",
 		.lock_flags		= SMB2_LOCK_FLAG_EXCLUSIVE,
 		.write_h1_status	= NT_STATUS_OK,
 		.read_h1_status		= NT_STATUS_OK,
@@ -505,7 +501,8 @@ static bool test_lock_rw_exclusiv(struct torture_context *torture, struct smb2_t
 	return test_lock_read_write(torture, tree, &s);
 }
 
-static bool test_lock_auto_unlock(struct torture_context *torture, struct smb2_tree *tree)
+static bool test_lock_auto_unlock(struct torture_context *torture,
+				  struct smb2_tree *tree)
 {
 	bool ret = true;
 	NTSTATUS status;
@@ -528,7 +525,8 @@ static bool test_lock_auto_unlock(struct torture_context *torture, struct smb2_t
 	lck.in.file.handle	= h;
 	el[0].offset		= 0;
 	el[0].length		= 1;
-	el[0].flags		= SMB2_LOCK_FLAG_EXCLUSIVE | SMB2_LOCK_FLAG_FAIL_IMMEDIATELY;
+	el[0].flags		= SMB2_LOCK_FLAG_EXCLUSIVE |
+				  SMB2_LOCK_FLAG_FAIL_IMMEDIATELY;
 	status = smb2_lock(tree, &lck);
 	CHECK_STATUS(status, NT_STATUS_OK);
 
@@ -536,8 +534,11 @@ static bool test_lock_auto_unlock(struct torture_context *torture, struct smb2_t
 	CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
 
 	status = smb2_lock(tree, &lck);
-	if (TARGET_IS_WINDOWS(torture)) {
+	if (TARGET_IS_W2K8(torture)) {
 		CHECK_STATUS(status, NT_STATUS_OK);
+		torture_warning(torture, "Target has \"pretty please\" bug. "
+				"Every other contending lock request "
+				"succeeds.");
 	} else {
 		CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
 	}
@@ -559,7 +560,7 @@ struct torture_suite *torture_smb2_lock_init(void)
 	torture_suite_add_1smb2_test(suite, "VALID-REQUEST", test_valid_request);
 	torture_suite_add_1smb2_test(suite, "RW-NONE", test_lock_rw_none);
 	torture_suite_add_1smb2_test(suite, "RW-SHARED", test_lock_rw_shared);
-	torture_suite_add_1smb2_test(suite, "RW-EXCLUSIV", test_lock_rw_exclusiv);
+	torture_suite_add_1smb2_test(suite, "RW-EXCLUSIVE", test_lock_rw_exclusive);
 	torture_suite_add_1smb2_test(suite, "AUTO-UNLOCK", test_lock_auto_unlock);
 
 	suite->description = talloc_strdup(suite, "SMB2-LOCK tests");
diff --git a/source4/torture/smb2/notify.c b/source4/torture/smb2/notify.c
index 5cf580a..60a6468 100644
--- a/source4/torture/smb2/notify.c
+++ b/source4/torture/smb2/notify.c
@@ -1,20 +1,21 @@
-/* 
+/*
    Unix SMB/CIFS implementation.
 
    SMB2 notify test suite
 
    Copyright (C) Stefan Metzmacher 2006
-   
+   Copyright (C) Andrew Tridgell 2009
+
    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/>.
 */
@@ -25,59 +26,77 @@
 
 #include "torture/torture.h"
 #include "torture/smb2/proto.h"
+#include "librpc/gen_ndr/ndr_security.h"
+#include "libcli/security/security.h"
+#include "torture/util.h"
+
+#include "system/filesys.h"
+#include "auth/credentials/credentials.h"
+#include "lib/cmdline/popt_common.h"
+#include "librpc/gen_ndr/security.h"
 
 #include "lib/events/events.h"
 
+#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
+#include "libcli/libcli.h"
+
 #define CHECK_STATUS(status, correct) do { \
 	if (!NT_STATUS_EQUAL(status, correct)) { \
-		printf("(%s) Incorrect status %s - should be %s\n", \
+		torture_result(torture, TORTURE_FAIL, \
+		       "(%s) Incorrect status %s - should be %s\n", \
 		       __location__, nt_errstr(status), nt_errstr(correct)); \
 		ret = false; \
 		goto done; \
 	}} while (0)
 
-#define CHECK_VALUE(v, correct) do { \
+#define CHECK_VAL(v, correct) do { \
 	if ((v) != (correct)) { \
-		printf("(%s) Incorrect value %s=%d - should be %d\n", \
-		       __location__, #v, v, correct); \
+		torture_result(torture, TORTURE_FAIL, \
+		       "(%s) wrong value for %s  0x%x should be 0x%x\n", \
+		       __location__, #v, (int)v, (int)correct); \
 		ret = false; \
 		goto done; \
 	}} while (0)
 
 #define CHECK_WIRE_STR(field, value) do { \
 	if (!field.s || strcmp(field.s, value)) { \
-		printf("(%s) %s [%s] != %s\n", \
-			  __location__, #field, field.s, value); \
+		torture_result(torture, TORTURE_FAIL, \
+			"(%s) %s [%s] != %s\n",  __location__, #field, \
+			field.s, value); \
 		ret = false; \
 		goto done; \
 	}} while (0)
 
+#define BASEDIR "test_notify"
 #define FNAME "smb2-notify01.dat"
 
-#define TARGET_IS_WIN7(_tctx) (torture_setting_bool(_tctx, "win7", false))
-
-static bool test_valid_request(struct torture_context *tctx, struct smb2_tree *tree)


-- 
Samba Shared Repository


More information about the samba-cvs mailing list