diff options
author | Stefan Metzmacher <metze@samba.org> | 2014-01-30 09:09:04 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2014-02-13 11:54:15 +0100 |
commit | c11224225d70919b76b16770777cb622ca1f29da (patch) | |
tree | cec58f3f75bd5d2cbd53d228da1e535fa0ae4533 /librpc/rpc | |
parent | df4a900aa60f5be22f3ea157bfdaf6427251299f (diff) | |
download | samba-c11224225d70919b76b16770777cb622ca1f29da.tar.gz |
librpc/rpc: use dcerpc_binding_get_*() in dcerpc_default_transport_endpoint()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Diffstat (limited to 'librpc/rpc')
-rw-r--r-- | librpc/rpc/dcerpc_util.c | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/librpc/rpc/dcerpc_util.c b/librpc/rpc/dcerpc_util.c index 56eff034b37..792848fbd91 100644 --- a/librpc/rpc/dcerpc_util.c +++ b/librpc/rpc/dcerpc_util.c @@ -354,24 +354,37 @@ const char *dcerpc_default_transport_endpoint(TALLOC_CTX *mem_ctx, /* Find one of the default pipes for this interface */ for (i = 0; i < table->endpoints->count; i++) { + enum dcerpc_transport_t dtransport; + const char *dendpoint; status = dcerpc_parse_binding(frame, table->endpoints->names[i], &default_binding); - if (NT_STATUS_IS_OK(status)) { - if (transport == NCA_UNKNOWN && - default_binding->endpoint != NULL) { - p = default_binding->endpoint; - break; - } - if (default_binding->transport == transport && - default_binding->endpoint != NULL) { - p = default_binding->endpoint; - break; - } + if (!NT_STATUS_IS_OK(status)) { + continue; + } + + dtransport = dcerpc_binding_get_transport(default_binding); + dendpoint = dcerpc_binding_get_string_option(default_binding, + "endpoint"); + if (dendpoint == NULL) { + TALLOC_FREE(default_binding); + continue; } + + if (transport == NCA_UNKNOWN) { + transport = dtransport; + } + + if (transport != dtransport) { + TALLOC_FREE(default_binding); + continue; + } + + p = dendpoint; + break; } - if (i == table->endpoints->count || p == NULL) { + if (p == NULL) { goto done; } @@ -379,7 +392,7 @@ const char *dcerpc_default_transport_endpoint(TALLOC_CTX *mem_ctx, * extract the pipe name without \\pipe from for example * ncacn_np:[\\pipe\\epmapper] */ - if (default_binding->transport == NCACN_NP) { + if (transport == NCACN_NP) { if (strncasecmp(p, "\\pipe\\", 6) == 0) { p += 6; } |