summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-01-30 09:26:26 +0100
committerGünther Deschner <gd@samba.org>2014-02-13 11:54:16 +0100
commita1e013505c0e8be8b1fb45dc59b2d4a1af450bce (patch)
tree9868c421bf93fdd78a03ed56205b2156531d07c9
parent00073465df86210ba5f08a05d0cb1096595ae7e1 (diff)
downloadsamba-a1e013505c0e8be8b1fb45dc59b2d4a1af450bce.tar.gz
samba-a1e013505c0e8be8b1fb45dc59b2d4a1af450bce.tar.xz
samba-a1e013505c0e8be8b1fb45dc59b2d4a1af450bce.zip
s3:rpc_client: avoid using dcerpc_binding internals in rpc_pipe_get_tcp_port()
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
-rw-r--r--source3/rpc_client/cli_pipe.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index 39ddb2e8b15..0def81727a6 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -2531,6 +2531,8 @@ static NTSTATUS rpc_pipe_get_tcp_port(const char *host,
struct pipe_auth_data *auth = NULL;
struct dcerpc_binding *map_binding = NULL;
struct dcerpc_binding *res_binding = NULL;
+ enum dcerpc_transport_t transport;
+ const char *endpoint = NULL;
struct epm_twr_t *map_tower = NULL;
struct epm_twr_t *res_towers = NULL;
struct policy_handle *entry_handle = NULL;
@@ -2574,16 +2576,17 @@ static NTSTATUS rpc_pipe_get_tcp_port(const char *host,
/* create tower for asking the epmapper */
- map_binding = talloc_zero(tmp_ctx, struct dcerpc_binding);
- if (map_binding == NULL) {
- status = NT_STATUS_NO_MEMORY;
+ status = dcerpc_parse_binding(tmp_ctx, "ncacn_ip_tcp:[135]",
+ &map_binding);
+ if (!NT_STATUS_IS_OK(status)) {
goto done;
}
- map_binding->transport = NCACN_IP_TCP;
- map_binding->object = table->syntax_id;
- map_binding->host = NULL;
- map_binding->endpoint = "135";
+ status = dcerpc_binding_set_abstract_syntax(map_binding,
+ &table->syntax_id);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto done;
+ }
map_tower = talloc_zero(tmp_ctx, struct epm_twr_t);
if (map_tower == NULL) {
@@ -2648,13 +2651,21 @@ static NTSTATUS rpc_pipe_get_tcp_port(const char *host,
goto done;
}
+ transport = dcerpc_binding_get_transport(res_binding);
+ endpoint = dcerpc_binding_get_string_option(res_binding, "endpoint");
+
/* are further checks here necessary? */
- if (res_binding->transport != NCACN_IP_TCP) {
- status = NT_STATUS_UNSUCCESSFUL;
+ if (transport != NCACN_IP_TCP) {
+ status = NT_STATUS_INVALID_NETWORK_RESPONSE;
+ goto done;
+ }
+
+ if (endpoint == NULL) {
+ status = NT_STATUS_INVALID_NETWORK_RESPONSE;
goto done;
}
- *pport = (uint16_t)atoi(res_binding->endpoint);
+ *pport = (uint16_t)atoi(endpoint);
done:
TALLOC_FREE(tmp_ctx);