From d03286e078e0544238212d81e3aa73c40acdca89 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 16 Mar 2010 10:43:39 +0100 Subject: s4:torture/rpc/mgmt.c: make use of dcerpc_binding_handle stubs metze --- source4/torture/rpc/mgmt.c | 34 +++++++++++++++++++--------------- source4/torture/rpc/scanner.c | 2 +- 2 files changed, 20 insertions(+), 16 deletions(-) (limited to 'source4/torture/rpc') diff --git a/source4/torture/rpc/mgmt.c b/source4/torture/rpc/mgmt.c index 95c13c0ca6..02fee16e55 100644 --- a/source4/torture/rpc/mgmt.c +++ b/source4/torture/rpc/mgmt.c @@ -30,7 +30,8 @@ ask the server what interface IDs are available on this endpoint */ bool test_inq_if_ids(struct torture_context *tctx, - struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + struct dcerpc_binding_handle *b, + TALLOC_CTX *mem_ctx, bool (*per_id_test)(struct torture_context *, const struct ndr_interface_table *iface, TALLOC_CTX *mem_ctx, @@ -45,7 +46,7 @@ bool test_inq_if_ids(struct torture_context *tctx, vector = talloc(mem_ctx, struct rpc_if_id_vector_t); r.out.if_id_vector = &vector; - status = dcerpc_mgmt_inq_if_ids(p, mem_ctx, &r); + status = dcerpc_mgmt_inq_if_ids_r(b, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("inq_if_ids failed - %s\n", nt_errstr(status)); return false; @@ -78,7 +79,7 @@ bool test_inq_if_ids(struct torture_context *tctx, return true; } -static bool test_inq_stats(struct dcerpc_pipe *p, +static bool test_inq_stats(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx) { NTSTATUS status; @@ -89,7 +90,7 @@ static bool test_inq_stats(struct dcerpc_pipe *p, r.in.unknown = 0; r.out.statistics = &statistics; - status = dcerpc_mgmt_inq_stats(p, mem_ctx, &r); + status = dcerpc_mgmt_inq_stats_r(b, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("inq_stats failed - %s\n", nt_errstr(status)); return false; @@ -109,7 +110,7 @@ static bool test_inq_stats(struct dcerpc_pipe *p, return true; } -static bool test_inq_princ_name(struct dcerpc_pipe *p, +static bool test_inq_princ_name(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx) { NTSTATUS status; @@ -121,7 +122,7 @@ static bool test_inq_princ_name(struct dcerpc_pipe *p, r.in.authn_proto = i; /* DCERPC_AUTH_TYPE_* */ r.in.princ_name_size = 100; - status = dcerpc_mgmt_inq_princ_name(p, mem_ctx, &r); + status = dcerpc_mgmt_inq_princ_name_r(b, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { continue; } @@ -145,14 +146,14 @@ static bool test_inq_princ_name(struct dcerpc_pipe *p, return true; } -static bool test_is_server_listening(struct dcerpc_pipe *p, +static bool test_is_server_listening(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx) { NTSTATUS status; struct mgmt_is_server_listening r; r.out.status = talloc(mem_ctx, uint32_t); - status = dcerpc_mgmt_is_server_listening(p, mem_ctx, &r); + status = dcerpc_mgmt_is_server_listening_r(b, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("is_server_listening failed - %s\n", nt_errstr(status)); return false; @@ -167,13 +168,13 @@ static bool test_is_server_listening(struct dcerpc_pipe *p, return true; } -static bool test_stop_server_listening(struct dcerpc_pipe *p, +static bool test_stop_server_listening(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx) { NTSTATUS status; struct mgmt_stop_server_listening r; - status = dcerpc_mgmt_stop_server_listening(p, mem_ctx, &r); + status = dcerpc_mgmt_stop_server_listening_r(b, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("stop_server_listening failed - %s\n", nt_errstr(status)); return false; @@ -208,6 +209,8 @@ bool torture_rpc_mgmt(struct torture_context *torture) } for (l=ndr_table_list();l;l=l->next) { + struct dcerpc_binding_handle *bh; + loop_ctx = talloc_named(mem_ctx, 0, "torture_rpc_mgmt loop context"); /* some interfaces are not mappable */ @@ -235,6 +238,7 @@ bool torture_rpc_mgmt(struct torture_context *torture) talloc_free(loop_ctx); continue; } + bh = p->binding_handle; if (!NT_STATUS_IS_OK(status)) { talloc_free(loop_ctx); @@ -242,23 +246,23 @@ bool torture_rpc_mgmt(struct torture_context *torture) continue; } - if (!test_is_server_listening(p, loop_ctx)) { + if (!test_is_server_listening(bh, loop_ctx)) { ret = false; } - if (!test_stop_server_listening(p, loop_ctx)) { + if (!test_stop_server_listening(bh, loop_ctx)) { ret = false; } - if (!test_inq_stats(p, loop_ctx)) { + if (!test_inq_stats(bh, loop_ctx)) { ret = false; } - if (!test_inq_princ_name(p, loop_ctx)) { + if (!test_inq_princ_name(bh, loop_ctx)) { ret = false; } - if (!test_inq_if_ids(torture, p, loop_ctx, NULL, NULL)) { + if (!test_inq_if_ids(torture, bh, loop_ctx, NULL, NULL)) { ret = false; } diff --git a/source4/torture/rpc/scanner.c b/source4/torture/rpc/scanner.c index 9acc789ee9..c176c3d6f1 100644 --- a/source4/torture/rpc/scanner.c +++ b/source4/torture/rpc/scanner.c @@ -139,7 +139,7 @@ bool torture_rpc_scanner(struct torture_context *torture) continue; } - if (!test_inq_if_ids(torture, p, torture, test_num_calls, l->table)) { + if (!test_inq_if_ids(torture, p->binding_handle, torture, test_num_calls, l->table)) { ret = false; } } -- cgit