* Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
* Copyright (C) Paul Ashton 1997.
* Copyright (C) Jeremy Allison 1999.
+ * Copyright (C) Simo Sorce 2010
*
* 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
*/
#include "includes.h"
+#include "librpc/gen_ndr/ndr_dcerpc.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_PARSE
}
/*******************************************************************
- Inits an RPC_CONTEXT structure.
- Note the transfer pointer must remain valid until this is marshalled.
+ Reads or writes a struct dcerpc_ctx_list structure.
********************************************************************/
-void init_rpc_context(RPC_CONTEXT *rpc_ctx, uint16 context_id,
- const struct ndr_syntax_id *abstract,
- const struct ndr_syntax_id *transfer)
-{
- rpc_ctx->context_id = context_id ; /* presentation context identifier (0x0) */
- rpc_ctx->num_transfer_syntaxes = 1 ; /* the number of syntaxes (has always been 1?)(0x1) */
-
- /* num and vers. of interface client is using */
- rpc_ctx->abstract = *abstract;
-
- /* vers. of interface to use for replies */
- rpc_ctx->transfer = CONST_DISCARD(struct ndr_syntax_id *, transfer);
-}
-
-/*******************************************************************
- Inits an RPC_HDR_RB structure.
- Note the context pointer must remain valid until this is marshalled.
-********************************************************************/
-
-void init_rpc_hdr_rb(RPC_HDR_RB *rpc,
- uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid,
- RPC_CONTEXT *context)
-{
- init_rpc_hdr_bba(&rpc->bba, max_tsize, max_rsize, assoc_gid);
-
- rpc->num_contexts = 1;
- rpc->rpc_context = context;
-}
-
-/*******************************************************************
- Reads or writes an RPC_CONTEXT structure.
-********************************************************************/
-
-bool smb_io_rpc_context(const char *desc, RPC_CONTEXT *rpc_ctx, prs_struct *ps, int depth)
+bool smb_io_rpc_context(const char *desc, struct dcerpc_ctx_list *rpc_ctx, prs_struct *ps, int depth)
{
int i;
if (rpc_ctx->num_transfer_syntaxes == 0)
return False;
- if(!smb_io_rpc_iface("", &rpc_ctx->abstract, ps, depth))
+ if(!smb_io_rpc_iface("", &rpc_ctx->abstract_syntax, ps, depth))
return False;
if (UNMARSHALLING(ps)) {
- if (!(rpc_ctx->transfer = PRS_ALLOC_MEM(ps, struct ndr_syntax_id, rpc_ctx->num_transfer_syntaxes))) {
+ rpc_ctx->transfer_syntaxes =
+ PRS_ALLOC_MEM(ps, struct ndr_syntax_id,
+ rpc_ctx->num_transfer_syntaxes);
+ if (!rpc_ctx->transfer_syntaxes) {
return False;
}
}
for (i = 0; i < rpc_ctx->num_transfer_syntaxes; i++ ) {
- if (!smb_io_rpc_iface("", &rpc_ctx->transfer[i], ps, depth))
+ if (!smb_io_rpc_iface("", &rpc_ctx->transfer_syntaxes[i], ps, depth))
return False;
}
return True;
}
+NTSTATUS dcerpc_pull_dcerpc_bind(TALLOC_CTX *mem_ctx,
+ const DATA_BLOB *blob,
+ struct dcerpc_bind *r)
+{
+ enum ndr_err_code ndr_err;
+
+ ndr_err = ndr_pull_struct_blob(blob, mem_ctx, r,
+ (ndr_pull_flags_fn_t)ndr_pull_dcerpc_bind);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
+
+ return NT_STATUS_OK;
+}
+
/*******************************************************************
Reads or writes an RPC_HDR_RB structure.
********************************************************************/
return False;
if (UNMARSHALLING(ps)) {
- if (!(rpc->rpc_context = PRS_ALLOC_MEM(ps, RPC_CONTEXT, rpc->num_contexts))) {
+ if (!(rpc->rpc_context = PRS_ALLOC_MEM(ps, struct dcerpc_ctx_list, rpc->num_contexts))) {
return False;
}
}
return True;
}
-/*******************************************************************
- Reads or writes an RPC_HDR_FAULT structure.
-********************************************************************/
-
-bool smb_io_rpc_hdr_fault(const char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, int depth)
-{
- if (rpc == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "smb_io_rpc_hdr_fault");
- depth++;
-
- if(!prs_dcerpc_status("status ", ps, depth, &rpc->status))
- return False;
- if(!prs_uint32("reserved", ps, depth, &rpc->reserved))
- return False;
-
- return True;
-}
-
/*******************************************************************
Inits an RPC_HDR_AUTH structure.
********************************************************************/