[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Wed Mar 24 11:31:51 MDT 2010


The branch, master has been updated
       via  bb47e5b... s4-smbtorture: add drsblobs ndr torture test.
       via  fb70368... s4-smbtorture: move up torture_assert_sid_equal at least to the torture/ndr level.
      from  254d85d... s4-selftest: use correct test names.

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


- Log -----------------------------------------------------------------
commit bb47e5b6172ae28f996b132e8b612c752c873adb
Author: Günther Deschner <gd at samba.org>
Date:   Wed Mar 24 18:08:21 2010 +0100

    s4-smbtorture: add drsblobs ndr torture test.
    
    Guenther

commit fb70368a975e6c78c6ce557fc6011569dbdc6d75
Author: Günther Deschner <gd at samba.org>
Date:   Wed Mar 24 18:29:52 2010 +0100

    s4-smbtorture: move up torture_assert_sid_equal at least to the torture/ndr level.
    
    Guenther

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

Summary of changes:
 source4/torture/config.mk      |    2 +-
 source4/torture/ndr/drsblobs.c |   66 ++++++++++++++++++++++++++++++++++++++++
 source4/torture/ndr/lsa.c      |   11 -------
 source4/torture/ndr/ndr.c      |    1 +
 source4/torture/ndr/ndr.h      |   11 +++++++
 5 files changed, 79 insertions(+), 12 deletions(-)
 create mode 100644 source4/torture/ndr/drsblobs.c


Changeset truncated at 500 lines:

diff --git a/source4/torture/config.mk b/source4/torture/config.mk
index 34df547..56bfa9c 100644
--- a/source4/torture/config.mk
+++ b/source4/torture/config.mk
@@ -95,7 +95,7 @@ mkinclude libsmbclient/config.mk
 [SUBSYSTEM::TORTURE_NDR]
 PRIVATE_DEPENDENCIES = torture SERVICE_SMB
 
-TORTURE_NDR_OBJ_FILES = $(addprefix $(torturesrcdir)/ndr/, ndr.o winreg.o atsvc.o lsa.o epmap.o dfs.o netlogon.o drsuapi.o spoolss.o samr.o dfsblob.o)
+TORTURE_NDR_OBJ_FILES = $(addprefix $(torturesrcdir)/ndr/, ndr.o winreg.o atsvc.o lsa.o epmap.o dfs.o netlogon.o drsuapi.o spoolss.o samr.o dfsblob.o drsblobs.o)
 
 $(eval $(call proto_header_template,$(torturesrcdir)/ndr/proto.h,$(TORTURE_NDR_OBJ_FILES:.o=.c)))
 
diff --git a/source4/torture/ndr/drsblobs.c b/source4/torture/ndr/drsblobs.c
new file mode 100644
index 0000000..2b3e0a8
--- /dev/null
+++ b/source4/torture/ndr/drsblobs.c
@@ -0,0 +1,66 @@
+/*
+   Unix SMB/CIFS implementation.
+   test suite for drsblobs ndr operations
+
+   Copyright (C) Guenther Deschner 2010
+
+   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 "torture/ndr/ndr.h"
+#include "librpc/gen_ndr/ndr_drsblobs.h"
+
+static const uint8_t forest_trust_info_data_out[] = {
+	0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x3e, 0xca, 0xca, 0x01, 0x00, 0xaf, 0xd5, 0x9b,
+	0x00, 0x07, 0x00, 0x00, 0x00, 0x66, 0x32, 0x2e, 0x74, 0x65, 0x73, 0x74,
+	0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0xca, 0xca, 0x01,
+	0x00, 0xaf, 0xd5, 0x9b, 0x02, 0x18, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x05, 0x15, 0x00, 0x00, 0x00, 0x68, 0x4a, 0x64,
+	0x28, 0xac, 0x88, 0xa2, 0x74, 0x17, 0x3e, 0x2d, 0x8f, 0x07, 0x00, 0x00,
+	0x00, 0x66, 0x32, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x02, 0x00, 0x00, 0x00,
+	0x46, 0x32
+};
+
+static bool forest_trust_info_check_out(struct torture_context *tctx,
+					struct ForestTrustInfo *r)
+{
+	torture_assert_int_equal(tctx, r->version, 1, "version");
+	torture_assert_int_equal(tctx, r->count, 2, "count");
+	torture_assert_int_equal(tctx, r->records[0].record_size, 0x00000018, "record size");
+	torture_assert_int_equal(tctx, r->records[0].record.flags, 0, "record flags");
+	torture_assert_u64_equal(tctx, r->records[0].record.timestamp, 0x9BD5AF0001CACA3E, "record timestamp");
+	torture_assert_int_equal(tctx, r->records[0].record.type, FOREST_TRUST_TOP_LEVEL_NAME, "record type");
+	torture_assert_str_equal(tctx, r->records[0].record.data.name, "f2.test", "record name");
+	torture_assert_int_equal(tctx, r->records[1].record_size, 0x0000003a, "record size");
+	torture_assert_int_equal(tctx, r->records[1].record.flags, 0, "record flags");
+	torture_assert_u64_equal(tctx, r->records[1].record.timestamp, 0x9BD5AF0001CACA3E, "record timestamp");
+	torture_assert_int_equal(tctx, r->records[1].record.type, FOREST_TRUST_DOMAIN_INFO, "record type");
+	torture_assert_int_equal(tctx, r->records[1].record.data.info.sid_size, 0x00000018, "record info sid_size");
+	torture_assert_sid_equal(tctx, &r->records[1].record.data.info.sid, dom_sid_parse_talloc(tctx, "S-1-5-21-677661288-1956808876-2402106903"), "record info sid");
+	torture_assert_str_equal(tctx, r->records[1].record.data.info.dns_name, "f2.test", "record info dns_name");
+	torture_assert_str_equal(tctx, r->records[1].record.data.info.netbios_name, "F2", "record info netbios_name");
+
+	return true;
+}
+
+struct torture_suite *ndr_drsblobs_suite(TALLOC_CTX *ctx)
+{
+	struct torture_suite *suite = torture_suite_create(ctx, "drsblobs");
+
+	torture_suite_add_ndr_pull_fn_test(suite, ForestTrustInfo, forest_trust_info_data_out, NDR_IN, forest_trust_info_check_out);
+
+	return suite;
+}
diff --git a/source4/torture/ndr/lsa.c b/source4/torture/ndr/lsa.c
index e9e01d3..6e53fdf 100644
--- a/source4/torture/ndr/lsa.c
+++ b/source4/torture/ndr/lsa.c
@@ -21,17 +21,6 @@
 #include "includes.h"
 #include "torture/ndr/ndr.h"
 #include "librpc/gen_ndr/ndr_lsa.h"
-#include "libcli/security/security.h"
-
-#define torture_assert_sid_equal(torture_ctx,got,expected,cmt)\
-	do { struct dom_sid *__got = (got), *__expected = (expected); \
-	if (!dom_sid_equal(__got, __expected)) { \
-		torture_result(torture_ctx, TORTURE_FAIL, \
-					   __location__": "#got" was %s, expected %s: %s", \
-					   dom_sid_string(torture_ctx, __got), dom_sid_string(torture_ctx, __expected), cmt); \
-		return false; \
-	} \
-	} while(0)
 
 static const uint8_t lsarlookupnames_in_data[] = {
   0x00, 0x00, 0x00, 0x00, 0x2a, 0xab, 0xb8, 0x84, 0x36, 0xc6, 0xed, 0x4f,
diff --git a/source4/torture/ndr/ndr.c b/source4/torture/ndr/ndr.c
index 471c398..24f5fba 100644
--- a/source4/torture/ndr/ndr.c
+++ b/source4/torture/ndr/ndr.c
@@ -266,6 +266,7 @@ struct torture_suite *torture_local_ndr(TALLOC_CTX *mem_ctx)
 	torture_suite_add_suite(suite, ndr_drsuapi_suite(suite));
 	torture_suite_add_suite(suite, ndr_spoolss_suite(suite));
 	torture_suite_add_suite(suite, ndr_samr_suite(suite));
+	torture_suite_add_suite(suite, ndr_drsblobs_suite(suite));
 
 	torture_suite_add_simple_test(suite, "string terminator", 
 								   test_check_string_terminator);
diff --git a/source4/torture/ndr/ndr.h b/source4/torture/ndr/ndr.h
index aca6e58..517bcb6 100644
--- a/source4/torture/ndr/ndr.h
+++ b/source4/torture/ndr/ndr.h
@@ -22,6 +22,7 @@
 
 #include "torture/torture.h"
 #include "librpc/ndr/libndr.h"
+#include "libcli/security/security.h"
 
 _PUBLIC_ struct torture_test *_torture_suite_add_ndr_pull_test(
 					struct torture_suite *suite, 
@@ -41,4 +42,14 @@ _PUBLIC_ struct torture_test *_torture_suite_add_ndr_pull_test(
 			 (ndr_pull_flags_fn_t)ndr_pull_ ## name, data_blob_talloc(suite, data, sizeof(data)), \
 			 sizeof(struct name), flags, (bool (*) (struct torture_context *, void *)) check_fn);
 
+#define torture_assert_sid_equal(torture_ctx,got,expected,cmt)\
+	do { struct dom_sid *__got = (got), *__expected = (expected); \
+	if (!dom_sid_equal(__got, __expected)) { \
+		torture_result(torture_ctx, TORTURE_FAIL, \
+					   __location__": "#got" was %s, expected %s: %s", \
+					   dom_sid_string(torture_ctx, __got), dom_sid_string(torture_ctx, __expected), cmt); \
+		return false; \
+	} \
+	} while(0)
+
 #endif /* __TORTURE_NDR_H__ */


-- 
Samba Shared Repository


More information about the samba-cvs mailing list