summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-03-23 11:04:34 +0100
committerSimo Sorce <idra@samba.org>2010-07-07 23:45:50 -0400
commit3d9a12dca7e00e133702ea1d8d31e50eceac9039 (patch)
tree3cedf06f6707c60982924e07d3718f7154267cce /source3
parentf0b918473db75ff389a7d2e3bf4a069b8b30d141 (diff)
downloadsamba-3d9a12dca7e00e133702ea1d8d31e50eceac9039.tar.gz
samba-3d9a12dca7e00e133702ea1d8d31e50eceac9039.tar.bz2
samba-3d9a12dca7e00e133702ea1d8d31e50eceac9039.zip
s3-dcerpc: add dcerpc_push_ncacn_packet().
Guenther Signed-off-by: Simo Sorce <idra@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h8
-rw-r--r--source3/rpc_client/cli_pipe.c41
2 files changed, 49 insertions, 0 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index ee6f4469a9..2cbe8b3ccc 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -4833,6 +4833,14 @@ struct tevent_req *rpc_api_pipe_req_send(TALLOC_CTX *mem_ctx,
prs_struct *req_data);
NTSTATUS rpc_api_pipe_req_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
prs_struct *reply_pdu);
+NTSTATUS dcerpc_push_ncacn_packet(TALLOC_CTX *mem_ctx,
+ enum dcerpc_pkt_type ptype,
+ uint8_t pfc_flags,
+ uint16_t frag_length,
+ uint16_t auth_length,
+ uint32_t call_id,
+ union dcerpc_payload u,
+ DATA_BLOB *blob);
struct tevent_req *rpc_pipe_bind_send(TALLOC_CTX *mem_ctx,
struct event_context *ev,
struct rpc_pipe_client *cli,
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index c7ac02d77f..db6fdc5ba2 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -41,6 +41,7 @@
#include "smb_krb5.h"
#include "../libcli/auth/ntlmssp.h"
#include "rpc_client/cli_netlogon.h"
+#include "librpc/gen_ndr/ndr_dcerpc.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_CLI
@@ -293,6 +294,46 @@ static bool rpc_grow_buffer(prs_struct *pdu, size_t size)
return true;
}
+/*******************************************************************
+*******************************************************************/
+
+NTSTATUS dcerpc_push_ncacn_packet(TALLOC_CTX *mem_ctx,
+ enum dcerpc_pkt_type ptype,
+ uint8_t pfc_flags,
+ uint16_t frag_length,
+ uint16_t auth_length,
+ uint32_t call_id,
+ union dcerpc_payload u,
+ DATA_BLOB *blob)
+{
+ struct ncacn_packet r;
+ enum ndr_err_code ndr_err;
+
+ r.rpc_vers = 5;
+ r.rpc_vers_minor = 0;
+ r.ptype = ptype;
+ r.pfc_flags = pfc_flags;
+ r.drep[0] = DCERPC_DREP_LE;
+ r.drep[1] = 0;
+ r.drep[2] = 0;
+ r.drep[3] = 0;
+ r.frag_length = frag_length;
+ r.auth_length = auth_length;
+ r.call_id = call_id;
+ r.u = u;
+
+ ndr_err = ndr_push_struct_blob(blob, mem_ctx, &r,
+ (ndr_push_flags_fn_t)ndr_push_ncacn_packet);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
+
+ if (DEBUGLEVEL >= 10) {
+ NDR_PRINT_DEBUG(ncacn_packet, &r);
+ }
+
+ return NT_STATUS_OK;
+}
/*******************************************************************
Use SMBreadX to get rest of one fragment's worth of rpc data.