From d658de65d32e6746ac51aeb4da7aa74b3da40c2b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 27 Dec 2005 16:22:35 +0000 Subject: r12512: Use GUID structs in API functions everywhere rather then converting back and forth between GUID structs and strings in several places. (This used to be commit 3564e2f967ef72d6301b4f7e9a311cebcded4d75) --- source4/torture/rpc/bind.c | 2 +- source4/torture/rpc/epmapper.c | 4 +--- source4/torture/rpc/mgmt.c | 10 ++++------ source4/torture/rpc/scanner.c | 18 ++++++++++-------- 4 files changed, 16 insertions(+), 18 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/rpc/bind.c b/source4/torture/rpc/bind.c index d27fbb2b11..55ddec2fd5 100644 --- a/source4/torture/rpc/bind.c +++ b/source4/torture/rpc/bind.c @@ -64,7 +64,7 @@ BOOL torture_multi_bind(void) if (NT_STATUS_IS_OK(status)) { printf("(incorrectly) allowed re-bind to uuid %s - %s\n", - dcerpc_table_lsarpc.uuid, nt_errstr(status)); + GUID_string(mem_ctx, &dcerpc_table_lsarpc.uuid), nt_errstr(status)); ret = False; } else { printf("\n"); diff --git a/source4/torture/rpc/epmapper.c b/source4/torture/rpc/epmapper.c index f7935ce2d7..9774b9681c 100644 --- a/source4/torture/rpc/epmapper.c +++ b/source4/torture/rpc/epmapper.c @@ -44,7 +44,6 @@ static BOOL test_Map(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, NTSTATUS status; struct epm_Map r; struct GUID uuid; - const char *uuid_str; struct policy_handle handle; int i; struct GUID if_uuid; @@ -60,10 +59,9 @@ static BOOL test_Map(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r.in.max_towers = 100; dcerpc_floor_get_lhs_data(&twr->tower.floors[0], &if_uuid, &if_version); - uuid_str = GUID_string(mem_ctx, &if_uuid); printf("epm_Map results for '%s':\n", - idl_pipe_name(uuid_str, if_version)); + idl_pipe_name(&if_uuid, if_version)); twr->tower.floors[2].lhs.protocol = EPM_PROTOCOL_NCACN; twr->tower.floors[2].lhs.lhs_data = data_blob(NULL, 0); diff --git a/source4/torture/rpc/mgmt.c b/source4/torture/rpc/mgmt.c index 72495c248b..28ac07f607 100644 --- a/source4/torture/rpc/mgmt.c +++ b/source4/torture/rpc/mgmt.c @@ -50,15 +50,12 @@ static BOOL test_inq_if_ids(struct dcerpc_pipe *p, } for (i=0;icount;i++) { - const char *uuid; struct dcerpc_syntax_id *id = r.out.if_id_vector->if_id[i].id; if (!id) continue; - uuid = GUID_string(mem_ctx, &id->uuid); - printf("\tuuid %s version 0x%08x '%s'\n", - uuid, - id->if_version, idl_pipe_name(uuid, id->if_version)); + GUID_string(mem_ctx, &id->uuid), + id->if_version, idl_pipe_name(&id->uuid, id->if_version)); } return True; @@ -212,8 +209,9 @@ BOOL torture_rpc_mgmt(void) if (b->transport == NCACN_IP_TCP) { status = dcerpc_epm_map_binding(loop_ctx, b, l->table, NULL); if (!NT_STATUS_IS_OK(status)) { + printf("Failed to map port for uuid %s\n", + GUID_string(loop_ctx, &l->table->uuid)); talloc_free(loop_ctx); - printf("Failed to map port for uuid %s\n", l->table->uuid); continue; } } else { diff --git a/source4/torture/rpc/scanner.c b/source4/torture/rpc/scanner.c index 1f612fbaee..9ed414e2f4 100644 --- a/source4/torture/rpc/scanner.c +++ b/source4/torture/rpc/scanner.c @@ -32,7 +32,6 @@ static BOOL test_num_calls(const struct dcerpc_interface_table *iface, { struct dcerpc_pipe *p; NTSTATUS status; - const char *uuid; int i; DATA_BLOB stub_in, stub_out; int idl_calls; @@ -41,14 +40,15 @@ static BOOL test_num_calls(const struct dcerpc_interface_table *iface, /* FIXME: This should be fixed when torture_rpc_connection * takes a dcerpc_syntax_id */ tbl.name = iface->name; - tbl.uuid = GUID_string(mem_ctx, &id->uuid); + tbl.uuid = id->uuid; tbl.if_version = id->if_version; - status = torture_rpc_connection(mem_ctx, - &p, iface); + status = torture_rpc_connection(mem_ctx, &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", - uuid, iface->name, nt_errstr(status)); + uuid_str, iface->name, nt_errstr(status)); + talloc_free(uuid_str); return False; } @@ -75,7 +75,7 @@ static BOOL test_num_calls(const struct dcerpc_interface_table *iface, } printf("\t%d calls available\n", i); - idl_calls = idl_num_calls(uuid, id->if_version); + idl_calls = idl_num_calls(&id->uuid, id->if_version); if (idl_calls == -1) { printf("\tinterface not known in local IDL\n"); } else if (i != idl_calls) { @@ -125,7 +125,8 @@ static BOOL test_inq_if_ids(struct dcerpc_pipe *p, printf("\n\tuuid %s version 0x%08x '%s'\n", uuid, - id->if_version, idl_pipe_name(uuid, id->if_version)); + id->if_version, idl_pipe_name(&id->uuid, id->if_version)); + test_num_calls(iface, mem_ctx, id); } @@ -172,8 +173,9 @@ BOOL torture_rpc_scanner(void) if (b->transport == NCACN_IP_TCP) { status = dcerpc_epm_map_binding(mem_ctx, b, l->table, NULL); if (!NT_STATUS_IS_OK(status)) { + printf("Failed to map port for uuid %s\n", + GUID_string(loop_ctx, &l->table->uuid)); talloc_free(loop_ctx); - printf("Failed to map port for uuid %s\n", l->table->uuid); continue; } } else { -- cgit