summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/librpc/rpc/dcerpc_connect.c24
-rw-r--r--source4/librpc/rpc/dcerpc_sock.c9
-rw-r--r--source4/librpc/rpc/dcerpc_util.c3
3 files changed, 21 insertions, 15 deletions
diff --git a/source4/librpc/rpc/dcerpc_connect.c b/source4/librpc/rpc/dcerpc_connect.c
index 63fd25dd1a..c0f61e0141 100644
--- a/source4/librpc/rpc/dcerpc_connect.c
+++ b/source4/librpc/rpc/dcerpc_connect.c
@@ -89,8 +89,7 @@ static void continue_smb_connect(struct composite_context *ctx)
Initiate async open of a rpc connection to a rpc pipe on SMB using
the binding structure to determine the endpoint and options
*/
-static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb_send(TALLOC_CTX *mem_ctx,
- struct dcerpc_pipe_connect *io)
+static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb_send(TALLOC_CTX *mem_ctx, struct dcerpc_pipe_connect *io, struct loadparm_context *lp_ctx)
{
struct composite_context *c;
struct pipe_np_smb_state *s;
@@ -111,14 +110,14 @@ 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 = lp_smb_ports(global_loadparm);
+ conn->in.dest_ports = lp_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.service = "IPC$";
conn->in.service_type = NULL;
- conn->in.workgroup = lp_workgroup(global_loadparm);
+ conn->in.workgroup = lp_workgroup(lp_ctx);
/*
* provide proper credentials - user supplied, but allow a
@@ -208,7 +207,8 @@ static void continue_smb2_connect(struct composite_context *ctx)
*/
static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb2_send(
TALLOC_CTX *mem_ctx,
- struct dcerpc_pipe_connect *io)
+ struct dcerpc_pipe_connect *io,
+ struct loadparm_context *lp_ctx)
{
struct composite_context *c;
struct pipe_np_smb2_state *s;
@@ -232,7 +232,7 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb2_send(
s->io.creds = cli_credentials_init(mem_ctx);
if (composite_nomem(s->io.creds, c)) return c;
- cli_credentials_guess(s->io.creds, global_loadparm);
+ cli_credentials_guess(s->io.creds, lp_ctx);
}
/* send smb2 connect request */
@@ -427,7 +427,7 @@ static void continue_pipe_open_ncalrpc(struct composite_context *ctx)
the binding structure to determine the endpoint and options
*/
static struct composite_context* dcerpc_pipe_connect_ncalrpc_send(TALLOC_CTX *mem_ctx,
- struct dcerpc_pipe_connect *io)
+ struct dcerpc_pipe_connect *io, struct loadparm_context *lp_ctx)
{
struct composite_context *c;
struct pipe_ncalrpc_state *s;
@@ -445,7 +445,7 @@ static struct composite_context* dcerpc_pipe_connect_ncalrpc_send(TALLOC_CTX *me
s->io = *io;
/* send pipe open request */
- pipe_req = dcerpc_pipe_open_pipe_send(s->io.pipe->conn, lp_ncalrpc_dir(global_loadparm),
+ pipe_req = dcerpc_pipe_open_pipe_send(s->io.pipe->conn, lp_ncalrpc_dir(lp_ctx),
s->io.binding->endpoint);
composite_continue(c, pipe_req, continue_pipe_open_ncalrpc, c);
return c;
@@ -522,20 +522,20 @@ static void continue_connect(struct composite_context *c, struct pipe_connect_st
pc.binding = s->binding;
pc.interface = s->table;
pc.creds = s->credentials;
- pc.resolve_ctx = lp_resolve_context(global_loadparm);
+ pc.resolve_ctx = lp_resolve_context(s->lp_ctx);
/* connect dcerpc pipe depending on required transport */
switch (s->binding->transport) {
case NCACN_NP:
if (pc.binding->flags & DCERPC_SMB2) {
/* new varient of SMB a.k.a. SMB2 */
- ncacn_np_smb2_req = dcerpc_pipe_connect_ncacn_np_smb2_send(c, &pc);
+ ncacn_np_smb2_req = dcerpc_pipe_connect_ncacn_np_smb2_send(c, &pc, s->lp_ctx);
composite_continue(c, ncacn_np_smb2_req, continue_pipe_connect_ncacn_np_smb2, c);
return;
} else {
/* good old ordinary SMB */
- ncacn_np_smb_req = dcerpc_pipe_connect_ncacn_np_smb_send(c, &pc);
+ ncacn_np_smb_req = dcerpc_pipe_connect_ncacn_np_smb_send(c, &pc, s->lp_ctx);
composite_continue(c, ncacn_np_smb_req, continue_pipe_connect_ncacn_np_smb, c);
return;
}
@@ -552,7 +552,7 @@ static void continue_connect(struct composite_context *c, struct pipe_connect_st
return;
case NCALRPC:
- ncalrpc_req = dcerpc_pipe_connect_ncalrpc_send(c, &pc);
+ ncalrpc_req = dcerpc_pipe_connect_ncalrpc_send(c, &pc, s->lp_ctx);
composite_continue(c, ncalrpc_req, continue_pipe_connect_ncalrpc, c);
return;
diff --git a/source4/librpc/rpc/dcerpc_sock.c b/source4/librpc/rpc/dcerpc_sock.c
index 2e5a8388a1..76389f0d74 100644
--- a/source4/librpc/rpc/dcerpc_sock.c
+++ b/source4/librpc/rpc/dcerpc_sock.c
@@ -303,6 +303,7 @@ 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,
enum dcerpc_transport_t transport)
@@ -333,7 +334,7 @@ static struct composite_context *dcerpc_pipe_open_socket_send(TALLOC_CTX *mem_ct
talloc_steal(s->sock, s->socket_ctx);
conn_req = socket_connect_send(s->socket_ctx, NULL, s->server, 0,
- lp_resolve_context(global_loadparm),
+ resolve_context,
c->event_ctx);
composite_continue(c, conn_req, continue_socket_connect, c);
return c;
@@ -354,6 +355,7 @@ struct pipe_tcp_state {
const char *address;
uint32_t port;
struct socket_address *srvaddr;
+ struct resolve_context *resolve_ctx;
struct dcerpc_connection *conn;
};
@@ -381,6 +383,7 @@ 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,
NCACN_IP_TCP);
composite_continue(c, sock_ipv4_req, continue_ipv4_open_socket, c);
@@ -479,6 +482,7 @@ struct composite_context* dcerpc_pipe_open_tcp_send(struct dcerpc_connection *co
}
s->port = port;
s->conn = conn;
+ s->resolve_ctx = resolve_ctx;
make_nbt_name_server(&name, server);
resolve_req = resolve_name_send(resolve_ctx, &name, c->event_ctx);
@@ -554,6 +558,7 @@ 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,
NCALRPC);
composite_continue(c, sock_unix_req, continue_unix_open_socket, c);
@@ -630,7 +635,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, s->srvaddr, NULL, NCALRPC);
+ sock_np_req = dcerpc_pipe_open_socket_send(c, s->conn, NULL, s->srvaddr, NULL, NCALRPC);
composite_continue(c, sock_np_req, continue_np_open_socket, c);
return c;
}
diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c
index ecc6f19e8c..4e5d049d66 100644
--- a/source4/librpc/rpc/dcerpc_util.c
+++ b/source4/librpc/rpc/dcerpc_util.c
@@ -1368,7 +1368,8 @@ NTSTATUS dcerpc_fetch_session_key(struct dcerpc_pipe *p,
this triggers on a debug level of >= 10
*/
void dcerpc_log_packet(const struct ndr_interface_table *ndr,
- uint32_t opnum, uint32_t flags, DATA_BLOB *pkt)
+ uint32_t opnum, uint32_t flags,
+ DATA_BLOB *pkt)
{
const int num_examples = 20;
int i;