1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-05 20:58:40 +03:00

s4:torture/rpc/mgmt.c: make use of dcerpc_binding_handle stubs

metze
This commit is contained in:
Stefan Metzmacher 2010-03-16 10:43:39 +01:00
parent 87a5596d46
commit d03286e078
2 changed files with 20 additions and 16 deletions

View File

@ -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;
}

View File

@ -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;
}
}