STEP03c: HACK s3:rpc_client dcerpc_connection...
authorStefan Metzmacher <metze@samba.org>
Thu, 9 Jan 2014 18:01:56 +0000 (19:01 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 4 Jun 2019 10:45:39 +0000 (12:45 +0200)
source3/rpc_client/cli_pipe.c
source3/rpc_client/rpc_client.h
source3/rpc_client/rpc_transport.h
source3/rpc_client/rpc_transport_tstream.c

index 81b6bfb75bf5f522083f73d3215c3dd2846b44fb..0813ba1c9e21f1824adfb596d12212f3971be662 100644 (file)
@@ -36,6 +36,7 @@
 #include "auth/gensec/gensec.h"
 #include "auth/credentials/credentials.h"
 #include "../libcli/smb/smbXcli_base.h"
+#include "librpc/rpc/dcerpc_connection.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_RPC_CLI
@@ -2697,6 +2698,16 @@ static NTSTATUS rpc_pipe_open_tcp_port(TALLOC_CTX *mem_ctx, const char *host,
 
        result->transport->transport = NCACN_IP_TCP;
 
+       result->assoc = dcerpc_association_create(result, 0);
+       result->conn = dcerpc_connection_create(result, result->assoc,
+                                               &result->transport->stream);
+       result->pres = dcerpc_presentation_allocate(result, result->conn, table,
+                                                   &ndr_transfer_syntax_ndr);
+       result->sec = dcerpc_security_allocate(result, result->conn,
+                                              DCERPC_AUTH_TYPE_NONE,
+                                              DCERPC_AUTH_LEVEL_NONE,
+                                              NULL);
+
        result->binding_handle = rpccli_bh_create(result, NULL, table);
        if (result->binding_handle == NULL) {
                TALLOC_FREE(result);
@@ -2947,6 +2958,16 @@ NTSTATUS rpc_pipe_open_ncalrpc(TALLOC_CTX *mem_ctx, const char *socket_path,
 
        result->transport->transport = NCALRPC;
 
+       result->assoc = dcerpc_association_create(result, 0);
+       result->conn = dcerpc_connection_create(result, result->assoc,
+                                               &result->transport->stream);
+       result->pres = dcerpc_presentation_allocate(result, result->conn, table,
+                                                   &ndr_transfer_syntax_ndr);
+       result->sec = dcerpc_security_allocate(result, result->conn,
+                                              DCERPC_AUTH_TYPE_NONE,
+                                              DCERPC_AUTH_LEVEL_NONE,
+                                              NULL);
+
        result->binding_handle = rpccli_bh_create(result, NULL, table);
        if (result->binding_handle == NULL) {
                TALLOC_FREE(result);
@@ -3026,6 +3047,16 @@ static NTSTATUS rpc_pipe_open_np(struct cli_state *cli,
 
        result->transport->transport = NCACN_NP;
 
+       result->assoc = dcerpc_association_create(result, 0);
+       result->conn = dcerpc_connection_create(result, result->assoc,
+                                               &result->transport->stream);
+       result->pres = dcerpc_presentation_allocate(result, result->conn, table,
+                                                   &ndr_transfer_syntax_ndr);
+       result->sec = dcerpc_security_allocate(result, result->conn,
+                                              DCERPC_AUTH_TYPE_NONE,
+                                              DCERPC_AUTH_LEVEL_NONE,
+                                              NULL);
+
        np_ref = talloc(result->transport, struct rpc_pipe_client_np_ref);
        if (np_ref == NULL) {
                TALLOC_FREE(result);
index f1be075fea9125a4a549c7b0d6bbf686a0ca7f33..965aa42a0a280d6943348c2e531e596a26972407 100644 (file)
@@ -41,6 +41,11 @@ struct rpc_pipe_client {
        struct ndr_syntax_id transfer_syntax;
        bool verified_pcontext;
 
+       struct dcerpc_association *assoc;
+       struct dcerpc_connection *conn;
+       struct dcerpc_presentation *pres;
+       struct dcerpc_security *sec;
+
        char *desthost;
        char *srv_name_slash;
 
index 1c774583bdcd04a730d1d8bd36d51f780557a529..2317f9ebd42247578308f0d0fbe944037627b28e 100644 (file)
@@ -31,6 +31,7 @@
 struct rpc_cli_transport {
 
        enum dcerpc_transport_t transport;
+       struct tstream_context *stream;
 
        /**
         * Trigger an async read from the server. May return a short read.
index 3f4b616f3e816f4caded7903edd0ade85152bc7a..b66f26f8bb962e83342f81ad9abcc6099f0eda51 100644 (file)
@@ -568,6 +568,8 @@ NTSTATUS rpc_transport_tstream_init(TALLOC_CTX *mem_ctx,
        state->stream = talloc_move(state, stream);
        state->timeout = 10000; /* 10 seconds. */
 
+       result->stream = state->stream;
+
        if (tstream_is_smbXcli_np(state->stream)) {
                result->trans_send = rpc_tstream_trans_send;
                result->trans_recv = rpc_tstream_trans_recv;