diff options
author | Stefan Metzmacher <metze@samba.org> | 2014-01-24 11:31:25 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2014-02-11 16:20:30 +0100 |
commit | ce973f78af956c075156bb091fd4ef86281baa16 (patch) | |
tree | 6bf6565f7487e19dfb05caa344bafe7c8e4d613c /source4/torture/rpc | |
parent | 9a6201e6daf79f3c679227bd8fb41522f6dd8247 (diff) | |
download | samba-ce973f78af956c075156bb091fd4ef86281baa16.tar.gz samba-ce973f78af956c075156bb091fd4ef86281baa16.tar.xz samba-ce973f78af956c075156bb091fd4ef86281baa16.zip |
s4:torture/rpc: fix rpc.scanner test
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r-- | source4/torture/rpc/scanner.c | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/source4/torture/rpc/scanner.c b/source4/torture/rpc/scanner.c index 0af35fa3e68..5edd5040351 100644 --- a/source4/torture/rpc/scanner.c +++ b/source4/torture/rpc/scanner.c @@ -35,17 +35,23 @@ static bool test_num_calls(struct torture_context *tctx, { struct dcerpc_pipe *p; NTSTATUS status; - int i; + unsigned int i; DATA_BLOB stub_in, stub_out; - int idl_calls; - struct ndr_interface_table tbl; + struct ndr_interface_table _tbl; + const struct ndr_interface_table *tbl; /* FIXME: This should be fixed when torture_rpc_connection * takes a ndr_syntax_id */ - tbl.name = iface->name; - tbl.syntax_id = *id; + tbl = ndr_table_by_syntax(id); + if (tbl == NULL) { + _tbl = *iface; + _tbl.name = "__unknown__"; + _tbl.syntax_id = *id; + _tbl.num_calls = UINT32_MAX; + tbl = &_tbl; + } - status = torture_rpc_connection(tctx, &p, iface); + status = torture_rpc_connection(tctx, &p, tbl); 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", @@ -59,7 +65,9 @@ static bool test_num_calls(struct torture_context *tctx, memset(stub_in.data, 0xFF, stub_in.length); for (i=0;i<200;i++) { + bool ok; uint32_t out_flags = 0; + status = dcerpc_binding_handle_raw_call(p->binding_handle, NULL, i, 0, /* in_flags */ @@ -69,26 +77,32 @@ static bool test_num_calls(struct torture_context *tctx, &stub_out.data, &stub_out.length, &out_flags); + ok = dcerpc_binding_handle_is_connected(p->binding_handle); + if (!ok) { + printf("\tpipe disconnected at %u\n", i); + goto done; + } + if (NT_STATUS_EQUAL(status, NT_STATUS_RPC_PROCNUM_OUT_OF_RANGE)) { break; } if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) { - printf("\tpipe disconnected at %d\n", i); + printf("\taccess denied at %u\n", i); goto done; } if (NT_STATUS_EQUAL(status, NT_STATUS_RPC_PROTOCOL_ERROR)) { - printf("\tprotocol error at %d\n", i); + printf("\tprotocol error at %u\n", i); } } printf("\t%d calls available\n", i); - idl_calls = ndr_interface_num_calls(&id->uuid, id->if_version); - if (idl_calls == -1) { + if (tbl->num_calls == UINT32_MAX) { printf("\tinterface not known in local IDL\n"); - } else if (i != idl_calls) { - printf("\tWARNING: local IDL defines %u calls\n", idl_calls); + } else if (tbl->num_calls != i) { + printf("\tWARNING: local IDL defines %u calls\n", + (unsigned int)tbl->num_calls); } else { printf("\tOK: matches num_calls in local IDL\n"); } @@ -126,7 +140,9 @@ bool torture_rpc_scanner(struct torture_context *torture) printf("\nTesting pipe '%s'\n", l->table->name); if (b->transport == NCACN_IP_TCP) { - status = dcerpc_epm_map_binding(torture, b, l->table, NULL, torture->lp_ctx); + status = dcerpc_epm_map_binding(torture, b, l->table, + torture->ev, + torture->lp_ctx); if (!NT_STATUS_IS_OK(status)) { printf("Failed to map port for uuid %s\n", GUID_string(loop_ctx, &l->table->syntax_id.uuid)); |