summaryrefslogtreecommitdiff
path: root/source4/torture/rpc
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-08-28 12:54:27 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:03:00 -0500
commit919aa6b27e5fe49b70c814210aa026c19be66e8a (patch)
tree4f1cff79459133a014a32e3f42fa787c7d83de67 /source4/torture/rpc
parentb42691ee167415c7dc89d50b4ba18909bacd40c1 (diff)
downloadsamba-919aa6b27e5fe49b70c814210aa026c19be66e8a.tar.gz
samba-919aa6b27e5fe49b70c814210aa026c19be66e8a.tar.bz2
samba-919aa6b27e5fe49b70c814210aa026c19be66e8a.zip
r24735: Use torture API in more places.
(This used to be commit 1319d88c099496be29dd9214fa2492c81e848369)
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r--source4/torture/rpc/alter_context.c2
-rw-r--r--source4/torture/rpc/bench.c2
-rw-r--r--source4/torture/rpc/bind.c2
-rw-r--r--source4/torture/rpc/dcom.c44
-rw-r--r--source4/torture/rpc/drsuapi.c4
-rw-r--r--source4/torture/rpc/dssetup.c2
-rw-r--r--source4/torture/rpc/epmapper.c2
-rw-r--r--source4/torture/rpc/handles.c40
-rw-r--r--source4/torture/rpc/initshutdown.c2
-rw-r--r--source4/torture/rpc/lsa.c8
-rw-r--r--source4/torture/rpc/lsa_lookup.c2
-rw-r--r--source4/torture/rpc/mgmt.c12
-rw-r--r--source4/torture/rpc/netlogon.c2
-rw-r--r--source4/torture/rpc/oxidresolve.c4
-rw-r--r--source4/torture/rpc/remact.c2
-rw-r--r--source4/torture/rpc/rot.c2
-rw-r--r--source4/torture/rpc/rpc.c18
-rw-r--r--source4/torture/rpc/samba3rpc.c2
-rw-r--r--source4/torture/rpc/samlogon.c8
-rw-r--r--source4/torture/rpc/samsync.c8
-rw-r--r--source4/torture/rpc/scanner.c9
-rw-r--r--source4/torture/rpc/session_key.c2
-rw-r--r--source4/torture/rpc/spoolss.c8
-rw-r--r--source4/torture/rpc/srvsvc.c4
-rw-r--r--source4/torture/rpc/svcctl.c142
-rw-r--r--source4/torture/rpc/testjoin.c5
26 files changed, 144 insertions, 194 deletions
diff --git a/source4/torture/rpc/alter_context.c b/source4/torture/rpc/alter_context.c
index 140d52c746..d55a0eedc9 100644
--- a/source4/torture/rpc/alter_context.c
+++ b/source4/torture/rpc/alter_context.c
@@ -40,7 +40,7 @@ BOOL torture_rpc_alter_context(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_alter_context");
printf("opening LSA connection\n");
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_lsarpc);
+ status = torture_rpc_connection(torture, &p, &ndr_table_lsarpc);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
diff --git a/source4/torture/rpc/bench.c b/source4/torture/rpc/bench.c
index 6e3ee1c421..48fd0609f0 100644
--- a/source4/torture/rpc/bench.c
+++ b/source4/torture/rpc/bench.c
@@ -103,7 +103,7 @@ BOOL torture_bench_rpc(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_srvsvc");
- status = torture_rpc_connection(mem_ctx,
+ status = torture_rpc_connection(torture,
&p,
&ndr_table_srvsvc);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source4/torture/rpc/bind.c b/source4/torture/rpc/bind.c
index 71d3489ca4..33885573e6 100644
--- a/source4/torture/rpc/bind.c
+++ b/source4/torture/rpc/bind.c
@@ -59,7 +59,7 @@ BOOL torture_multi_bind(struct torture_context *torture)
return False;
}
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_lsarpc);
+ status = torture_rpc_connection(torture, &p, &ndr_table_lsarpc);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
diff --git a/source4/torture/rpc/dcom.c b/source4/torture/rpc/dcom.c
deleted file mode 100644
index 38092a8d37..0000000000
--- a/source4/torture/rpc/dcom.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- test suite for dcom operations
-
- Copyright (C) Jelmer Vernooij 2004
-
- 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/torture.h"
-#include "torture/rpc/rpc.h"
-#include "librpc/gen_ndr/ndr_oxidresolver.h"
-
-BOOL torture_rpc_dcom(void)
-{
- NTSTATUS status;
- struct dcerpc_pipe *p;
- TALLOC_CTX *mem_ctx;
- BOOL ret = True;
-
- mem_ctx = talloc_init("torture_rpc_dcom");
-
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_IOXIDResolver);
- if (!NT_STATUS_IS_OK(status)) {
- ret = False;
- }
-
- printf("\n");
-
- talloc_free(mem_ctx);
- return ret;
-}
diff --git a/source4/torture/rpc/drsuapi.c b/source4/torture/rpc/drsuapi.c
index 5e4ac3321f..606240993f 100644
--- a/source4/torture/rpc/drsuapi.c
+++ b/source4/torture/rpc/drsuapi.c
@@ -749,7 +749,7 @@ BOOL torture_rpc_drsuapi(struct torture_context *torture)
return False;
}
- status = torture_rpc_connection(mem_ctx,
+ status = torture_rpc_connection(torture,
&p,
&ndr_table_drsuapi);
if (!NT_STATUS_IS_OK(status)) {
@@ -809,7 +809,7 @@ BOOL torture_rpc_drsuapi_cracknames(struct torture_context *torture)
return False;
}
- status = torture_rpc_connection(mem_ctx,
+ status = torture_rpc_connection(torture,
&p,
&ndr_table_drsuapi);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source4/torture/rpc/dssetup.c b/source4/torture/rpc/dssetup.c
index 4d90b242c4..c80e37eb7d 100644
--- a/source4/torture/rpc/dssetup.c
+++ b/source4/torture/rpc/dssetup.c
@@ -65,7 +65,7 @@ BOOL torture_rpc_dssetup(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_dssetup");
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_dssetup);
+ status = torture_rpc_connection(torture, &p, &ndr_table_dssetup);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
diff --git a/source4/torture/rpc/epmapper.c b/source4/torture/rpc/epmapper.c
index b4e5b97679..3f9de22721 100644
--- a/source4/torture/rpc/epmapper.c
+++ b/source4/torture/rpc/epmapper.c
@@ -283,7 +283,7 @@ BOOL torture_rpc_epmapper(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_epmapper");
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_epmapper);
+ status = torture_rpc_connection(torture, &p, &ndr_table_epmapper);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
diff --git a/source4/torture/rpc/handles.c b/source4/torture/rpc/handles.c
index f8cd1cd488..5b6082f7dd 100644
--- a/source4/torture/rpc/handles.c
+++ b/source4/torture/rpc/handles.c
@@ -45,10 +45,10 @@ static bool test_handles_lsa(struct torture_context *torture)
torture_comment(torture, "RPC-HANDLE-LSARPC\n");
- status = torture_rpc_connection(mem_ctx, &p1, &ndr_table_lsarpc);
+ status = torture_rpc_connection(torture, &p1, &ndr_table_lsarpc);
torture_assert_ntstatus_ok(torture, status, "opening lsa pipe1");
- status = torture_rpc_connection(mem_ctx, &p2, &ndr_table_lsarpc);
+ status = torture_rpc_connection(torture, &p2, &ndr_table_lsarpc);
torture_assert_ntstatus_ok(torture, status, "opening lsa pipe1");
qos.len = 0;
@@ -122,7 +122,7 @@ static bool test_handles_lsa_shared(struct torture_context *torture)
}
torture_comment(torture, "connect lsa pipe1\n");
- status = torture_rpc_connection(mem_ctx, &p1, &ndr_table_lsarpc);
+ status = torture_rpc_connection(torture, &p1, &ndr_table_lsarpc);
torture_assert_ntstatus_ok(torture, status, "opening lsa pipe1");
transport = p1->conn->transport.transport,
@@ -131,7 +131,7 @@ static bool test_handles_lsa_shared(struct torture_context *torture)
torture_comment(torture, "use assoc_group_id[0x%08X] for new connections\n", assoc_group_id);
torture_comment(torture, "connect lsa pipe2\n");
- status = torture_rpc_connection_transport(mem_ctx, &p2, &ndr_table_lsarpc,
+ status = torture_rpc_connection_transport(torture, &p2, &ndr_table_lsarpc,
transport,
assoc_group_id);
torture_assert_ntstatus_ok(torture, status, "opening lsa pipe2");
@@ -165,7 +165,7 @@ static bool test_handles_lsa_shared(struct torture_context *torture)
* connect p3 after the policy handle is opened
*/
torture_comment(torture, "connect lsa pipe3 after the policy handle is opened\n");
- status = torture_rpc_connection_transport(mem_ctx, &p3, &ndr_table_lsarpc,
+ status = torture_rpc_connection_transport(torture, &p3, &ndr_table_lsarpc,
transport,
assoc_group_id);
torture_assert_ntstatus_ok(torture, status, "opening lsa pipe3");
@@ -301,7 +301,7 @@ static bool test_handles_lsa_shared(struct torture_context *torture)
* and use the handle on it
*/
torture_comment(torture, "connect lsa pipe4 and use policy handle\n");
- status = torture_rpc_connection_transport(mem_ctx, &p4, &ndr_table_lsarpc,
+ status = torture_rpc_connection_transport(torture, &p4, &ndr_table_lsarpc,
transport,
assoc_group_id);
torture_assert_ntstatus_ok(torture, status, "opening lsa pipe4");
@@ -324,7 +324,7 @@ static bool test_handles_lsa_shared(struct torture_context *torture)
* now open p5
*/
torture_comment(torture, "connect lsa pipe5 - should fail\n");
- status = torture_rpc_connection_transport(mem_ctx, &p5, &ndr_table_lsarpc,
+ status = torture_rpc_connection_transport(torture, &p5, &ndr_table_lsarpc,
transport,
assoc_group_id);
torture_assert_ntstatus_equal(torture, status, NT_STATUS_UNSUCCESSFUL,
@@ -348,10 +348,10 @@ static bool test_handles_samr(struct torture_context *torture)
torture_comment(torture, "RPC-HANDLE-SAMR\n");
- status = torture_rpc_connection(mem_ctx, &p1, &ndr_table_samr);
+ status = torture_rpc_connection(torture, &p1, &ndr_table_samr);
torture_assert_ntstatus_ok(torture, status, "opening samr pipe1");
- status = torture_rpc_connection(mem_ctx, &p2, &ndr_table_samr);
+ status = torture_rpc_connection(torture, &p2, &ndr_table_samr);
torture_assert_ntstatus_ok(torture, status, "opening samr pipe1");
r.in.system_name = 0;
@@ -405,7 +405,7 @@ static bool test_handles_mixed_shared(struct torture_context *torture)
}
torture_comment(torture, "connect samr pipe1\n");
- status = torture_rpc_connection(mem_ctx, &p1, &ndr_table_samr);
+ status = torture_rpc_connection(torture, &p1, &ndr_table_samr);
torture_assert_ntstatus_ok(torture, status, "opening samr pipe1");
transport = p1->conn->transport.transport,
@@ -414,7 +414,7 @@ static bool test_handles_mixed_shared(struct torture_context *torture)
torture_comment(torture, "use assoc_group_id[0x%08X] for new connections\n", assoc_group_id);
torture_comment(torture, "connect lsa pipe2\n");
- status = torture_rpc_connection_transport(mem_ctx, &p2, &ndr_table_lsarpc,
+ status = torture_rpc_connection_transport(torture, &p2, &ndr_table_lsarpc,
transport,
assoc_group_id);
torture_assert_ntstatus_ok(torture, status, "opening lsa pipe2");
@@ -448,28 +448,28 @@ static bool test_handles_mixed_shared(struct torture_context *torture)
msleep(10);
torture_comment(torture, "connect samr pipe3 - should fail\n");
- status = torture_rpc_connection_transport(mem_ctx, &p3, &ndr_table_samr,
+ status = torture_rpc_connection_transport(torture, &p3, &ndr_table_samr,
transport,
assoc_group_id);
torture_assert_ntstatus_equal(torture, status, NT_STATUS_UNSUCCESSFUL,
"opening samr pipe3");
torture_comment(torture, "connect lsa pipe4 - should fail\n");
- status = torture_rpc_connection_transport(mem_ctx, &p4, &ndr_table_lsarpc,
+ status = torture_rpc_connection_transport(torture, &p4, &ndr_table_lsarpc,
transport,
assoc_group_id);
torture_assert_ntstatus_equal(torture, status, NT_STATUS_UNSUCCESSFUL,
"opening lsa pipe4");
torture_comment(torture, "connect samr pipe5 with assoc_group_id[0x%08X]- should fail\n", ++assoc_group_id);
- status = torture_rpc_connection_transport(mem_ctx, &p5, &ndr_table_samr,
+ status = torture_rpc_connection_transport(torture, &p5, &ndr_table_samr,
transport,
assoc_group_id);
torture_assert_ntstatus_equal(torture, status, NT_STATUS_UNSUCCESSFUL,
"opening samr pipe5");
torture_comment(torture, "connect lsa pipe6 with assoc_group_id[0x%08X]- should fail\n", ++assoc_group_id);
- status = torture_rpc_connection_transport(mem_ctx, &p6, &ndr_table_lsarpc,
+ status = torture_rpc_connection_transport(torture, &p6, &ndr_table_lsarpc,
transport,
assoc_group_id);
torture_assert_ntstatus_equal(torture, status, NT_STATUS_UNSUCCESSFUL,
@@ -491,7 +491,7 @@ static bool test_handles_random_assoc(struct torture_context *torture)
torture_comment(torture, "RPC-HANDLE-RANDOM-ASSOC\n");
torture_comment(torture, "connect samr pipe1\n");
- status = torture_rpc_connection(mem_ctx, &p1, &ndr_table_samr);
+ status = torture_rpc_connection(torture, &p1, &ndr_table_samr);
torture_assert_ntstatus_ok(torture, status, "opening samr pipe1");
transport = p1->conn->transport.transport,
@@ -500,14 +500,14 @@ static bool test_handles_random_assoc(struct torture_context *torture)
torture_comment(torture, "pip1 use assoc_group_id[0x%08X]\n", assoc_group_id);
torture_comment(torture, "connect samr pipe2 with assoc_group_id[0x%08X]- should fail\n", ++assoc_group_id);
- status = torture_rpc_connection_transport(mem_ctx, &p2, &ndr_table_samr,
+ status = torture_rpc_connection_transport(torture, &p2, &ndr_table_samr,
transport,
assoc_group_id);
torture_assert_ntstatus_equal(torture, status, NT_STATUS_UNSUCCESSFUL,
"opening samr pipe2");
torture_comment(torture, "connect samr pipe3 with assoc_group_id[0x%08X]- should fail\n", ++assoc_group_id);
- status = torture_rpc_connection_transport(mem_ctx, &p3, &ndr_table_samr,
+ status = torture_rpc_connection_transport(torture, &p3, &ndr_table_samr,
transport,
assoc_group_id);
torture_assert_ntstatus_equal(torture, status, NT_STATUS_UNSUCCESSFUL,
@@ -532,10 +532,10 @@ static bool test_handles_drsuapi(struct torture_context *torture)
torture_comment(torture, "RPC-HANDLE-DRSUAPI\n");
- status = torture_rpc_connection(mem_ctx, &p1, &ndr_table_drsuapi);
+ status = torture_rpc_connection(torture, &p1, &ndr_table_drsuapi);
torture_assert_ntstatus_ok(torture, status, "opening drsuapi pipe1");
- status = torture_rpc_connection(mem_ctx, &p2, &ndr_table_drsuapi);
+ status = torture_rpc_connection(torture, &p2, &ndr_table_drsuapi);
torture_assert_ntstatus_ok(torture, status, "opening drsuapi pipe1");
GUID_from_string(DRSUAPI_DS_BIND_GUID, &bind_guid);
diff --git a/source4/torture/rpc/initshutdown.c b/source4/torture/rpc/initshutdown.c
index 84c96211b3..cb6bd4ad53 100644
--- a/source4/torture/rpc/initshutdown.c
+++ b/source4/torture/rpc/initshutdown.c
@@ -121,7 +121,7 @@ BOOL torture_rpc_initshutdown(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_initshutdown");
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_initshutdown);
+ status = torture_rpc_connection(torture, &p, &ndr_table_initshutdown);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c
index cf50d99d82..cfdf483f8d 100644
--- a/source4/torture/rpc/lsa.c
+++ b/source4/torture/rpc/lsa.c
@@ -1459,7 +1459,6 @@ static BOOL test_QueryForestTrustInformation(struct dcerpc_pipe *p,
NTSTATUS status;
struct lsa_String string;
struct lsa_ForestTrustInformation info, *info_ptr;
- uint16_t unknown = 0;
printf("\nTesting lsaRQueryForestTrustInformation\n");
@@ -1496,8 +1495,7 @@ static BOOL test_query_each_TrustDomEx(struct dcerpc_pipe *p,
struct policy_handle *handle,
struct lsa_DomainListEx *domains)
{
- NTSTATUS status;
- int i,j;
+ int i;
BOOL ret = True;
for (i=0; i< domains->count; i++) {
@@ -1999,7 +1997,7 @@ BOOL torture_rpc_lsa(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_lsa");
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_lsarpc);
+ status = torture_rpc_connection(torture, &p, &ndr_table_lsarpc);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
@@ -2087,7 +2085,7 @@ BOOL torture_rpc_lsa_get_user(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_lsa_get_user");
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_lsarpc);
+ status = torture_rpc_connection(torture, &p, &ndr_table_lsarpc);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
diff --git a/source4/torture/rpc/lsa_lookup.c b/source4/torture/rpc/lsa_lookup.c
index c2eb7e86c5..d90c3694a9 100644
--- a/source4/torture/rpc/lsa_lookup.c
+++ b/source4/torture/rpc/lsa_lookup.c
@@ -230,7 +230,7 @@ BOOL torture_rpc_lsa_lookup(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_lsa");
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_lsarpc);
+ status = torture_rpc_connection(torture, &p, &ndr_table_lsarpc);
if (!NT_STATUS_IS_OK(status)) {
ret = False;
goto done;
diff --git a/source4/torture/rpc/mgmt.c b/source4/torture/rpc/mgmt.c
index 5604b87c6e..ec3e390afa 100644
--- a/source4/torture/rpc/mgmt.c
+++ b/source4/torture/rpc/mgmt.c
@@ -29,8 +29,10 @@
/*
ask the server what interface IDs are available on this endpoint
*/
-BOOL test_inq_if_ids(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
- BOOL (*per_id_test)(const struct ndr_interface_table *iface,
+BOOL test_inq_if_ids(struct torture_context *tctx,
+ struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ BOOL (*per_id_test)(struct torture_context *,
+ const struct ndr_interface_table *iface,
TALLOC_CTX *mem_ctx,
struct ndr_syntax_id *id),
const void *priv)
@@ -69,7 +71,7 @@ BOOL test_inq_if_ids(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
ndr_interface_name(&id->uuid, id->if_version));
if (per_id_test) {
- per_id_test(priv, mem_ctx, id);
+ per_id_test(tctx, priv, mem_ctx, id);
}
}
@@ -234,7 +236,7 @@ BOOL torture_rpc_mgmt(struct torture_context *torture)
lp_set_cmdline("torture:binding", dcerpc_binding_string(loop_ctx, b));
- status = torture_rpc_connection(loop_ctx, &p, &ndr_table_mgmt);
+ status = torture_rpc_connection(torture, &p, &ndr_table_mgmt);
if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
printf("Interface not available - skipping\n");
talloc_free(loop_ctx);
@@ -263,7 +265,7 @@ BOOL torture_rpc_mgmt(struct torture_context *torture)
ret = False;
}
- if (!test_inq_if_ids(p, loop_ctx, NULL, NULL)) {
+ if (!test_inq_if_ids(torture, p, loop_ctx, NULL, NULL)) {
ret = False;
}
diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c
index fe27d93757..df69a097b6 100644
--- a/source4/torture/rpc/netlogon.c
+++ b/source4/torture/rpc/netlogon.c
@@ -1652,7 +1652,7 @@ BOOL torture_rpc_netlogon(struct torture_context *torture)
machine_password = cli_credentials_get_password(machine_credentials);
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_netlogon);
+ status = torture_rpc_connection(torture, &p, &ndr_table_netlogon);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
diff --git a/source4/torture/rpc/oxidresolve.c b/source4/torture/rpc/oxidresolve.c
index b849681cc2..2809a2a3fb 100644
--- a/source4/torture/rpc/oxidresolve.c
+++ b/source4/torture/rpc/oxidresolve.c
@@ -229,7 +229,7 @@ BOOL torture_rpc_oxidresolve(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_oxidresolve");
- status = torture_rpc_connection(mem_ctx,
+ status = torture_rpc_connection(torture,
&premact,
&ndr_table_IRemoteActivation);
@@ -238,7 +238,7 @@ BOOL torture_rpc_oxidresolve(struct torture_context *torture)
return False;
}
- status = torture_rpc_connection(mem_ctx,
+ status = torture_rpc_connection(torture,
&p,
&ndr_table_IOXIDResolver);
diff --git a/source4/torture/rpc/remact.c b/source4/torture/rpc/remact.c
index ce3ebd3749..d1294f429d 100644
--- a/source4/torture/rpc/remact.c
+++ b/source4/torture/rpc/remact.c
@@ -105,7 +105,7 @@ BOOL torture_rpc_remact(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_remact");
- status = torture_rpc_connection(mem_ctx,
+ status = torture_rpc_connection(torture,
&p,
&ndr_table_IRemoteActivation);
diff --git a/source4/torture/rpc/rot.c b/source4/torture/rpc/rot.c
index 5850e9b532..32a18b1d32 100644
--- a/source4/torture/rpc/rot.c
+++ b/source4/torture/rpc/rot.c
@@ -32,7 +32,7 @@ BOOL torture_rpc_rot(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_rot");
- status = torture_rpc_connection(mem_ctx,
+ status = torture_rpc_connection(torture,
&p,
&ndr_table_rot);
diff --git a/source4/torture/rpc/rpc.c b/source4/torture/rpc/rpc.c
index 12ace3e7d2..96e70cfe11 100644
--- a/source4/torture/rpc/rpc.c
+++ b/source4/torture/rpc/rpc.c
@@ -28,19 +28,19 @@
#include "lib/util/dlinklist.h"
/* open a rpc connection to the chosen binding string */
-_PUBLIC_ NTSTATUS torture_rpc_connection(TALLOC_CTX *parent_ctx,
+_PUBLIC_ NTSTATUS torture_rpc_connection(struct torture_context *tctx,
struct dcerpc_pipe **p,
const struct ndr_interface_table *table)
{
- NTSTATUS status;
- const char *binding = lp_parm_string(-1, "torture", "binding");
+ NTSTATUS status;
+ const char *binding = torture_setting_string(tctx, "binding", NULL);
if (!binding) {
printf("You must specify a ncacn binding string\n");
return NT_STATUS_INVALID_PARAMETER;
}
- status = dcerpc_pipe_connect(parent_ctx,
+ status = dcerpc_pipe_connect(tctx,
p, binding, table,
cmdline_credentials, NULL);
@@ -52,16 +52,16 @@ _PUBLIC_ NTSTATUS torture_rpc_connection(TALLOC_CTX *parent_ctx,
}
/* open a rpc connection to a specific transport */
-NTSTATUS torture_rpc_connection_transport(TALLOC_CTX *parent_ctx,
+NTSTATUS torture_rpc_connection_transport(struct torture_context *tctx,
struct dcerpc_pipe **p,
const struct ndr_interface_table *table,
enum dcerpc_transport_t transport,
uint32_t assoc_group_id)
{
NTSTATUS status;
- const char *binding = lp_parm_string(-1, "torture", "binding");
+ const char *binding = torture_setting_string(tctx, "binding", NULL);
struct dcerpc_binding *b;
- TALLOC_CTX *mem_ctx = talloc_named(parent_ctx, 0, "torture_rpc_connection_smb");
+ TALLOC_CTX *mem_ctx = talloc_named(tctx, 0, "torture_rpc_connection_smb");
if (!binding) {
printf("You must specify a ncacn binding string\n");
@@ -83,7 +83,7 @@ NTSTATUS torture_rpc_connection_transport(TALLOC_CTX *parent_ctx,
cmdline_credentials, NULL);
if (NT_STATUS_IS_OK(status)) {
- *p = talloc_reference(parent_ctx, *p);
+ *p = talloc_reference(tctx, *p);
} else {
*p = NULL;
}
@@ -219,7 +219,7 @@ NTSTATUS torture_rpc_init(void)
torture_suite_add_simple_test(suite, "SCHANNEL", torture_rpc_schannel);
torture_suite_add_simple_test(suite, "SCHANNEL2", torture_rpc_schannel2);
torture_suite_add_simple_test(suite, "SRVSVC", torture_rpc_srvsvc);
- torture_suite_add_simple_test(suite, "SVCCTL", torture_rpc_svcctl);
+ torture_suite_add_suite(suite, torture_rpc_svcctl(suite));
torture_suite_add_simple_test(suite, "EPMAPPER", torture_rpc_epmapper);
torture_suite_add_simple_test(suite, "INITSHUTDOWN", torture_rpc_initshutdown);
torture_suite_add_simple_test(suite, "OXIDRESOLVE", torture_rpc_oxidresolve);
diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c
index 44813c7d2f..72eba40344 100644
--- a/source4/torture/rpc/samba3rpc.c
+++ b/source4/torture/rpc/samba3rpc.c
@@ -2824,7 +2824,7 @@ BOOL torture_samba3_rpc_winreg(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_winreg");
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_winreg);
+ status = torture_rpc_connection(torture, &p, &ndr_table_winreg);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
diff --git a/source4/torture/rpc/samlogon.c b/source4/torture/rpc/samlogon.c
index d2998f5f34..832bb68072 100644
--- a/source4/torture/rpc/samlogon.c
+++ b/source4/torture/rpc/samlogon.c
@@ -1514,7 +1514,8 @@ BOOL torture_rpc_samlogon(struct torture_context *torture)
userdomain = torture_setting_string(torture, "userdomain", lp_workgroup());
- user_ctx = torture_create_testuser(TEST_USER_NAME,
+ user_ctx = torture_create_testuser(torture,
+ TEST_USER_NAME,
userdomain,
ACB_NORMAL,
(const char **)&user_password);
@@ -1529,7 +1530,8 @@ BOOL torture_rpc_samlogon(struct torture_context *torture)
TEST_USER_NAME, 16 /* > 14 */, &user_password,
NULL, 0, False);
- user_ctx_wrong_wks = torture_create_testuser(TEST_USER_NAME_WRONG_WKS,
+ user_ctx_wrong_wks = torture_create_testuser(torture,
+ TEST_USER_NAME_WRONG_WKS,
userdomain,
ACB_NORMAL,
(const char **)&user_password_wrong_wks);
@@ -1554,7 +1556,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture)
}
user_ctx_wrong_time
- = torture_create_testuser(TEST_USER_NAME_WRONG_TIME,
+ = torture_create_testuser(torture, TEST_USER_NAME_WRONG_TIME,
userdomain,
ACB_NORMAL,
(const char **)&user_password_wrong_time);
diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c
index 6a40cc5e46..4b9392bf3c 100644
--- a/source4/torture/rpc/samsync.c
+++ b/source4/torture/rpc/samsync.c
@@ -1431,7 +1431,7 @@ BOOL torture_rpc_samsync(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_netlogon");
test_machine_account = talloc_asprintf(mem_ctx, "%s$", TEST_MACHINE_NAME);
- join_ctx = torture_create_testuser(test_machine_account, lp_workgroup(), ACB_SVRTRUST,
+ join_ctx = torture_create_testuser(torture, test_machine_account, lp_workgroup(), ACB_SVRTRUST,
&machine_password);
if (!join_ctx) {
talloc_free(mem_ctx);
@@ -1440,7 +1440,7 @@ BOOL torture_rpc_samsync(struct torture_context *torture)
}
test_wksta_machine_account = talloc_asprintf(mem_ctx, "%s$", TEST_WKSTA_MACHINE_NAME);
- join_ctx2 = torture_create_testuser(test_wksta_machine_account, lp_workgroup(), ACB_WSTRUST,
+ join_ctx2 = torture_create_testuser(torture, test_wksta_machine_account, lp_workgroup(), ACB_WSTRUST,
&wksta_machine_password);
if (!join_ctx2) {
talloc_free(mem_ctx);
@@ -1448,7 +1448,7 @@ BOOL torture_rpc_samsync(struct torture_context *torture)
return False;
}
- user_ctx = torture_create_testuser(TEST_USER_NAME,
+ user_ctx = torture_create_testuser(torture, TEST_USER_NAME,
lp_workgroup(),
ACB_NORMAL, NULL);
if (!user_ctx) {
@@ -1503,7 +1503,7 @@ BOOL torture_rpc_samsync(struct torture_context *torture)
}
- status = torture_rpc_connection(samsync_state,
+ status = torture_rpc_connection(torture,
&samsync_state->p_lsa,
&ndr_table_lsarpc);
diff --git a/source4/torture/rpc/scanner.c b/source4/torture/rpc/scanner.c
index 1f74b8b1cf..da4fc84f6f 100644
--- a/source4/torture/rpc/scanner.c
+++ b/source4/torture/rpc/scanner.c
@@ -28,7 +28,8 @@
/*
work out how many calls there are for an interface
*/
-static BOOL test_num_calls(const struct ndr_interface_table *iface,
+static BOOL test_num_calls(struct torture_context *tctx,
+ const struct ndr_interface_table *iface,
TALLOC_CTX *mem_ctx,
struct ndr_syntax_id *id)
{
@@ -44,7 +45,7 @@ static BOOL test_num_calls(const struct ndr_interface_table *iface,
tbl.name = iface->name;
tbl.syntax_id = *id;
- status = torture_rpc_connection(mem_ctx, &p, iface);
+ status = torture_rpc_connection(tctx, &p, iface);
if (!NT_STATUS_IS_OK(status)) {
char *uuid_str = GUID_string(mem_ctx, &id->uuid);
printf("Failed to connect to '%s' on '%s' - %s\n",
@@ -142,14 +143,14 @@ BOOL torture_rpc_scanner(struct torture_context *torture)
lp_set_cmdline("torture:binding", dcerpc_binding_string(mem_ctx, b));
- status = torture_rpc_connection(loop_ctx, &p, &ndr_table_mgmt);
+ status = torture_rpc_connection(torture, &p, &ndr_table_mgmt);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(loop_ctx);
ret = False;
continue;
}
- if (!test_inq_if_ids(p, mem_ctx, test_num_calls, l->table)) {
+ if (!test_inq_if_ids(torture, p, mem_ctx, test_num_calls, l->table)) {
ret = False;
}
}
diff --git a/source4/torture/rpc/session_key.c b/source4/torture/rpc/session_key.c
index a438fea321..c4b31be8a7 100644
--- a/source4/torture/rpc/session_key.c
+++ b/source4/torture/rpc/session_key.c
@@ -170,7 +170,7 @@ BOOL torture_rpc_lsa_secrets(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_lsa_secrets");
- status = torture_rpc_connection(mem_ctx,
+ status = torture_rpc_connection(torture,
&p,
&ndr_table_lsarpc);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index 2b07b326aa..a9232f6df3 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -2076,17 +2076,17 @@ static BOOL test_EnumPrinterDrivers_old(struct dcerpc_pipe *p, TALLOC_CTX *mem_c
return ret;
}
-BOOL torture_rpc_spoolss(struct torture_context *torture)
+bool torture_rpc_spoolss(struct torture_context *torture)
{
- NTSTATUS status;
- struct dcerpc_pipe *p;
+ NTSTATUS status;
+ struct dcerpc_pipe *p;
TALLOC_CTX *mem_ctx;
BOOL ret = True;
struct test_spoolss_context *ctx;
mem_ctx = talloc_init("torture_rpc_spoolss");
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_spoolss);
+ status = torture_rpc_connection(torture, &p, &ndr_table_spoolss);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
diff --git a/source4/torture/rpc/srvsvc.c b/source4/torture/rpc/srvsvc.c
index c3d82a2715..e066b08596 100644
--- a/source4/torture/rpc/srvsvc.c
+++ b/source4/torture/rpc/srvsvc.c
@@ -1101,7 +1101,7 @@ BOOL torture_rpc_srvsvc(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_srvsvc");
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_srvsvc);
+ status = torture_rpc_connection(torture, &p, &ndr_table_srvsvc);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
@@ -1122,7 +1122,7 @@ BOOL torture_rpc_srvsvc(struct torture_context *torture)
ret &= test_NetShareAddSetDel(p, mem_ctx);
ret &= test_NetNameValidate(p, mem_ctx);
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_srvsvc);
+ status = torture_rpc_connection(torture, &p, &ndr_table_srvsvc);
if (!binding) {
d_printf("You must specify a ncacn binding string\n");
diff --git a/source4/torture/rpc/svcctl.c b/source4/torture/rpc/svcctl.c
index fedc999931..4390b8dd3e 100644
--- a/source4/torture/rpc/svcctl.c
+++ b/source4/torture/rpc/svcctl.c
@@ -23,15 +23,48 @@
#include "librpc/gen_ndr/ndr_svcctl_c.h"
#include "torture/rpc/rpc.h"
-static BOOL test_EnumServicesStatus(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *h)
+static bool test_OpenSCManager(struct dcerpc_pipe *p, struct torture_context *tctx, struct policy_handle *h)
+{
+ struct svcctl_OpenSCManagerW r;
+
+ r.in.MachineName = NULL;
+ r.in.DatabaseName = NULL;
+ r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
+ r.out.handle = h;
+
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_svcctl_OpenSCManagerW(p, tctx, &r),
+ "OpenSCManager failed!");
+
+ return true;
+}
+
+static bool test_CloseServiceHandle(struct dcerpc_pipe *p, struct torture_context *tctx, struct policy_handle *h)
+{
+ struct svcctl_CloseServiceHandle r;
+
+ r.in.handle = h;
+ r.out.handle = h;
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_svcctl_CloseServiceHandle(p, tctx, &r),
+ "CloseServiceHandle failed");
+
+ return true;
+}
+
+static bool test_EnumServicesStatus(struct torture_context *tctx, struct dcerpc_pipe *p)
{
struct svcctl_EnumServicesStatusW r;
+ struct policy_handle h;
int i;
NTSTATUS status;
uint32_t resume_handle = 0;
struct ENUM_SERVICE_STATUS *service = NULL;
- r.in.handle = h;
+ if (!test_OpenSCManager(p, tctx, &h))
+ return false;
+
+ r.in.handle = &h;
r.in.type = SERVICE_TYPE_WIN32;
r.in.state = SERVICE_STATE_ALL;
r.in.buf_size = 0;
@@ -41,101 +74,58 @@ static BOOL test_EnumServicesStatus(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
r.out.services_returned = 0;
r.out.bytes_needed = 0;
- status = dcerpc_svcctl_EnumServicesStatusW(p, mem_ctx, &r);
+ status = dcerpc_svcctl_EnumServicesStatusW(p, tctx, &r);
- if (!NT_STATUS_IS_OK(status)) {
- printf("ËnumServicesStatus failed!\n");
- return False;
- }
+ torture_assert_ntstatus_ok(tctx, status, "EnumServicesStatus failed!");
if (W_ERROR_EQUAL(r.out.result, WERR_MORE_DATA)) {
r.in.buf_size = *r.out.bytes_needed;
- r.out.service = talloc_size(mem_ctx, *r.out.bytes_needed);
+ r.out.service = talloc_size(tctx, *r.out.bytes_needed);
- status = dcerpc_svcctl_EnumServicesStatusW(p, mem_ctx, &r);
+ status = dcerpc_svcctl_EnumServicesStatusW(p, tctx, &r);
- if (!NT_STATUS_IS_OK(status)) {
- printf("ËnumServicesStatus failed!\n");
- return False;
- }
+ torture_assert_ntstatus_ok(tctx, status, "EnumServicesStatus failed!");
+ torture_assert_werr_ok(tctx, r.out.result, "EnumServicesStatus failed");
- if (!W_ERROR_IS_OK(r.out.result)) {
- printf("EnumServicesStatus failed\n");
- return False;
- }
service = (struct ENUM_SERVICE_STATUS *)r.out.service;
}
for(i = 0; i < *r.out.services_returned; i++) {
printf("Type: %d, State: %d\n", service[i].status.type, service[i].status.state);
}
-
- return True;
-}
-
-static BOOL test_OpenSCManager(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *h)
-{
- struct svcctl_OpenSCManagerW r;
- NTSTATUS status;
-
- r.in.MachineName = NULL;
- r.in.DatabaseName = NULL;
- r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
- r.out.handle = h;
- status = dcerpc_svcctl_OpenSCManagerW(p, mem_ctx, &r);
- if (!NT_STATUS_IS_OK(status)) {
- printf("OpenSCManager failed!\n");
- return False;
- }
-
- return True;
-}
+ if (!test_CloseServiceHandle(p, tctx, &h))
+ return false;
-static BOOL test_CloseServiceHandle(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *h)
-{
- struct svcctl_CloseServiceHandle r;
- NTSTATUS status;
- r.in.handle = h;
- r.out.handle = h;
- status = dcerpc_svcctl_CloseServiceHandle(p, mem_ctx, &r);
- if (!NT_STATUS_IS_OK(status)) {
- printf("CloseServiceHandle failed\n");
- return False;
- }
-
- return True;
+ return true;
}
-BOOL torture_rpc_svcctl(struct torture_context *torture)
+static bool test_SCManager(struct torture_context *tctx,
+ struct dcerpc_pipe *p)
{
- NTSTATUS status;
- struct dcerpc_pipe *p;
- struct policy_handle h;
- TALLOC_CTX *mem_ctx;
- BOOL ret = True;
-
- mem_ctx = talloc_init("torture_rpc_svcctl");
-
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_svcctl);
- if (!NT_STATUS_IS_OK(status)) {
- talloc_free(mem_ctx);
- return False;
- }
+ struct policy_handle h;
- if (!test_OpenSCManager(p, mem_ctx, &h)) {
- ret = False;
- }
+ if (!test_OpenSCManager(p, tctx, &h))
+ return false;
- if (!test_EnumServicesStatus(p, mem_ctx, &h)) {
- ret = False;
- }
+ if (!test_CloseServiceHandle(p, tctx, &h))
+ return false;
- if (!test_CloseServiceHandle(p, mem_ctx, &h)) {
- ret = False;
- }
+ return true;
+}
- talloc_free(mem_ctx);
+struct torture_suite *torture_rpc_svcctl(TALLOC_CTX *mem_ctx)
+{
+ struct torture_suite *suite = torture_suite_create(mem_ctx, "SVCCTL");
+ struct torture_tcase *tcase;
+
+ tcase = torture_suite_add_rpc_iface_tcase(suite, "svcctl",
+ &ndr_table_svcctl);
+
+ torture_rpc_tcase_add_test(tcase, "SCManager",
+ test_SCManager);
+ torture_rpc_tcase_add_test(tcase, "EnumServicesStatus",
+ test_EnumServicesStatus);
- return ret;
+ return suite;
}
diff --git a/source4/torture/rpc/testjoin.c b/source4/torture/rpc/testjoin.c
index e6c4435618..56a0fccde4 100644
--- a/source4/torture/rpc/testjoin.c
+++ b/source4/torture/rpc/testjoin.c
@@ -101,7 +101,8 @@ static NTSTATUS DeleteUser_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
when finished
*/
-struct test_join *torture_create_testuser(const char *username,
+struct test_join *torture_create_testuser(struct torture_context *torture,
+ const char *username,
const char *domain,
uint16_t acct_type,
const char **random_password)
@@ -143,7 +144,7 @@ struct test_join *torture_create_testuser(const char *username,
cmdline_credentials, NULL);
} else {
- status = torture_rpc_connection(join,
+ status = torture_rpc_connection(torture,
&join->p,
&ndr_table_samr);
}