This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
s->io.pipe_name = s->io.binding->endpoint;
/* send named pipe open request */
- open_ctx = dcerpc_pipe_open_smb_send(s->io.pipe->conn, s->tree, s->io.pipe_name);
+ open_ctx = dcerpc_pipe_open_smb_send(s->io.pipe, s->tree, s->io.pipe_name);
if (composite_nomem(open_ctx, c)) return;
composite_continue(c, open_ctx, continue_pipe_open_smb, c);
Initiate async open of a rpc connection to a rpc pipe on SMB using
the binding structure to determine the endpoint and options
*/
-struct composite_context *dcerpc_pipe_connect_ncacn_np_smb_send(TALLOC_CTX *mem_ctx,
+static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb_send(TALLOC_CTX *mem_ctx,
struct dcerpc_pipe_connect *io)
{
struct composite_context *c;
remote rpc server */
conn->in.dest_host = s->io.binding->host;
conn->in.port = 0;
- conn->in.called_name = strupper_talloc(mem_ctx, s->io.binding->host);
+ conn->in.called_name = s->io.binding->target_hostname;
conn->in.service = "IPC$";
conn->in.service_type = NULL;
conn->in.workgroup = lp_workgroup();
- /* verify if called_name has been allocated when uppercasing */
- if (composite_nomem(conn->in.called_name, c)) return c;
-
/*
* provide proper credentials - user supplied, but allow a
* fallback to anonymous if this is an schannel connection
/*
Receive result of a rpc connection to a rpc pipe on SMB
*/
-NTSTATUS dcerpc_pipe_connect_ncacn_np_smb_recv(struct composite_context *c)
+static NTSTATUS dcerpc_pipe_connect_ncacn_np_smb_recv(struct composite_context *c)
{
NTSTATUS status = composite_wait(c);
}
-/*
- Sync version of a rpc connection to a rpc pipe on SMB
-*/
-NTSTATUS dcerpc_pipe_connect_ncacn_np_smb(TALLOC_CTX *mem_ctx,
- struct dcerpc_pipe_connect *io)
-{
- struct composite_context *c;
- c = dcerpc_pipe_connect_ncacn_np_smb_send(mem_ctx, io);
- return dcerpc_pipe_connect_ncacn_np_smb_recv(c);
-}
-
-
struct pipe_np_smb2_state {
struct smb2_tree *tree;
struct dcerpc_pipe_connect io;
s->io.pipe_name = s->io.binding->endpoint;
/* send named pipe open request */
- open_req = dcerpc_pipe_open_smb2_send(s->io.pipe->conn, s->tree, s->io.pipe_name);
+ open_req = dcerpc_pipe_open_smb2_send(s->io.pipe, s->tree, s->io.pipe_name);
if (composite_nomem(open_req, c)) return;
composite_continue(c, open_req, continue_pipe_open_smb2, c);
Initiate async open of a rpc connection request on SMB2 using
the binding structure to determine the endpoint and options
*/
-struct composite_context *dcerpc_pipe_connect_ncacn_np_smb2_send(TALLOC_CTX *mem_ctx,
- struct dcerpc_pipe_connect *io)
+static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb2_send(TALLOC_CTX *mem_ctx,
+ struct dcerpc_pipe_connect *io)
{
struct composite_context *c;
struct pipe_np_smb2_state *s;
/*
Receive result of a rpc connection to a rpc pipe on SMB2
*/
-NTSTATUS dcerpc_pipe_connect_ncacn_np_smb2_recv(struct composite_context *c)
+static NTSTATUS dcerpc_pipe_connect_ncacn_np_smb2_recv(struct composite_context *c)
{
NTSTATUS status = composite_wait(c);
}
-/*
- Sync version of a rpc connection to a rpc pipe on SMB2
-*/
-NTSTATUS dcerpc_pipe_connect_ncacn_np_smb2(TALLOC_CTX *mem_ctx,
- struct dcerpc_pipe_connect *io)
-{
- struct composite_context *c;
- c = dcerpc_pipe_connect_ncacn_np_smb2_send(mem_ctx, io);
- return dcerpc_pipe_connect_ncacn_np_smb2_recv(c);
-}
-
-
struct pipe_ip_tcp_state {
struct dcerpc_pipe_connect io;
const char *host;
+ const char *target_hostname;
uint32_t port;
};
Initiate async open of a rpc connection to a rpc pipe on TCP/IP using
the binding structure to determine the endpoint and options
*/
-struct composite_context* dcerpc_pipe_connect_ncacn_ip_tcp_send(TALLOC_CTX *mem_ctx,
- struct dcerpc_pipe_connect *io)
+static struct composite_context* dcerpc_pipe_connect_ncacn_ip_tcp_send(TALLOC_CTX *mem_ctx,
+ struct dcerpc_pipe_connect *io)
{
struct composite_context *c;
struct pipe_ip_tcp_state *s;
c->private_data = s;
/* store input parameters in state structure */
- s->io = *io;
- s->host = talloc_strdup(c, io->binding->host);
- s->port = atoi(io->binding->endpoint); /* port number is a binding endpoint here */
+ s->io = *io;
+ s->host = talloc_reference(c, io->binding->host);
+ s->target_hostname = talloc_reference(c, io->binding->target_hostname);
+ /* port number is a binding endpoint here */
+ s->port = atoi(io->binding->endpoint);
/* send pipe open request on tcp/ip */
- pipe_req = dcerpc_pipe_open_tcp_send(s->io.pipe->conn, s->host, s->port);
+ pipe_req = dcerpc_pipe_open_tcp_send(s->io.pipe->conn, s->host, s->target_hostname,
+ s->port);
composite_continue(c, pipe_req, continue_pipe_open_ncacn_ip_tcp, c);
return c;
}
/*
Receive result of a rpc connection to a rpc pipe on TCP/IP
*/
-NTSTATUS dcerpc_pipe_connect_ncacn_ip_tcp_recv(struct composite_context *c)
+static NTSTATUS dcerpc_pipe_connect_ncacn_ip_tcp_recv(struct composite_context *c)
{
NTSTATUS status = composite_wait(c);
}
-/*
- Sync version of rpc connection to a rpc pipe on TCP/IP
-*/
-NTSTATUS dcerpc_pipe_connect_ncacn_ip_tcp(TALLOC_CTX *mem_ctx,
- struct dcerpc_pipe_connect *io)
-{
- struct composite_context *c;
- c = dcerpc_pipe_connect_ncacn_ip_tcp_send(mem_ctx, io);
- return dcerpc_pipe_connect_ncacn_ip_tcp_recv(c);
-}
-
-
struct pipe_unix_state {
struct dcerpc_pipe_connect io;
const char *path;
Initiate async open of a rpc connection to a rpc pipe on unix socket using
the binding structure to determine the endpoint and options
*/
-struct composite_context* dcerpc_pipe_connect_ncacn_unix_stream_send(TALLOC_CTX *mem_ctx,
- struct dcerpc_pipe_connect *io)
+static struct composite_context* dcerpc_pipe_connect_ncacn_unix_stream_send(TALLOC_CTX *mem_ctx,
+ struct dcerpc_pipe_connect *io)
{
struct composite_context *c;
struct pipe_unix_state *s;
/*
Receive result of a rpc connection to a pipe on unix socket
*/
-NTSTATUS dcerpc_pipe_connect_ncacn_unix_stream_recv(struct composite_context *c)
+static NTSTATUS dcerpc_pipe_connect_ncacn_unix_stream_recv(struct composite_context *c)
{
NTSTATUS status = composite_wait(c);
}
-/*
- Sync version of a rpc connection to a rpc pipe on unix socket
-*/
-NTSTATUS dcerpc_pipe_connect_ncacn_unix_stream(TALLOC_CTX *mem_ctx,
- struct dcerpc_pipe_connect *io)
-{
- struct composite_context *c;
- c = dcerpc_pipe_connect_ncacn_unix_stream_send(mem_ctx, io);
- return dcerpc_pipe_connect_ncacn_unix_stream_recv(c);
-}
-
-
struct pipe_ncalrpc_state {
struct dcerpc_pipe_connect io;
};
+static NTSTATUS dcerpc_pipe_connect_ncalrpc_recv(struct composite_context *c);
/*
Stage 2 of ncalrpc: rpc pipe opened (or not)
Initiate async open of a rpc connection request on NCALRPC using
the binding structure to determine the endpoint and options
*/
-struct composite_context* dcerpc_pipe_connect_ncalrpc_send(TALLOC_CTX *mem_ctx,
- struct dcerpc_pipe_connect *io)
+static struct composite_context* dcerpc_pipe_connect_ncalrpc_send(TALLOC_CTX *mem_ctx,
+ struct dcerpc_pipe_connect *io)
{
struct composite_context *c;
struct pipe_ncalrpc_state *s;
/*
Receive result of a rpc connection to a rpc pipe on NCALRPC
*/
-NTSTATUS dcerpc_pipe_connect_ncalrpc_recv(struct composite_context *c)
+static NTSTATUS dcerpc_pipe_connect_ncalrpc_recv(struct composite_context *c)
{
NTSTATUS status = composite_wait(c);
}
-/*
- Sync version of a rpc connection to a rpc pipe on NCALRPC
-*/
-NTSTATUS dcerpc_pipe_connect_ncalrpc(TALLOC_CTX *mem_ctx,
- struct dcerpc_pipe_connect *io)
-{
- struct composite_context *c = dcerpc_pipe_connect_ncalrpc_send(mem_ctx, io);
- return dcerpc_pipe_connect_ncalrpc_recv(c);
-}
-
-
struct pipe_connect_state {
struct dcerpc_pipe *pipe;
struct dcerpc_binding *binding;
pc.binding = s->binding;
pc.interface = s->table;
pc.creds = s->credentials;
-
+
/* connect dcerpc pipe depending on required transport */
switch (s->binding->transport) {
case NCACN_NP:
struct timeval t, void *private)
{
struct composite_context *c = talloc_get_type(private, struct composite_context);
- DEBUG(0,("DCERPC CONNECT TIMEOUT\n"));
composite_error(c, NT_STATUS_IO_TIMEOUT);
- composite_done(c);
}
/*
status = composite_wait(c);
- s = talloc_get_type(c->private_data, struct pipe_connect_state);
- talloc_steal(mem_ctx, s->pipe);
- *p = s->pipe;
-
+ if (NT_STATUS_IS_OK(status)) {
+ s = talloc_get_type(c->private_data, struct pipe_connect_state);
+ talloc_steal(mem_ctx, s->pipe);
+ *p = s->pipe;
+ }
talloc_free(c);
return status;
}
The string is to be parsed to a binding structure first.
*/
struct composite_context* dcerpc_pipe_connect_send(TALLOC_CTX *parent_ctx,
- struct dcerpc_pipe **pp,
const char *binding,
const struct dcerpc_interface_table *table,
struct cli_credentials *credentials,
struct pipe_conn_state *s;
status = composite_wait(c);
- s = talloc_get_type(c->private_data, struct pipe_conn_state);
- *pp = talloc_steal(mem_ctx, s->pipe);
-
+ if (NT_STATUS_IS_OK(status)) {
+ s = talloc_get_type(c->private_data, struct pipe_conn_state);
+ *pp = talloc_steal(mem_ctx, s->pipe);
+ }
talloc_free(c);
return status;
}
struct event_context *ev)
{
struct composite_context *c;
- c = dcerpc_pipe_connect_send(parent_ctx, pp, binding, table,
+ c = dcerpc_pipe_connect_send(parent_ctx, binding,
+ table,
credentials, ev);
return dcerpc_pipe_connect_recv(c, parent_ctx, pp);
}
return c;
}
- pipe_smb_req = dcerpc_pipe_open_smb_send(s->pipe2->conn, s->tree,
+ pipe_smb_req = dcerpc_pipe_open_smb_send(s->pipe2, s->tree,
s->binding->endpoint);
composite_continue(c, pipe_smb_req, continue_open_smb, c);
return c;
case NCACN_IP_TCP:
pipe_tcp_req = dcerpc_pipe_open_tcp_send(s->pipe2->conn,
s->binding->host,
+ s->binding->target_hostname,
atoi(s->binding->endpoint));
composite_continue(c, pipe_tcp_req, continue_open_tcp, c);
return c;