summaryrefslogtreecommitdiffstats
path: root/source4/librpc/rpc
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-02-04 10:03:09 +0100
committerGünther Deschner <gd@samba.org>2014-02-13 11:54:18 +0100
commit79c76ee54d1ad73fa2e92a189da79df5593737ae (patch)
tree3b6c5a8474331331bec79494ef70dbd6c94e2476 /source4/librpc/rpc
parent4afe367c08cbe9574f28fae23133462ba10c57b7 (diff)
downloadsamba-79c76ee54d1ad73fa2e92a189da79df5593737ae.tar.gz
samba-79c76ee54d1ad73fa2e92a189da79df5593737ae.tar.xz
samba-79c76ee54d1ad73fa2e92a189da79df5593737ae.zip
s4:librpc/rpc: use dcerpc_binding_get_string_option() for "host" and "target_hostname"
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
Diffstat (limited to 'source4/librpc/rpc')
-rw-r--r--source4/librpc/rpc/dcerpc_connect.c30
-rw-r--r--source4/librpc/rpc/dcerpc_secondary.c4
2 files changed, 17 insertions, 17 deletions
diff --git a/source4/librpc/rpc/dcerpc_connect.c b/source4/librpc/rpc/dcerpc_connect.c
index a67e376186b..3bd6eafabb2 100644
--- a/source4/librpc/rpc/dcerpc_connect.c
+++ b/source4/librpc/rpc/dcerpc_connect.c
@@ -150,12 +150,13 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb_send(TALLOC_CT
/* prepare smb connection parameters: we're connecting to IPC$ share on
remote rpc server */
- conn->in.dest_host = s->io.binding->host;
- conn->in.dest_ports = lpcfg_smb_ports(lp_ctx);
- if (s->io.binding->target_hostname == NULL)
- conn->in.called_name = "*SMBSERVER"; /* FIXME: This is invalid */
- else
- conn->in.called_name = s->io.binding->target_hostname;
+ conn->in.dest_host = dcerpc_binding_get_string_option(s->io.binding, "host");
+ conn->in.dest_ports = lpcfg_smb_ports(lp_ctx);
+ conn->in.called_name =
+ dcerpc_binding_get_string_option(s->io.binding, "target_hostname");
+ if (conn->in.called_name == NULL) {
+ conn->in.called_name = "*SMBSERVER";
+ }
conn->in.socket_options = lpcfg_socket_options(lp_ctx);
conn->in.service = "IPC$";
conn->in.service_type = NULL;
@@ -294,6 +295,7 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb2_send(
struct pipe_np_smb2_state *s;
struct tevent_req *subreq;
struct smbcli_options options;
+ const char *host;
uint32_t flags;
/* composite context allocation and setup */
@@ -306,6 +308,7 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb2_send(
s->io = *io;
+ host = dcerpc_binding_get_string_option(s->io.binding, "host");
flags = dcerpc_binding_get_flags(s->io.binding);
/*
@@ -321,7 +324,7 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb2_send(
/* send smb2 connect request */
subreq = smb2_connect_send(s, c->event_ctx,
- s->io.binding->host,
+ host,
lpcfg_parm_string_list(mem_ctx, lp_ctx, NULL, "smb2", "ports", NULL),
"IPC$",
s->io.resolve_ctx,
@@ -394,17 +397,12 @@ static struct composite_context* dcerpc_pipe_connect_ncacn_ip_tcp_send(TALLOC_CT
c->private_data = s;
/* store input parameters in state structure */
- s->io = *io;
+ s->io = *io;
s->localaddr = dcerpc_binding_get_string_option(io->binding,
"localaddress");
- if (io->binding->host != NULL) {
- s->host = talloc_strdup(s, io->binding->host);
- if (composite_nomem(s->host, c)) return c;
- }
- if (io->binding->target_hostname != NULL) {
- s->target_hostname = talloc_strdup(s, io->binding->target_hostname);
- if (composite_nomem(s->target_hostname, c)) return c;
- }
+ s->host = dcerpc_binding_get_string_option(io->binding, "host");
+ s->target_hostname = dcerpc_binding_get_string_option(io->binding,
+ "target_hostname");
endpoint = dcerpc_binding_get_string_option(io->binding, "endpoint");
/* port number is a binding endpoint here */
if (endpoint != NULL) {
diff --git a/source4/librpc/rpc/dcerpc_secondary.c b/source4/librpc/rpc/dcerpc_secondary.c
index 68746b6dfe2..b8512e21534 100644
--- a/source4/librpc/rpc/dcerpc_secondary.c
+++ b/source4/librpc/rpc/dcerpc_secondary.c
@@ -60,6 +60,7 @@ _PUBLIC_ struct composite_context* dcerpc_secondary_connection_send(struct dcerp
struct composite_context *pipe_smb_req;
struct composite_context *pipe_tcp_req;
struct composite_context *pipe_ncalrpc_req;
+ const char *target_hostname;
const char *endpoint;
/* composite context allocation and setup */
@@ -80,6 +81,7 @@ _PUBLIC_ struct composite_context* dcerpc_secondary_connection_send(struct dcerp
if (DEBUGLEVEL >= 10)
s->pipe2->conn->packet_log_dir = s->pipe->conn->packet_log_dir;
+ target_hostname = dcerpc_binding_get_string_option(s->binding, "target_hostname");
endpoint = dcerpc_binding_get_string_option(s->binding, "endpoint");
if (endpoint == NULL) {
/*
@@ -114,7 +116,7 @@ _PUBLIC_ struct composite_context* dcerpc_secondary_connection_send(struct dcerp
pipe_tcp_req = dcerpc_pipe_open_tcp_send(s->pipe2->conn,
s->localaddress,
s->peer_addr->addr,
- s->binding->target_hostname,
+ target_hostname,
atoi(endpoint),
resolve_context_init(s));
composite_continue(c, pipe_tcp_req, continue_open_tcp, c);