[SCM] Samba Shared Repository - branch master updated

Tim Prouty tprouty at samba.org
Mon Dec 7 17:59:46 MST 2009


The branch, master has been updated
       via  105eb95... s4 quicktest: exclude raw-streams from quicktest until bug is fixed
       via  f717a79... s4 torture: Add a new torture:hide_on_access_denied parameter
       via  f4aa47b... s4 torture: win 7 doesn't like the sequential_only flag for directories
       via  d252d23... s4 torture: Port RAW-ACLS tests to SMB2
       via  8ceb428... s4 torure: Add SMB2 utility functions
       via  1724273... s4 torture: RAW-ACL Improvements
       via  919440a... s4 torture: Convert RAW-STREAMS to a set of test suites rather than a monolithic test
       via  6bc8a2b... s4 torture: Update RAW-RENAME to pass against win7
       via  cd72301... s4 torture: Add a new RAW-STREAMS test to simulate the summary tab
       via  5d66d43... s4 torture: Fix the streams create disposition tests to actually return an error on failure
      from  47f5aac... s4/torture: add test for zero byte read contention with byte range locks

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


- Log -----------------------------------------------------------------
commit 105eb95a57c48e0cb3cf69864e24e958ab2b3c59
Author: Tim Prouty <tprouty at samba.org>
Date:   Fri Dec 4 13:02:51 2009 -0800

    s4 quicktest: exclude raw-streams from quicktest until bug is fixed

commit f717a79eff334835eb33783adcbb261e126185d6
Author: Tim Prouty <tprouty at samba.org>
Date:   Fri Dec 4 16:07:35 2009 -0800

    s4 torture: Add a new torture:hide_on_access_denied parameter
    
    It appears some newer versions of windows return
    NT_STATUS_OBJECT_NAME_NOT_FOUND on a createfile when access is denied
    rather than NT_STATUS_ACCESS_DENIED.  I'm not sure how this translates
    to directory enumeration yet, but for now make this a parameter that
    can be checked in the various torture tests.
    
    This also gets RAW-ACLS and SMB2-CREATE passing against win7.

commit f4aa47b5ab265b30a0708b72936e1bc26a793df6
Author: Tim Prouty <tprouty at samba.org>
Date:   Thu Aug 6 14:31:01 2009 -0700

    s4 torture: win 7 doesn't like the sequential_only flag for directories
    
    Remove it for now

commit d252d23ff15577e2c7049181b5b30692c4bcd6bc
Author: Zack Kirsch <zack.kirsch at isilon.com>
Date:   Sat Jul 4 16:16:23 2009 -0700

    s4 torture: Port RAW-ACLS tests to SMB2
    
    - The smblsa calls had to be commented out for now and should be fixed
      later, but they aren't crucial to the test.
    - The first two tests from RAW-ACLS were already ported to
      torture_smb2_setinfo() and test_create_acl(). Modifications were
      made similar to the RAW-ACLS changes.
    - test_sd_get_set() was ported, but does not pass against XP or Vista;
      it is not added to the SMB2-ACLS test suite.
    - printf -> torture_comment / torture_warning / torture_result

commit 8ceb428c5568bd690cb6811a0618f7866633705b
Author: Zack Kirsch <zack.kirsch at isilon.com>
Date:   Wed Jul 1 13:30:12 2009 -0700

    s4 torure: Add SMB2 utility functions
    
    - Add a torture_setup_dir() equivalent in SMB2, called smb2_util_setup_dir().
    - Add verify_sd() and verify_attrib() helper functions for SMB2.

commit 1724273ab94269783ddbe367c5c9ec2bf690b70b
Author: Zack Kirsch <zack.kirsch at isilon.com>
Date:   Thu Jul 2 14:08:41 2009 -0700

    s4 torture: RAW-ACL Improvements
    
    - Change RAW-ACLS test suite so each test can be run individually.
    - Add verify_sd() and verify_attrib() helper functions.
    - Change test_nttrans_create() to work for both files and directories.
    - Fix a segfault in test_inheritance() when the test errors out early.
    - test_sd_get_set() does not pass against XP or Vista, so it is no longer added
      to the RAW-ACLS test suite.
    - Minor fixes to test_inheritance().
    - New INHERITFLAGS test, which tests the auto inheritance flags a bit more.
    - printf -> torture_comment / torture_warning / torture_result

commit 919440a2aa19b8e0eeb6387fea99dd049132b7dd
Author: Tim Prouty <tprouty at samba.org>
Date:   Fri Dec 4 13:04:12 2009 -0800

    s4 torture: Convert RAW-STREAMS to a set of test suites rather than a monolithic test

commit 6bc8a2bf0a180c86c12f6ce9a587ab869ee91e2d
Author: Tim Prouty <tprouty at samba.org>
Date:   Mon Oct 26 17:16:37 2009 -0700

    s4 torture: Update RAW-RENAME to pass against win7

commit cd72301efa13f5c77a6d0e3e8f25330fbe62ed41
Author: Tim Prouty <tprouty at samba.org>
Date:   Mon Oct 26 17:17:45 2009 -0700

    s4 torture: Add a new RAW-STREAMS test to simulate the summary tab

commit 5d66d43667f9356b50dad5555e6b5ed04b7a4fd2
Author: Tim Prouty <tprouty at samba.org>
Date:   Wed Oct 21 16:51:17 2009 -0700

    s4 torture: Fix the streams create disposition tests to actually return an error on failure

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

Summary of changes:
 source4/libcli/smb2/util.c     |    1 +
 source4/selftest/knownfail     |   10 +
 source4/selftest/quick         |    2 +-
 source4/torture/raw/acls.c     |  966 +++++++++++++++------
 source4/torture/raw/raw.c      |    4 +-
 source4/torture/raw/rename.c   |   32 +-
 source4/torture/raw/streams.c  |  443 ++++++----
 source4/torture/smb2/acls.c    | 1875 ++++++++++++++++++++++++++++++++++++++++
 source4/torture/smb2/config.mk |    1 +
 source4/torture/smb2/create.c  |  621 ++++++++++---
 source4/torture/smb2/setinfo.c |   89 +-
 source4/torture/smb2/smb2.c    |    1 +
 source4/torture/smb2/util.c    |  104 +++-
 source4/torture/smbtorture.c   |    3 +
 source4/torture/smbtorture.h   |    6 +
 source4/torture/util.h         |    1 +
 16 files changed, 3529 insertions(+), 630 deletions(-)
 create mode 100644 source4/torture/smb2/acls.c


Changeset truncated at 500 lines:

diff --git a/source4/libcli/smb2/util.c b/source4/libcli/smb2/util.c
index 9b8d688..992bd5c 100644
--- a/source4/libcli/smb2/util.c
+++ b/source4/libcli/smb2/util.c
@@ -25,6 +25,7 @@
 #include "libcli/smb2/smb2.h"
 #include "libcli/smb2/smb2_calls.h"
 #include "libcli/smb_composite/smb_composite.h"
+#include "librpc/gen_ndr/ndr_security.h"
 
 /*
   simple close wrapper with SMB2
diff --git a/source4/selftest/knownfail b/source4/selftest/knownfail
index ef3c10c..22fc4a1 100644
--- a/source4/selftest/knownfail
+++ b/source4/selftest/knownfail
@@ -69,3 +69,13 @@ samba4.raw.sfileinfo.*.END-OF-FILE # bug 6962
 samba4.raw.oplock.*.BATCH22 # bug 6963
 samba4.raw.lock.*.zerobyteread # bug 6974
 samba4.smb2.lock.*.ZEROBYTEREAD # bug 6974
+samba4.raw.streams.*.DELETE
+samba4.raw.streams.*.CREATEDISP
+samba4.raw.streams.*.SUMTAB
+samba4.raw.acls.*.CREATE_DIR
+samba4.raw.acls.*.CREATE_FILE
+samba4.raw.acls.*.INHERITFLAGS
+samba4.smb2.create.*.ACLDIR
+samba4.smb2.acls.*.GENERIC
+samba4.smb2.acls.*.INHERITFLAGS
+samba4.smb2.acls.*.OWNER
diff --git a/source4/selftest/quick b/source4/selftest/quick
index ff409ce..2f6e167 100644
--- a/source4/selftest/quick
+++ b/source4/selftest/quick
@@ -20,7 +20,7 @@ raw.close
 raw.ioctl
 raw.rename
 raw.eas
-raw.streams
+# raw.streams Bug xxxx
 base.open 
 rpc.altercontext
 rpc.join
diff --git a/source4/torture/raw/acls.c b/source4/torture/raw/acls.c
index 8fde373..e34a901 100644
--- a/source4/torture/raw/acls.c
+++ b/source4/torture/raw/acls.c
@@ -33,15 +33,102 @@
 
 #define CHECK_STATUS(status, correct) do { \
 	if (!NT_STATUS_EQUAL(status, correct)) { \
-		printf("(%s) Incorrect status %s - should be %s\n", \
-		       __location__, nt_errstr(status), nt_errstr(correct)); \
 		ret = false; \
+		torture_result(tctx, TORTURE_FAIL, "(%s) Incorrect status %s - should be %s\n", \
+		       __location__, nt_errstr(status), nt_errstr(correct)); \
 		goto done; \
 	}} while (0)
 
+#define FAIL_UNLESS(__cond)					\
+	do {							\
+		if (__cond) {} else {				\
+			ret = false; \
+			torture_result(tctx, TORTURE_FAIL, "%s) condition violated: %s\n", \
+			    __location__, #__cond); \
+			goto done; \
+		}						\
+	} while(0)
+
+#define CHECK_SECURITY_DESCRIPTOR(_sd1, _sd2) do { \
+	if (!security_descriptor_equal(_sd1, _sd2)) { \
+		torture_warning(tctx, "%s: security descriptors don't match!\n", __location__); \
+		torture_warning(tctx, "got:\n"); \
+		NDR_PRINT_DEBUG(security_descriptor, _sd1); \
+		torture_warning(tctx, "expected:\n"); \
+		NDR_PRINT_DEBUG(security_descriptor, _sd2); \
+		ret = false; \
+	} \
+} while (0)
 
-static bool test_sd(struct torture_context *tctx, 
-					struct smbcli_state *cli)
+/*
+ * Helper function to verify a security descriptor, by querying
+ * and comparing against the passed in sd.
+ * Copied to smb2_util_verify_sd() for SMB2.
+ */
+static bool verify_sd(TALLOC_CTX *tctx, struct smbcli_state *cli,
+    int fnum, struct security_descriptor *sd)
+{
+	NTSTATUS status;
+	bool ret = true;
+	union smb_fileinfo q = {};
+
+	if (sd) {
+		q.query_secdesc.level = RAW_FILEINFO_SEC_DESC;
+		q.query_secdesc.in.file.fnum = fnum;
+		q.query_secdesc.in.secinfo_flags =
+		    SECINFO_OWNER |
+		    SECINFO_GROUP |
+		    SECINFO_DACL;
+		status = smb_raw_fileinfo(cli->tree, tctx, &q);
+		CHECK_STATUS(status, NT_STATUS_OK);
+
+		/* sd->type &= ~SEC_DESC_DACL_AUTO_INHERITED; */
+
+		CHECK_SECURITY_DESCRIPTOR(q.query_secdesc.out.sd, sd);
+	}
+
+ done:
+	return ret;
+}
+
+/*
+ * Helper function to verify attributes, by querying
+ * and comparing against the passed attrib.
+ * Copied to smb2_util_verify_attrib() for SMB2.
+ */
+static bool verify_attrib(TALLOC_CTX *tctx, struct smbcli_state *cli,
+    int fnum, uint32_t attrib)
+{
+	NTSTATUS status;
+	bool ret = true;
+	union smb_fileinfo q2 = {};
+
+	if (attrib) {
+		q2.standard.level = RAW_FILEINFO_STANDARD;
+		q2.standard.in.file.fnum = fnum;
+		status = smb_raw_fileinfo(cli->tree, tctx, &q2);
+		CHECK_STATUS(status, NT_STATUS_OK);
+
+		q2.standard.out.attrib &= ~FILE_ATTRIBUTE_ARCHIVE;
+
+		if (q2.standard.out.attrib != attrib) {
+			torture_warning(tctx, "%s: attributes don't match! "
+			    "got %x, expected %x\n", __location__,
+			    (uint32_t)q2.standard.out.attrib,
+			    (uint32_t)attrib);
+			ret = false;
+		}
+	}
+
+ done:
+	return ret;
+}
+
+/**
+ * Test setting and removing a DACL.
+ * Test copied to torture_smb2_setinfo() for SMB2.
+ */
+static bool test_sd(struct torture_context *tctx, struct smbcli_state *cli)
 {
 	NTSTATUS status;
 	union smb_open io;
@@ -54,7 +141,10 @@ static bool test_sd(struct torture_context *tctx,
 	struct security_descriptor *sd;
 	struct dom_sid *test_sid;
 
-	printf("TESTING SETFILEINFO EA_SET\n");
+	if (!torture_setup_dir(cli, BASEDIR))
+		return false;
+
+	torture_comment(tctx, "TESTING SETFILEINFO EA_SET\n");
 
 	io.generic.level = RAW_OPEN_NTCREATEX;
 	io.ntcreatex.in.root_fid.fnum = 0;
@@ -84,9 +174,9 @@ static bool test_sd(struct torture_context *tctx,
 	CHECK_STATUS(status, NT_STATUS_OK);
 	sd = q.query_secdesc.out.sd;
 
-	printf("add a new ACE to the DACL\n");
+	torture_comment(tctx, "add a new ACE to the DACL\n");
 
-	test_sid = dom_sid_parse_talloc(tctx, "S-1-5-32-1234-5432");
+	test_sid = dom_sid_parse_talloc(tctx, SID_NT_AUTHENTICATED_USERS);
 
 	ace.type = SEC_ACE_TYPE_ACCESS_ALLOWED;
 	ace.flags = 0;
@@ -103,68 +193,58 @@ static bool test_sd(struct torture_context *tctx,
 
 	status = smb_raw_setfileinfo(cli->tree, &set);
 	CHECK_STATUS(status, NT_STATUS_OK);
+	FAIL_UNLESS(verify_sd(tctx, cli, fnum, sd));
 
-	status = smb_raw_fileinfo(cli->tree, tctx, &q);
-	CHECK_STATUS(status, NT_STATUS_OK);
-
-	if (!security_acl_equal(q.query_secdesc.out.sd->dacl, sd->dacl)) {
-		printf("%s: security descriptors don't match!\n", __location__);
-		printf("got:\n");
-		NDR_PRINT_DEBUG(security_descriptor, q.query_secdesc.out.sd);
-		printf("expected:\n");
-		NDR_PRINT_DEBUG(security_descriptor, sd);
-		ret = false;
-	}
-
-	printf("remove it again\n");
+	torture_comment(tctx, "remove it again\n");
 
 	status = security_descriptor_dacl_del(sd, test_sid);
 	CHECK_STATUS(status, NT_STATUS_OK);
 
 	status = smb_raw_setfileinfo(cli->tree, &set);
 	CHECK_STATUS(status, NT_STATUS_OK);
-
-	status = smb_raw_fileinfo(cli->tree, tctx, &q);
-	CHECK_STATUS(status, NT_STATUS_OK);
-
-	if (!security_acl_equal(q.query_secdesc.out.sd->dacl, sd->dacl)) {
-		printf("%s: security descriptors don't match!\n", __location__);
-		printf("got:\n");
-		NDR_PRINT_DEBUG(security_descriptor, q.query_secdesc.out.sd);
-		printf("expected:\n");
-		NDR_PRINT_DEBUG(security_descriptor, sd);
-		ret = false;
-	}
+	FAIL_UNLESS(verify_sd(tctx, cli, fnum, sd));
 
 done:
 	smbcli_close(cli->tree, fnum);
+	smb_raw_exit(cli->session);
+	smbcli_deltree(cli->tree, BASEDIR);
+
 	return ret;
 }
 
 
 /*
   test using nttrans create to create a file with an initial acl set
+  Test copied to test_create_acl() for SMB2.
 */
-static bool test_nttrans_create(struct torture_context *tctx, 
-								struct smbcli_state *cli)
+static bool test_nttrans_create_ext(struct torture_context *tctx,
+				    struct smbcli_state *cli, bool test_dir)
 {
 	NTSTATUS status;
 	union smb_open io;
 	const char *fname = BASEDIR "\\acl2.txt";
 	bool ret = true;
 	int fnum = -1;
-	union smb_fileinfo q;
+	union smb_fileinfo q = {};
 	struct security_ace ace;
 	struct security_descriptor *sd;
 	struct dom_sid *test_sid;
-
-	printf("testing nttrans create with sec_desc\n");
+	uint32_t attrib =
+	    FILE_ATTRIBUTE_HIDDEN |
+	    FILE_ATTRIBUTE_SYSTEM |
+	    (test_dir ? FILE_ATTRIBUTE_DIRECTORY : 0);
+	NTSTATUS (*delete_func)(struct smbcli_tree *, const char *) =
+	    test_dir ? smbcli_rmdir : smbcli_unlink;
+
+	if (!torture_setup_dir(cli, BASEDIR))
+		return false;
 
 	io.generic.level = RAW_OPEN_NTTRANS_CREATE;
 	io.ntcreatex.in.root_fid.fnum = 0;
 	io.ntcreatex.in.flags = 0;
 	io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
-	io.ntcreatex.in.create_options = 0;
+	io.ntcreatex.in.create_options =
+	    test_dir ? NTCREATEX_OPTIONS_DIRECTORY : 0;
 	io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
 	io.ntcreatex.in.share_access = 
 		NTCREATEX_SHARE_ACCESS_READ | 
@@ -177,13 +257,13 @@ static bool test_nttrans_create(struct torture_context *tctx,
 	io.ntcreatex.in.sec_desc = NULL;
 	io.ntcreatex.in.ea_list = NULL;
 
-	printf("creating normal file\n");
+	torture_comment(tctx, "basic create\n");
 
 	status = smb_raw_open(cli->tree, tctx, &io);
 	CHECK_STATUS(status, NT_STATUS_OK);
 	fnum = io.ntcreatex.out.file.fnum;
 
-	printf("querying ACL\n");
+	torture_comment(tctx, "querying ACL\n");
 
 	q.query_secdesc.level = RAW_FILEINFO_SEC_DESC;
 	q.query_secdesc.in.file.fnum = fnum;
@@ -195,11 +275,14 @@ static bool test_nttrans_create(struct torture_context *tctx,
 	CHECK_STATUS(status, NT_STATUS_OK);
 	sd = q.query_secdesc.out.sd;
 
-	smbcli_close(cli->tree, fnum);
-	smbcli_unlink(cli->tree, fname);
+	status = smbcli_close(cli->tree, fnum);
+	CHECK_STATUS(status, NT_STATUS_OK);
+
+	status = delete_func(cli->tree, fname);
+	CHECK_STATUS(status, NT_STATUS_OK);
 
-	printf("adding a new ACE\n");
-	test_sid = dom_sid_parse_talloc(tctx, "S-1-5-32-1234-54321");
+	torture_comment(tctx, "adding a new ACE\n");
+	test_sid = dom_sid_parse_talloc(tctx, SID_NT_AUTHENTICATED_USERS);
 
 	ace.type = SEC_ACE_TYPE_ACCESS_ALLOWED;
 	ace.flags = 0;
@@ -209,31 +292,99 @@ static bool test_nttrans_create(struct torture_context *tctx,
 	status = security_descriptor_dacl_add(sd, &ace);
 	CHECK_STATUS(status, NT_STATUS_OK);
 	
-	printf("creating a file with an initial ACL\n");
+	torture_comment(tctx, "creating with an initial ACL\n");
 
 	io.ntcreatex.in.sec_desc = sd;
 	status = smb_raw_open(cli->tree, tctx, &io);
 	CHECK_STATUS(status, NT_STATUS_OK);
 	fnum = io.ntcreatex.out.file.fnum;
 	
-	q.query_secdesc.in.file.fnum = fnum;
-	status = smb_raw_fileinfo(cli->tree, tctx, &q);
+	FAIL_UNLESS(verify_sd(tctx, cli, fnum, sd));
+
+	status = smbcli_close(cli->tree, fnum);
+	CHECK_STATUS(status, NT_STATUS_OK);
+	status = delete_func(cli->tree, fname);
 	CHECK_STATUS(status, NT_STATUS_OK);
 
-	if (!security_acl_equal(q.query_secdesc.out.sd->dacl, sd->dacl)) {
-		printf("%s: security descriptors don't match!\n", __location__);
-		printf("got:\n");
-		NDR_PRINT_DEBUG(security_descriptor, q.query_secdesc.out.sd);
-		printf("expected:\n");
-		NDR_PRINT_DEBUG(security_descriptor, sd);
-		ret = false;
-	}
+	torture_comment(tctx, "creating with attributes\n");
 
-done:
+	io.ntcreatex.in.sec_desc = NULL;
+	io.ntcreatex.in.file_attr = attrib;
+	status = smb_raw_open(cli->tree, tctx, &io);
+	CHECK_STATUS(status, NT_STATUS_OK);
+	fnum = io.ntcreatex.out.file.fnum;
+
+	FAIL_UNLESS(verify_attrib(tctx, cli, fnum, attrib));
+
+	status = smbcli_close(cli->tree, fnum);
+	CHECK_STATUS(status, NT_STATUS_OK);
+
+	status = delete_func(cli->tree, fname);
+	CHECK_STATUS(status, NT_STATUS_OK);
+
+	torture_comment(tctx, "creating with attributes and ACL\n");
+
+	io.ntcreatex.in.sec_desc = sd;
+	io.ntcreatex.in.file_attr = attrib;
+	status = smb_raw_open(cli->tree, tctx, &io);
+	CHECK_STATUS(status, NT_STATUS_OK);
+	fnum = io.ntcreatex.out.file.fnum;
+
+	FAIL_UNLESS(verify_sd(tctx, cli, fnum, sd));
+	FAIL_UNLESS(verify_attrib(tctx, cli, fnum, attrib));
+
+	status = smbcli_close(cli->tree, fnum);
+	CHECK_STATUS(status, NT_STATUS_OK);
+	status = delete_func(cli->tree, fname);
+	CHECK_STATUS(status, NT_STATUS_OK);
+
+	torture_comment(tctx, "creating with attributes, ACL and owner\n");
+
+	sd = security_descriptor_dacl_create(tctx,
+					0, SID_WORLD, SID_BUILTIN_USERS,
+					SID_WORLD,
+					SEC_ACE_TYPE_ACCESS_ALLOWED,
+					SEC_RIGHTS_FILE_READ | SEC_STD_ALL,
+					0,
+					NULL);
+
+	io.ntcreatex.in.sec_desc = sd;
+	io.ntcreatex.in.file_attr = attrib;
+	status = smb_raw_open(cli->tree, tctx, &io);
+	CHECK_STATUS(status, NT_STATUS_OK);
+	fnum = io.ntcreatex.out.file.fnum;
+
+	FAIL_UNLESS(verify_sd(tctx, cli, fnum, sd));
+	FAIL_UNLESS(verify_attrib(tctx, cli, fnum, attrib));
+
+	status = smbcli_close(cli->tree, fnum);
+	CHECK_STATUS(status, NT_STATUS_OK);
+	status = delete_func(cli->tree, fname);
+	CHECK_STATUS(status, NT_STATUS_OK);
+
+ done:
 	smbcli_close(cli->tree, fnum);
+	smb_raw_exit(cli->session);
+	smbcli_deltree(cli->tree, BASEDIR);
 	return ret;
 }
 
+static bool test_nttrans_create_file(struct torture_context *tctx,
+    struct smbcli_state *cli)
+{
+	torture_comment(tctx, "testing nttrans create with sec_desc on files\n");
+
+	return test_nttrans_create_ext(tctx, cli, false);
+}
+
+static bool test_nttrans_create_dir(struct torture_context *tctx,
+    struct smbcli_state *cli)
+{
+	torture_comment(tctx, "testing nttrans create with sec_desc on directories\n");
+
+	return test_nttrans_create_ext(tctx, cli, true);
+}
+
 #define CHECK_ACCESS_FLAGS(_fnum, flags) do { \
 	union smb_fileinfo _q; \
 	_q.access_information.level = RAW_FILEINFO_ACCESS_INFORMATION; \
@@ -241,22 +392,23 @@ done:
 	status = smb_raw_fileinfo(cli->tree, tctx, &_q); \
 	CHECK_STATUS(status, NT_STATUS_OK); \
 	if (_q.access_information.out.access_flags != (flags)) { \
-		printf("(%s) Incorrect access_flags 0x%08x - should be 0x%08x\n", \
-		       __location__, _q.access_information.out.access_flags, (flags)); \
 		ret = false; \
+		torture_result(tctx, TORTURE_FAIL, "(%s) Incorrect access_flags 0x%08x - should be 0x%08x\n", \
+		       __location__, _q.access_information.out.access_flags, (flags)); \
 		goto done; \
 	} \
 } while (0)
 
 /*
   test using NTTRANS CREATE to create a file with a null ACL set
+  Test copied to test_create_null_dacl() for SMB2.
 */
 static bool test_nttrans_create_null_dacl(struct torture_context *tctx,
 					  struct smbcli_state *cli)
 {
 	NTSTATUS status;
 	union smb_open io;
-	const char *fname = BASEDIR "\\acl3.txt";
+	const char *fname = BASEDIR "\\nulldacl.txt";
 	bool ret = true;
 	int fnum = -1;
 	union smb_fileinfo q;
@@ -264,7 +416,10 @@ static bool test_nttrans_create_null_dacl(struct torture_context *tctx,
 	struct security_descriptor *sd = security_descriptor_initialise(tctx);
 	struct security_acl dacl;
 
-	printf("TESTING SEC_DESC WITH A NULL DACL\n");
+	if (!torture_setup_dir(cli, BASEDIR))
+		return false;
+
+	torture_comment(tctx, "TESTING SEC_DESC WITH A NULL DACL\n");
 
 	io.generic.level = RAW_OPEN_NTTRANS_CREATE;
 	io.ntcreatex.in.root_fid.fnum = 0;
@@ -283,12 +438,12 @@ static bool test_nttrans_create_null_dacl(struct torture_context *tctx,
 	io.ntcreatex.in.sec_desc = sd;
 	io.ntcreatex.in.ea_list = NULL;
 
-	printf("creating a file with a empty sd\n");
+	torture_comment(tctx, "creating a file with a empty sd\n");
 	status = smb_raw_open(cli->tree, tctx, &io);
 	CHECK_STATUS(status, NT_STATUS_OK);
 	fnum = io.ntcreatex.out.file.fnum;
 
-	printf("get the original sd\n");
+	torture_comment(tctx, "get the original sd\n");
 	q.query_secdesc.level = RAW_FILEINFO_SEC_DESC;
 	q.query_secdesc.in.file.fnum = fnum;
 	q.query_secdesc.in.secinfo_flags =
@@ -304,17 +459,17 @@ static bool test_nttrans_create_null_dacl(struct torture_context *tctx,
 	 * when SEC_DESC_DACL_PRESENT isn't specified
 	 */
 	if (!(q.query_secdesc.out.sd->type & SEC_DESC_DACL_PRESENT)) {
-		printf("DACL_PRESENT flag not set by the server!\n");
 		ret = false;
+		torture_result(tctx, TORTURE_FAIL, "DACL_PRESENT flag not set by the server!\n");
 		goto done;
 	}
 	if (q.query_secdesc.out.sd->dacl == NULL) {
-		printf("no DACL has been created on the server!\n");
 		ret = false;
+		torture_result(tctx, TORTURE_FAIL, "no DACL has been created on the server!\n");
 		goto done;
 	}
 
-	printf("set NULL DACL\n");
+	torture_comment(tctx, "set NULL DACL\n");
 	sd->type |= SEC_DESC_DACL_PRESENT;
 
 	s.set_secdesc.level = RAW_SFILEINFO_SEC_DESC;
@@ -324,7 +479,7 @@ static bool test_nttrans_create_null_dacl(struct torture_context *tctx,
 	status = smb_raw_setfileinfo(cli->tree, &s);
 	CHECK_STATUS(status, NT_STATUS_OK);
 
-	printf("get the sd\n");
+	torture_comment(tctx, "get the sd\n");
 	q.query_secdesc.level = RAW_FILEINFO_SEC_DESC;
 	q.query_secdesc.in.file.fnum = fnum;
 	q.query_secdesc.in.secinfo_flags =
@@ -336,17 +491,17 @@ static bool test_nttrans_create_null_dacl(struct torture_context *tctx,


-- 
Samba Shared Repository


More information about the samba-cvs mailing list