summaryrefslogtreecommitdiffstats
path: root/source4
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-01-16 15:39:55 +0100
committerGünther Deschner <gd@samba.org>2014-02-13 11:54:14 +0100
commit91a367dce533929357e27d45d8b58f0f0620772e (patch)
treea1d925be25942fcdc9633ad28525ab8eae6f3eef /source4
parente4b246a968c66c00643a3689c35f86bbf80dc7ec (diff)
downloadsamba-91a367dce533929357e27d45d8b58f0f0620772e.tar.gz
samba-91a367dce533929357e27d45d8b58f0f0620772e.tar.xz
samba-91a367dce533929357e27d45d8b58f0f0620772e.zip
s4:librpc/rpc: use dcerpc_binding_[g|set]_string_option("localaddress")
We should avoid deferencing struct dcerpc_binding if possible. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
Diffstat (limited to 'source4')
-rw-r--r--source4/librpc/rpc/dcerpc_connect.c6
-rw-r--r--source4/librpc/rpc/dcerpc_secondary.c6
-rw-r--r--source4/librpc/rpc/dcerpc_util.c8
3 files changed, 15 insertions, 5 deletions
diff --git a/source4/librpc/rpc/dcerpc_connect.c b/source4/librpc/rpc/dcerpc_connect.c
index f398312361..00a60c8d3d 100644
--- a/source4/librpc/rpc/dcerpc_connect.c
+++ b/source4/librpc/rpc/dcerpc_connect.c
@@ -383,10 +383,8 @@ static struct composite_context* dcerpc_pipe_connect_ncacn_ip_tcp_send(TALLOC_CT
/* store input parameters in state structure */
s->io = *io;
- if (io->binding->localaddress != NULL) {
- s->localaddr = talloc_strdup(s, io->binding->localaddress);
- if (composite_nomem(s->localaddr, c)) return c;
- }
+ 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;
diff --git a/source4/librpc/rpc/dcerpc_secondary.c b/source4/librpc/rpc/dcerpc_secondary.c
index 6f28a2a91b..89a4df86f9 100644
--- a/source4/librpc/rpc/dcerpc_secondary.c
+++ b/source4/librpc/rpc/dcerpc_secondary.c
@@ -38,6 +38,7 @@ struct sec_conn_state {
struct dcerpc_pipe *pipe2;
struct dcerpc_binding *binding;
struct socket_address *peer_addr;
+ const char *localaddress;
};
@@ -93,8 +94,11 @@ _PUBLIC_ struct composite_context* dcerpc_secondary_connection_send(struct dcerp
return c;
}
+ s->localaddress = dcerpc_binding_get_string_option(s->binding,
+ "localaddress");
+
pipe_tcp_req = dcerpc_pipe_open_tcp_send(s->pipe2->conn,
- s->binding->localaddress,
+ s->localaddress,
s->peer_addr->addr,
s->binding->target_hostname,
atoi(s->binding->endpoint),
diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c
index 77dfc40d79..70b73cdd27 100644
--- a/source4/librpc/rpc/dcerpc_util.c
+++ b/source4/librpc/rpc/dcerpc_util.c
@@ -225,6 +225,7 @@ struct composite_context *dcerpc_epm_map_binding_send(TALLOC_CTX *mem_ctx,
struct epm_map_binding_state *s;
struct composite_context *pipe_connect_req;
struct cli_credentials *anon_creds;
+ const char *localaddress;
NTSTATUS status;
struct dcerpc_binding *epmapper_binding;
@@ -295,6 +296,13 @@ struct composite_context *dcerpc_epm_map_binding_send(TALLOC_CTX *mem_ctx,
/* basic endpoint mapping data */
epmapper_binding->options = NULL;
+ localaddress = dcerpc_binding_get_string_option(binding, "localaddress");
+ if (localaddress != NULL) {
+ c->status = dcerpc_binding_set_string_option(epmapper_binding,
+ "localaddress",
+ localaddress);
+ if (!composite_is_ok(c)) return c;
+ }
epmapper_binding->flags = 0;
epmapper_binding->assoc_group_id = 0;
epmapper_binding->endpoint = NULL;