summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/librpc/rpc/dcerpc_secondary.c13
-rw-r--r--source4/librpc/rpc/dcerpc_sock.c15
2 files changed, 15 insertions, 13 deletions
diff --git a/source4/librpc/rpc/dcerpc_secondary.c b/source4/librpc/rpc/dcerpc_secondary.c
index 8ac235c67c..1d76c65f40 100644
--- a/source4/librpc/rpc/dcerpc_secondary.c
+++ b/source4/librpc/rpc/dcerpc_secondary.c
@@ -31,13 +31,14 @@
#include "auth/credentials/credentials.h"
#include "param/param.h"
#include "libcli/resolve/resolve.h"
-
+#include "lib/socket/socket.h"
struct sec_conn_state {
struct dcerpc_pipe *pipe;
struct dcerpc_pipe *pipe2;
struct dcerpc_binding *binding;
struct smbcli_tree *tree;
+ struct socket_address *peer_addr;
};
@@ -94,11 +95,17 @@ _PUBLIC_ struct composite_context* dcerpc_secondary_connection_send(struct dcerp
return c;
case NCACN_IP_TCP:
+ s->peer_addr = dcerpc_socket_peer_addr(s->pipe->conn, s);
+ if (!s->peer_addr) {
+ composite_error(c, NT_STATUS_INVALID_PARAMETER);
+ return c;
+ }
+
pipe_tcp_req = dcerpc_pipe_open_tcp_send(s->pipe2->conn,
- s->binding->host,
+ s->peer_addr->addr,
s->binding->target_hostname,
atoi(s->binding->endpoint),
- dcerpc_resolve_ctx(s->pipe->conn));
+ resolve_context_init(s));
composite_continue(c, pipe_tcp_req, continue_open_tcp, c);
return c;
diff --git a/source4/librpc/rpc/dcerpc_sock.c b/source4/librpc/rpc/dcerpc_sock.c
index 548f270cc0..f0b542dae1 100644
--- a/source4/librpc/rpc/dcerpc_sock.c
+++ b/source4/librpc/rpc/dcerpc_sock.c
@@ -39,7 +39,6 @@ struct sock_private {
struct packet_context *packet;
uint32_t pending_reads;
- struct resolve_context *resolve_ctx;
const char *path; /* For ncacn_unix_sock and ncalrpc */
};
@@ -306,7 +305,6 @@ static void continue_socket_connect(struct composite_context *ctx)
static struct composite_context *dcerpc_pipe_open_socket_send(TALLOC_CTX *mem_ctx,
struct dcerpc_connection *cn,
- struct resolve_context *resolve_context,
struct socket_address *server,
const char *target_hostname,
const char *full_path,
@@ -337,12 +335,10 @@ static struct composite_context *dcerpc_pipe_open_socket_send(TALLOC_CTX *mem_ct
talloc_steal(s->sock, s->socket_ctx);
- s->sock->resolve_ctx = resolve_context;
s->sock->path = talloc_reference(s->sock, full_path);
conn_req = socket_connect_send(s->socket_ctx, NULL, s->server, 0,
- resolve_context,
- c->event_ctx);
+ NULL, c->event_ctx);
composite_continue(c, conn_req, continue_socket_connect, c);
return c;
}
@@ -390,7 +386,6 @@ static void continue_ip_resolve_name(struct composite_context *ctx)
/* resolve_nbt_name gives only ipv4 ... - send socket open request */
sock_ipv4_req = dcerpc_pipe_open_socket_send(c, s->conn,
- s->resolve_ctx,
s->srvaddr, s->target_hostname,
NULL,
NCACN_IP_TCP);
@@ -566,7 +561,6 @@ struct composite_context *dcerpc_pipe_open_unix_stream_send(struct dcerpc_connec
/* send socket open request */
sock_unix_req = dcerpc_pipe_open_socket_send(c, s->conn,
- NULL,
s->srvaddr, NULL,
s->path,
NCALRPC);
@@ -637,7 +631,7 @@ struct composite_context* dcerpc_pipe_open_pipe_send(struct dcerpc_connection *c
if (composite_nomem(s->srvaddr, c)) return c;
/* send socket open request */
- sock_np_req = dcerpc_pipe_open_socket_send(c, s->conn, NULL, s->srvaddr, NULL, s->path, NCALRPC);
+ sock_np_req = dcerpc_pipe_open_socket_send(c, s->conn, s->srvaddr, NULL, s->path, NCALRPC);
composite_continue(c, sock_np_req, continue_np_open_socket, c);
return c;
}
@@ -670,8 +664,9 @@ const char *dcerpc_unix_socket_path(struct dcerpc_connection *p)
return sock->path;
}
-struct resolve_context *dcerpc_resolve_ctx(struct dcerpc_connection *p)
+struct socket_address *dcerpc_socket_peer_addr(struct dcerpc_connection *p, TALLOC_CTX *mem_ctx)
{
struct sock_private *sock = (struct sock_private *)p->transport.private_data;
- return sock->resolve_ctx;
+ return socket_get_peer_addr(sock->sock, mem_ctx);
}
+