diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-12-27 16:22:35 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:47:48 -0500 |
commit | d658de65d32e6746ac51aeb4da7aa74b3da40c2b (patch) | |
tree | 3057af6864b3eb0b26d523aa4c100213380551f5 /source4 | |
parent | 8270e1e31071d23915cc3aa408ad6c7074ea1c11 (diff) | |
download | samba-d658de65d32e6746ac51aeb4da7aa74b3da40c2b.tar.gz samba-d658de65d32e6746ac51aeb4da7aa74b3da40c2b.tar.xz samba-d658de65d32e6746ac51aeb4da7aa74b3da40c2b.zip |
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)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/lib/com/dcom/main.c | 7 | ||||
-rw-r--r-- | source4/lib/messaging/messaging.c | 5 | ||||
-rw-r--r-- | source4/librpc/idl/krb5pac.idl | 1 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc.c | 4 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc.h | 2 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc_util.c | 31 | ||||
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm | 4 | ||||
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm | 9 | ||||
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Util.pm | 16 | ||||
-rw-r--r-- | source4/rpc_server/dcerpc_server.c | 58 | ||||
-rw-r--r-- | source4/rpc_server/dcerpc_server.h | 4 | ||||
-rw-r--r-- | source4/rpc_server/epmapper/rpc_epmapper.c | 2 | ||||
-rw-r--r-- | source4/rpc_server/remote/dcesrv_remote.c | 6 | ||||
-rw-r--r-- | source4/torture/rpc/bind.c | 2 | ||||
-rw-r--r-- | source4/torture/rpc/epmapper.c | 4 | ||||
-rw-r--r-- | source4/torture/rpc/mgmt.c | 10 | ||||
-rw-r--r-- | source4/torture/rpc/scanner.c | 18 | ||||
-rw-r--r-- | source4/utils/ndrdump.c | 7 |
18 files changed, 92 insertions, 98 deletions
diff --git a/source4/lib/com/dcom/main.c b/source4/lib/com/dcom/main.c index 4a3dde86ec9..bfa41f9ef6d 100644 --- a/source4/lib/com/dcom/main.c +++ b/source4/lib/com/dcom/main.c @@ -262,7 +262,6 @@ NTSTATUS dcom_get_pipe(struct IUnknown *iface, struct dcerpc_pipe **pp) int i; struct dcerpc_pipe *p; TALLOC_CTX *tmp_ctx; - const char *uuid; struct dcom_object_exporter *ox; ox = object_exporter_by_ip(iface->ctx, iface); @@ -273,8 +272,6 @@ NTSTATUS dcom_get_pipe(struct IUnknown *iface, struct dcerpc_pipe **pp) iid = iface->vtable->iid; - uuid = GUID_string(tmp_ctx, &iid); - if (p) { if (!GUID_equal(&p->syntax.uuid, &iid)) { struct dcerpc_pipe *p2; @@ -282,7 +279,7 @@ NTSTATUS dcom_get_pipe(struct IUnknown *iface, struct dcerpc_pipe **pp) /* interface will always be present, so * idl_iface_by_uuid can't return NULL */ - status = dcerpc_secondary_context(p, &p2, idl_iface_by_uuid(uuid)); + status = dcerpc_secondary_context(p, &p2, idl_iface_by_uuid(&iid)); if (NT_STATUS_IS_OK(status)) { p = p2; @@ -303,7 +300,7 @@ NTSTATUS dcom_get_pipe(struct IUnknown *iface, struct dcerpc_pipe **pp) DEBUG(1, ("Error parsing string binding")); } else { status = dcerpc_pipe_connect_b(NULL, &p, binding, - idl_iface_by_uuid(uuid), + idl_iface_by_uuid(&iid), iface->ctx->dcom->credentials, iface->ctx->event_ctx); } diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index 06eed05404d..e3ad8e7e257 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -479,7 +479,7 @@ NTSTATUS irpc_register(struct messaging_context *msg_ctx, irpc->callnum = callnum; irpc->fn = fn; irpc->private = private; - GUID_from_string(irpc->table->uuid, &irpc->uuid); + irpc->uuid = irpc->table->uuid; return NT_STATUS_OK; } @@ -689,8 +689,7 @@ struct irpc_request *irpc_call_send(struct messaging_context *msg_ctx, talloc_set_destructor(irpc, irpc_destructor); /* setup the header */ - status = GUID_from_string(table->uuid, &header.uuid); - if (!NT_STATUS_IS_OK(status)) goto failed; + header.uuid = table->uuid; header.if_version = table->if_version; header.callid = irpc->callid; diff --git a/source4/librpc/idl/krb5pac.idl b/source4/librpc/idl/krb5pac.idl index dd3eedc7a77..0d614493ed0 100644 --- a/source4/librpc/idl/krb5pac.idl +++ b/source4/librpc/idl/krb5pac.idl @@ -5,7 +5,6 @@ #include "idl_types.h" [ - uuid("1-2-3-4"), version(0.0), pointer_default(unique), depends(security,netlogon) diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c index b947b4aa5c2..10093cfcbb8 100644 --- a/source4/librpc/rpc/dcerpc.c +++ b/source4/librpc/rpc/dcerpc.c @@ -796,9 +796,7 @@ NTSTATUS dcerpc_init_syntaxes(const struct dcerpc_interface_table *table, { NTSTATUS status; - status = GUID_from_string(table->uuid, &syntax->uuid); - if (!NT_STATUS_IS_OK(status)) return status; - + syntax->uuid = table->uuid; syntax->if_version = table->if_version; status = GUID_from_string(NDR_GUID, &transfer_syntax->uuid); diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h index 5f13ba3081d..058bef1ddfc 100644 --- a/source4/librpc/rpc/dcerpc.h +++ b/source4/librpc/rpc/dcerpc.h @@ -168,7 +168,7 @@ struct dcerpc_authservice_list { struct dcerpc_interface_table { const char *name; - const char *uuid; + struct GUID uuid; uint32_t if_version; const char *helpstring; uint32_t num_calls; diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c index 080f5dee6b8..3a1e3c6cff5 100644 --- a/source4/librpc/rpc/dcerpc_util.c +++ b/source4/librpc/rpc/dcerpc_util.c @@ -34,11 +34,11 @@ /* find the pipe name for a local IDL interface */ -const char *idl_pipe_name(const char *uuid, uint32_t if_version) +const char *idl_pipe_name(const struct GUID *uuid, uint32_t if_version) { const struct dcerpc_interface_list *l; for (l=librpc_dcerpc_pipes();l;l=l->next) { - if (strcasecmp(l->table->uuid, uuid) == 0 && + if (GUID_equal(&l->table->uuid, uuid) && l->table->if_version == if_version) { return l->table->name; } @@ -49,11 +49,11 @@ const char *idl_pipe_name(const char *uuid, uint32_t if_version) /* find the number of calls defined by local IDL */ -int idl_num_calls(const char *uuid, uint32_t if_version) +int idl_num_calls(const struct GUID *uuid, uint32_t if_version) { const struct dcerpc_interface_list *l; for (l=librpc_dcerpc_pipes();l;l=l->next){ - if (strcasecmp(l->table->uuid, uuid) == 0 && + if (GUID_equal(&l->table->uuid, uuid) && l->table->if_version == if_version) { return l->table->num_calls; } @@ -79,11 +79,11 @@ const struct dcerpc_interface_table *idl_iface_by_name(const char *name) /* find a dcerpc interface by uuid */ -const struct dcerpc_interface_table *idl_iface_by_uuid(const char *uuid) +const struct dcerpc_interface_table *idl_iface_by_uuid(const struct GUID *uuid) { const struct dcerpc_interface_list *l; for (l=librpc_dcerpc_pipes();l;l=l->next) { - if (strcasecmp(l->table->uuid, uuid) == 0) { + if (GUID_equal(&l->table->uuid, uuid)) { return l->table; } } @@ -883,11 +883,7 @@ NTSTATUS dcerpc_epm_map_binding(TALLOC_CTX *mem_ctx, struct dcerpc_binding *bind ZERO_STRUCT(handle); ZERO_STRUCT(guid); - status = GUID_from_string(table->uuid, &binding->object); - if (NT_STATUS_IS_ERR(status)) { - return status; - } - + binding->object = table->uuid; binding->object_version = table->if_version; status = dcerpc_binding_build_tower(p, binding, &twr.tower); @@ -998,7 +994,9 @@ NTSTATUS dcerpc_pipe_auth(struct dcerpc_pipe *p, } if (!NT_STATUS_IS_OK(status)) { - DEBUG(0,("Failed to bind to uuid %s - %s\n", table->uuid, nt_errstr(status))); + char *uuid_str = GUID_string(p, &table->uuid); + DEBUG(0,("Failed to bind to uuid %s - %s\n", uuid_str, nt_errstr(status))); + talloc_free(uuid_str); } talloc_free(tmp_ctx); return status; @@ -1119,7 +1117,8 @@ NTSTATUS dcerpc_pipe_connect_b(TALLOC_CTX *parent_ctx, p->conn->event_ctx); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("Failed to map DCERPC endpoint for '%s' - %s\n", - table->uuid, nt_errstr(status))); + GUID_string(tmp_ctx, &table->uuid), nt_errstr(status))); + talloc_free(tmp_ctx); return status; } DEBUG(2,("Mapped to DCERPC endpoint %s\n", binding->endpoint)); @@ -1338,11 +1337,7 @@ NTSTATUS dcerpc_secondary_context(struct dcerpc_pipe *p, p2->context_id = ++p->conn->next_context_id; - status = GUID_from_string(table->uuid, &p2->syntax.uuid); - if (!NT_STATUS_IS_OK(status)) { - talloc_free(p2); - return status; - } + p2->syntax.uuid = table->uuid; p2->syntax.if_version = table->if_version; status = GUID_from_string(NDR_GUID, &p2->transfer_syntax.uuid); diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm index bb9d32487a4..2247fcbf81e 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm @@ -9,7 +9,7 @@ package Parse::Pidl::Samba4::NDR::Parser; use strict; use Parse::Pidl::Typelist qw(hasType getType mapType); -use Parse::Pidl::Util qw(has_property ParseExpr); +use Parse::Pidl::Util qw(has_property ParseExpr print_uuid); use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred); use vars qw($VERSION); @@ -2218,7 +2218,7 @@ sub FunctionTable($) pidl "\nconst struct dcerpc_interface_table dcerpc_table_$interface->{NAME} = {"; pidl "\t.name\t\t= \"$interface->{NAME}\","; - pidl "\t.uuid\t\t= DCERPC_$uname\_UUID,"; + pidl "\t.uuid\t\t= ". print_uuid($interface->{UUID}) .","; pidl "\t.if_version\t= DCERPC_$uname\_VERSION,"; pidl "\t.helpstring\t= DCERPC_$uname\_HELPSTRING,"; pidl "\t.num_calls\t= $count,"; diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm index 585209b7330..8710f08cc74 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm @@ -7,6 +7,7 @@ package Parse::Pidl::Samba4::NDR::Server; use strict; +use Parse::Pidl::Util; use vars qw($VERSION); $VERSION = '0.01'; @@ -76,7 +77,7 @@ sub Boilerplate_Iface($) my($interface) = shift; my $name = $interface->{NAME}; my $uname = uc $name; - my $uuid = Parse::Pidl::Util::make_str(lc($interface->{PROPERTIES}->{uuid})); + my $uuid = lc($interface->{PROPERTIES}->{uuid}); my $if_version = $interface->{PROPERTIES}->{version}; pidl " @@ -187,7 +188,7 @@ static NTSTATUS $name\__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_C static const struct dcesrv_interface $name\_interface = { .name = \"$name\", - .uuid = $uuid, + .uuid = ".print_uuid($uuid).", .if_version = $if_version, .bind = $name\__op_bind, .unbind = $name\__op_unbind, @@ -227,10 +228,10 @@ static NTSTATUS $name\__op_init_server(struct dcesrv_context *dce_ctx, const str return NT_STATUS_OK; } -static BOOL $name\__op_interface_by_uuid(struct dcesrv_interface *iface, const char *uuid, uint32_t if_version) +static BOOL $name\__op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *uuid, uint32_t if_version) { if ($name\_interface.if_version == if_version && - strcmp($name\_interface.uuid, uuid)==0) { + GUID_equal(\&$name\_interface.uuid, uuid)) { memcpy(iface,&$name\_interface, sizeof(*iface)); return True; } diff --git a/source4/pidl/lib/Parse/Pidl/Util.pm b/source4/pidl/lib/Parse/Pidl/Util.pm index ec6a1420ab8..ff615a21ba9 100644 --- a/source4/pidl/lib/Parse/Pidl/Util.pm +++ b/source4/pidl/lib/Parse/Pidl/Util.pm @@ -6,7 +6,7 @@ package Parse::Pidl::Util; require Exporter; @ISA = qw(Exporter); -@EXPORT = qw(has_property property_matches ParseExpr is_constant make_str); +@EXPORT = qw(has_property property_matches ParseExpr is_constant make_str print_uuid); use vars qw($VERSION); $VERSION = '0.01'; @@ -75,6 +75,20 @@ sub make_str($) return "\"" . $str . "\""; } +sub print_uuid($) +{ + my ($uuid) = @_; + $uuid =~ s/"//g; + my ($time_low,$time_mid,$time_hi,$clock_seq,$node) = split /-/, $uuid; + + my @clock_seq = $clock_seq =~ /(..)/g; + my @node = $node =~ /(..)/g; + + return "{0x$time_low,0x$time_mid,0x$time_hi," . + "{".join(',', map {"0x$_"} @clock_seq)."}," . + "{".join(',', map {"0x$_"} @node)."}}"; +} + # a hack to build on platforms that don't like negative enum values my $useUintEnums = 0; sub setUseUintEnums($) diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c index a8724b5bb83..facf6bc0af3 100644 --- a/source4/rpc_server/dcerpc_server.c +++ b/source4/rpc_server/dcerpc_server.c @@ -87,15 +87,8 @@ static struct dcesrv_connection_context *dcesrv_find_context(struct dcesrv_conne static BOOL interface_match(const struct dcesrv_interface *if1, const struct dcesrv_interface *if2) { - if (if1->if_version != if2->if_version) { - return False; - } - - if (strcmp(if1->uuid, if2->uuid)==0) { - return True; - } - - return False; + return (if1->if_version == if2->if_version && + GUID_equal(&if1->uuid, &if2->uuid)); } /* @@ -117,24 +110,16 @@ static const struct dcesrv_interface *find_interface(const struct dcesrv_endpoin see if a uuid and if_version match to an interface */ static BOOL interface_match_by_uuid(const struct dcesrv_interface *iface, - const char *uuid, uint32_t if_version) + const struct GUID *uuid, uint32_t if_version) { - if (iface->if_version != if_version) { - return False; - } - - if (strcmp(iface->uuid, uuid)==0) { - return True; - } - - return False; + return (iface->if_version == if_version && GUID_equal(&iface->uuid, uuid)); } /* find the interface operations on an endpoint by uuid */ static const struct dcesrv_interface *find_interface_by_uuid(const struct dcesrv_endpoint *endpoint, - const char *uuid, uint32_t if_version) + const struct GUID *uuid, uint32_t if_version) { struct dcesrv_if_list *ifl; for (ifl=endpoint->interface_list; ifl; ifl=ifl->next) { @@ -462,8 +447,9 @@ static NTSTATUS dcesrv_bind_nak(struct dcesrv_call_state *call, uint32_t reason) */ static NTSTATUS dcesrv_bind(struct dcesrv_call_state *call) { - const char *uuid, *transfer_syntax; + const char *transfer_syntax; uint32_t if_version, transfer_syntax_version; + struct GUID uuid; struct ncacn_packet pkt; struct data_blob_list_item *rep; NTSTATUS status; @@ -484,10 +470,7 @@ static NTSTATUS dcesrv_bind(struct dcesrv_call_state *call) } if_version = call->pkt.u.bind.ctx_list[0].abstract_syntax.if_version; - uuid = GUID_string(call, &call->pkt.u.bind.ctx_list[0].abstract_syntax.uuid); - if (!uuid) { - return dcesrv_bind_nak(call, 0); - } + uuid = call->pkt.u.bind.ctx_list[0].abstract_syntax.uuid; transfer_syntax_version = call->pkt.u.bind.ctx_list[0].transfer_syntaxes[0].if_version; transfer_syntax = GUID_string(call, @@ -500,9 +483,12 @@ static NTSTATUS dcesrv_bind(struct dcesrv_call_state *call) return dcesrv_bind_nak(call, 0); } - iface = find_interface_by_uuid(call->conn->endpoint, uuid, if_version); + iface = find_interface_by_uuid(call->conn->endpoint, &uuid, if_version); if (iface == NULL) { - DEBUG(2,("Request for unknown dcerpc interface %s/%d\n", uuid, if_version)); + char *uuid_str = GUID_string(call, &uuid); + DEBUG(2,("Request for unknown dcerpc interface %s/%d\n", uuid_str, if_version)); + talloc_free(uuid_str); + /* we don't know about that interface */ result = DCERPC_BIND_PROVIDER_REJECT; reason = DCERPC_BIND_REASON_ASYNTAX; @@ -567,8 +553,10 @@ static NTSTATUS dcesrv_bind(struct dcesrv_call_state *call) if (iface) { status = iface->bind(call, iface); if (!NT_STATUS_IS_OK(status)) { + char *uuid_str = GUID_string(call, &uuid); DEBUG(2,("Request for dcerpc interface %s/%d rejected: %s\n", - uuid, if_version, nt_errstr(status))); + uuid_str, if_version, nt_errstr(status))); + talloc_free(uuid_str); return dcesrv_bind_nak(call, 0); } } @@ -617,15 +605,13 @@ static NTSTATUS dcesrv_auth3(struct dcesrv_call_state *call) static NTSTATUS dcesrv_alter_new_context(struct dcesrv_call_state *call, uint32_t context_id) { uint32_t if_version, transfer_syntax_version; - const char *uuid, *transfer_syntax; + const char *transfer_syntax; struct dcesrv_connection_context *context; const struct dcesrv_interface *iface; + struct GUID uuid; if_version = call->pkt.u.alter.ctx_list[0].abstract_syntax.if_version; - uuid = GUID_string(call, &call->pkt.u.alter.ctx_list[0].abstract_syntax.uuid); - if (!uuid) { - return NT_STATUS_NO_MEMORY; - } + uuid = call->pkt.u.alter.ctx_list[0].abstract_syntax.uuid; transfer_syntax_version = call->pkt.u.alter.ctx_list[0].transfer_syntaxes[0].if_version; transfer_syntax = GUID_string(call, @@ -637,9 +623,11 @@ static NTSTATUS dcesrv_alter_new_context(struct dcesrv_call_state *call, uint32_ return NT_STATUS_NO_MEMORY; } - iface = find_interface_by_uuid(call->conn->endpoint, uuid, if_version); + iface = find_interface_by_uuid(call->conn->endpoint, &uuid, if_version); if (iface == NULL) { - DEBUG(2,("Request for unknown dcerpc interface %s/%d\n", uuid, if_version)); + char *uuid_str = GUID_string(call, &uuid); + DEBUG(2,("Request for unknown dcerpc interface %s/%d\n", uuid_str, if_version)); + talloc_free(uuid_str); return NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED; } diff --git a/source4/rpc_server/dcerpc_server.h b/source4/rpc_server/dcerpc_server.h index 9b82b2edcc5..e831b70060f 100644 --- a/source4/rpc_server/dcerpc_server.h +++ b/source4/rpc_server/dcerpc_server.h @@ -37,7 +37,7 @@ struct dcesrv_auth; struct dcesrv_interface { const char *name; - const char *uuid; + struct GUID uuid; uint32_t if_version; /* this function is called when the client binds to this interface */ @@ -192,7 +192,7 @@ struct dcesrv_endpoint_server { * ask for a dcesrv_interface implementation * - iface must be reference to an already existing struct ! */ - BOOL (*interface_by_uuid)(struct dcesrv_interface *iface, const char *, uint32_t); + BOOL (*interface_by_uuid)(struct dcesrv_interface *iface, const struct GUID *, uint32_t); /* this function can be used by other endpoint servers to * ask for a dcesrv_interface implementation diff --git a/source4/rpc_server/epmapper/rpc_epmapper.c b/source4/rpc_server/epmapper/rpc_epmapper.c index d7d447f852f..e7371a632fa 100644 --- a/source4/rpc_server/epmapper/rpc_epmapper.c +++ b/source4/rpc_server/epmapper/rpc_epmapper.c @@ -77,7 +77,7 @@ static uint32_t build_ep_list(TALLOC_CTX *mem_ctx, (*eps)[total].name = iface->iface.name; description = d->ep_description; - GUID_from_string(iface->iface.uuid, &description->object); + description->object = iface->iface.uuid; description->object_version = iface->iface.if_version; status = dcerpc_binding_build_tower(mem_ctx, description, &(*eps)[total].ep); diff --git a/source4/rpc_server/remote/dcesrv_remote.c b/source4/rpc_server/remote/dcesrv_remote.c index b4f45614f13..4cd4b2b507f 100644 --- a/source4/rpc_server/remote/dcesrv_remote.c +++ b/source4/rpc_server/remote/dcesrv_remote.c @@ -57,7 +57,7 @@ static NTSTATUS remote_op_bind(struct dcesrv_call_state *dce_call, const struct pass = lp_parm_string(-1, "dcerpc_remote", "password"); domain = lp_parm_string(-1, "dceprc_remote", "domain"); - table = idl_iface_by_uuid(iface->uuid); /* FIXME: What about if_version ? */ + table = idl_iface_by_uuid(&iface->uuid); /* FIXME: What about if_version ? */ if (!table) { dce_call->fault_code = DCERPC_FAULT_UNK_IF; return NT_STATUS_NET_WRITE_FAULT; @@ -262,13 +262,13 @@ static BOOL remote_fill_interface(struct dcesrv_interface *iface, const struct d return True; } -static BOOL remote_op_interface_by_uuid(struct dcesrv_interface *iface, const char *uuid, uint32_t if_version) +static BOOL remote_op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *uuid, uint32_t if_version) { const struct dcerpc_interface_list *l; for (l=librpc_dcerpc_pipes();l;l=l->next) { if (l->table->if_version == if_version && - strcmp(l->table->uuid, uuid)==0) { + GUID_equal(&l->table->uuid, uuid)==0) { return remote_fill_interface(iface, l->table); } } diff --git a/source4/torture/rpc/bind.c b/source4/torture/rpc/bind.c index d27fbb2b111..55ddec2fd51 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 f7935ce2d75..9774b9681cf 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 72495c248b9..28ac07f6076 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;i<r.out.if_id_vector->count;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 1f612fbaee0..9ed414e2f44 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 { diff --git a/source4/utils/ndrdump.c b/source4/utils/ndrdump.c index 611283ee694..abc6d95fb4d 100644 --- a/source4/utils/ndrdump.c +++ b/source4/utils/ndrdump.c @@ -148,8 +148,13 @@ static char *stdin_load(TALLOC_CTX *mem_ctx, size_t *size) p = idl_iface_by_name(pipe_name); if (!p) { + struct GUID uuid; - p = idl_iface_by_uuid(pipe_name); + status = GUID_from_string(pipe_name, &uuid); + + if (NT_STATUS_IS_OK(status)) { + p = idl_iface_by_uuid(&uuid); + } if (!p) { printf("Unknown pipe or UUID '%s'\n", pipe_name); |