[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-1542-gf5cab89

Günther Deschner gd at samba.org
Mon May 11 14:45:20 GMT 2009


The branch, master has been updated
       via  f5cab8913b77c37dc24188b9093b80a0b4d42749 (commit)
       via  5f015920a80a22f5486e0679f017db3a5ff9d798 (commit)
       via  7347373e7cb814d683c603ed958583ff70552a2b (commit)
      from  d51bb8e4e6556db64907bfdd4f42a04e2dfddea8 (commit)

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


- Log -----------------------------------------------------------------
commit f5cab8913b77c37dc24188b9093b80a0b4d42749
Author: Günther Deschner <gd at samba.org>
Date:   Mon May 11 16:29:39 2009 +0200

    s3-selftest: enable RPC-LSA-LOOKUPNAMES against Samba 3.
    
    Guenther

commit 5f015920a80a22f5486e0679f017db3a5ff9d798
Author: Günther Deschner <gd at samba.org>
Date:   Mon May 11 16:28:42 2009 +0200

    s4-smbtorture: add very basic RPC-LSA-LOOKUPNAMES test.
    
    Guenther

commit 7347373e7cb814d683c603ed958583ff70552a2b
Author: Günther Deschner <gd at samba.org>
Date:   Mon May 11 16:40:26 2009 +0200

    s4-smbtorture: add optional very simple reply checks to lsa lookup name tests.
    
    Guenther

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

Summary of changes:
 source3/script/tests/test_posix_s3.sh |    2 +-
 source4/torture/rpc/lsa.c             |  107 ++++++++++++++++++++++++++++++--
 source4/torture/rpc/rpc.c             |    1 +
 3 files changed, 102 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/script/tests/test_posix_s3.sh b/source3/script/tests/test_posix_s3.sh
index 0829b2c..7b8c253 100755
--- a/source3/script/tests/test_posix_s3.sh
+++ b/source3/script/tests/test_posix_s3.sh
@@ -41,7 +41,7 @@ rpc="RPC-AUTHCONTEXT RPC-BINDSAMBA3 RPC-SAMBA3-SRVSVC RPC-SAMBA3-SHARESEC"
 rpc="$rpc RPC-SAMBA3-SPOOLSS RPC-SAMBA3-WKSSVC"
 rpc="$rpc RPC-NETLOGSAMBA3 RPC-SAMBA3SESSIONKEY RPC-SAMBA3-GETUSERNAME"
 rpc="$rpc RPC-SVCCTL RPC-SPOOLSS RPC-SPOOLSS-WIN RPC-NTSVCS"
-rpc="$rpc RPC-LSA-GETUSER RPC-LSA-LOOKUPSIDS"
+rpc="$rpc RPC-LSA-GETUSER RPC-LSA-LOOKUPSIDS RPC-LSA-LOOKUPNAMES"
 rpc="$rpc RPC-SAMR-USERS RPC-SAMR-PASSWORDS RPC-SAMR-PASSWORDS-PWDLASTSET RPC-JOIN"
 rpc="$rpc RPC-SCHANNEL RPC-SCHANNEL2 RPC-BENCH-SCHANNEL1"
 
diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c
index e10bc77..7d03e7e 100644
--- a/source4/torture/rpc/lsa.c
+++ b/source4/torture/rpc/lsa.c
@@ -319,7 +319,8 @@ static bool test_LookupNames_wellknown(struct dcerpc_pipe *p,
 static bool test_LookupNames2(struct dcerpc_pipe *p,
 			      struct torture_context *tctx,
 			      struct policy_handle *handle,
-			      struct lsa_TransNameArray2 *tnames)
+			      struct lsa_TransNameArray2 *tnames,
+			      bool check_result)
 {
 	struct lsa_LookupNames2 r;
 	struct lsa_TransSidArray2 sids;
@@ -357,6 +358,14 @@ static bool test_LookupNames2(struct dcerpc_pipe *p,
 		return false;
 	}
 
+	if (check_result) {
+		torture_assert_int_equal(tctx, count, sids.count,
+			"unexpected number of results returned");
+		if (sids.count > 0) {
+			torture_assert(tctx, sids.sids, "invalid sid buffer");
+		}
+	}
+
 	printf("\n");
 
 	return true;
@@ -366,7 +375,8 @@ static bool test_LookupNames2(struct dcerpc_pipe *p,
 static bool test_LookupNames3(struct dcerpc_pipe *p,
 			      struct torture_context *tctx,
 			      struct policy_handle *handle,
-			      struct lsa_TransNameArray2 *tnames)
+			      struct lsa_TransNameArray2 *tnames,
+			      bool check_result)
 {
 	struct lsa_LookupNames3 r;
 	struct lsa_TransSidArray3 sids;
@@ -404,6 +414,14 @@ static bool test_LookupNames3(struct dcerpc_pipe *p,
 		return false;
 	}
 
+	if (check_result) {
+		torture_assert_int_equal(tctx, count, sids.count,
+			"unexpected number of results returned");
+		if (sids.count > 0) {
+			torture_assert(tctx, sids.sids, "invalid sid buffer");
+		}
+	}
+
 	printf("\n");
 
 	return true;
@@ -411,7 +429,8 @@ static bool test_LookupNames3(struct dcerpc_pipe *p,
 
 static bool test_LookupNames4(struct dcerpc_pipe *p,
 			      struct torture_context *tctx,
-			      struct lsa_TransNameArray2 *tnames)
+			      struct lsa_TransNameArray2 *tnames,
+			      bool check_result)
 {
 	struct lsa_LookupNames4 r;
 	struct lsa_TransSidArray3 sids;
@@ -448,6 +467,14 @@ static bool test_LookupNames4(struct dcerpc_pipe *p,
 		return false;
 	}
 
+	if (check_result) {
+		torture_assert_int_equal(tctx, count, sids.count,
+			"unexpected number of results returned");
+		if (sids.count > 0) {
+			torture_assert(tctx, sids.sids, "invalid sid buffer");
+		}
+	}
+
 	printf("\n");
 
 	return true;
@@ -530,11 +557,11 @@ static bool test_LookupSids2(struct dcerpc_pipe *p,
 
 	printf("\n");
 
-	if (!test_LookupNames2(p, tctx, handle, &names)) {
+	if (!test_LookupNames2(p, tctx, handle, &names, false)) {
 		return false;
 	}
 
-	if (!test_LookupNames3(p, tctx, handle, &names)) {
+	if (!test_LookupNames3(p, tctx, handle, &names, false)) {
 		return false;
 	}
 
@@ -580,7 +607,7 @@ static bool test_LookupSids3(struct dcerpc_pipe *p,
 
 	printf("\n");
 
-	if (!test_LookupNames4(p, tctx, &names)) {
+	if (!test_LookupNames4(p, tctx, &names, false)) {
 		return false;
 	}
 
@@ -668,7 +695,7 @@ bool test_many_LookupSids(struct dcerpc_pipe *p,
 			       nt_errstr(status));
 			return false;
 		}
-		if (!test_LookupNames4(p, tctx, &names)) {
+		if (!test_LookupNames4(p, tctx, &names, false)) {
 			return false;
 		}
 	}
@@ -2673,3 +2700,69 @@ bool torture_rpc_lsa_get_user(struct torture_context *tctx)
 
 	return ret;
 }
+
+static bool testcase_LookupNames(struct torture_context *tctx,
+				 struct dcerpc_pipe *p)
+{
+	bool ret = true;
+	struct policy_handle *handle;
+	struct lsa_TransNameArray tnames;
+	struct lsa_TransNameArray2 tnames2;
+
+	if (!test_OpenPolicy(p, tctx)) {
+		ret = false;
+	}
+
+	if (!test_lsa_OpenPolicy2(p, tctx, &handle)) {
+		ret = false;
+	}
+
+	if (!handle) {
+		ret = false;
+	}
+
+	tnames.count = 1;
+	tnames.names = talloc_array(tctx, struct lsa_TranslatedName, tnames.count);
+	ZERO_STRUCT(tnames.names[0]);
+	tnames.names[0].name.string = "BUILTIN";
+	tnames.names[0].sid_type = SID_NAME_DOMAIN;
+
+	if (!test_LookupNames(p, tctx, handle, &tnames)) {
+		ret = false;
+	}
+
+	tnames2.count = 1;
+	tnames2.names = talloc_array(tctx, struct lsa_TranslatedName2, tnames2.count);
+	ZERO_STRUCT(tnames2.names[0]);
+	tnames2.names[0].name.string = "BUILTIN";
+	tnames2.names[0].sid_type = SID_NAME_DOMAIN;
+
+	if (!test_LookupNames2(p, tctx, handle, &tnames2, true)) {
+		ret = false;
+	}
+
+	if (!test_LookupNames3(p, tctx, handle, &tnames2, true)) {
+		ret = false;
+	}
+
+	if (!test_lsa_Close(p, tctx, handle)) {
+		ret = false;
+	}
+
+	return ret;
+}
+
+struct torture_suite *torture_rpc_lsa_lookup_names(TALLOC_CTX *mem_ctx)
+{
+	struct torture_suite *suite;
+	struct torture_rpc_tcase *tcase;
+
+	suite = torture_suite_create(mem_ctx, "LSA-LOOKUPNAMES");
+
+	tcase = torture_suite_add_rpc_iface_tcase(suite, "lsa",
+						  &ndr_table_lsarpc);
+	torture_rpc_tcase_add_test(tcase, "LookupNames",
+				   testcase_LookupNames);
+
+	return suite;
+}
diff --git a/source4/torture/rpc/rpc.c b/source4/torture/rpc/rpc.c
index 5624c32..647d514 100644
--- a/source4/torture/rpc/rpc.c
+++ b/source4/torture/rpc/rpc.c
@@ -379,6 +379,7 @@ NTSTATUS torture_rpc_init(void)
 	torture_suite_add_simple_test(suite, "LSALOOKUP", torture_rpc_lsa_lookup);
 	torture_suite_add_simple_test(suite, "LSA-GETUSER", torture_rpc_lsa_get_user);
 	torture_suite_add_suite(suite, torture_rpc_lsa_lookup_sids(suite));
+	torture_suite_add_suite(suite, torture_rpc_lsa_lookup_names(suite));
 	torture_suite_add_suite(suite, torture_rpc_lsa_secrets(suite));
 	torture_suite_add_suite(suite, torture_rpc_echo(suite));
 	torture_suite_add_simple_test(suite, "DFS", torture_rpc_dfs);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list