From cb9eddb31248f0c7b0ffcff642154ca4b0230276 Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=BCnther=20Deschner?= Date: Mon, 23 Mar 2009 12:00:12 +0100 Subject: [PATCH] s3-dcerpc: add dcerpc_pull_ncacn_packet(). Guenther Signed-off-by: Simo Sorce --- source3/include/proto.h | 3 +++ source3/rpc_client/cli_pipe.c | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/source3/include/proto.h b/source3/include/proto.h index 2cbe8b3ccc..a998becfbe 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -4841,6 +4841,9 @@ NTSTATUS dcerpc_push_ncacn_packet(TALLOC_CTX *mem_ctx, uint32_t call_id, union dcerpc_payload u, DATA_BLOB *blob); +NTSTATUS dcerpc_pull_ncacn_packet(TALLOC_CTX *mem_ctx, + const DATA_BLOB *blob, + struct ncacn_packet *r); 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 db6fdc5ba2..5b3894c6ec 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -335,6 +335,28 @@ NTSTATUS dcerpc_push_ncacn_packet(TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } +/******************************************************************* +*******************************************************************/ + +NTSTATUS dcerpc_pull_ncacn_packet(TALLOC_CTX *mem_ctx, + const DATA_BLOB *blob, + struct ncacn_packet *r) +{ + enum ndr_err_code ndr_err; + + ndr_err = ndr_pull_struct_blob(blob, mem_ctx, r, + (ndr_pull_flags_fn_t)ndr_pull_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. Reads the whole size or give an error message -- 2.34.1