From 6e17934ee614f5f129b69898be7eceb09486a48f Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 22 Mar 2006 14:41:07 +0000 Subject: r14643: Merge dcerpc_errstr from Samba 4. Might need to rework prs_dcerpc_status(). Guenther (This used to be commit 38b18f428ba941f4d9a14fa2de45cb0cd793a754) --- source3/rpc_parse/parse_prs.c | 31 +++++++++++++++++++++++++++++++ source3/rpc_parse/parse_rpc.c | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 474e93cc1f..f2b002c48c 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -767,6 +767,37 @@ BOOL prs_ntstatus(const char *name, prs_struct *ps, int depth, NTSTATUS *status) return True; } +/******************************************************************* + Stream a DCE error code + ********************************************************************/ + +BOOL prs_dcerpc_status(const char *name, prs_struct *ps, int depth, NTSTATUS *status) +{ + char *q = prs_mem_get(ps, sizeof(uint32)); + if (q == NULL) + return False; + + if (UNMARSHALLING(ps)) { + if (ps->bigendian_data) + *status = NT_STATUS(RIVAL(q,0)); + else + *status = NT_STATUS(IVAL(q,0)); + } else { + if (ps->bigendian_data) + RSIVAL(q,0,NT_STATUS_V(*status)); + else + SIVAL(q,0,NT_STATUS_V(*status)); + } + + DEBUG(5,("%s%04x %s: %s\n", tab_depth(depth), ps->data_offset, name, + dcerpc_errstr(NT_STATUS_V(*status)))); + + ps->data_offset += sizeof(uint32); + + return True; +} + + /******************************************************************* Stream a WERROR ********************************************************************/ diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 79dfc05e43..2d166c773b 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -661,7 +661,7 @@ BOOL smb_io_rpc_hdr_fault(const char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, prs_debug(ps, depth, desc, "smb_io_rpc_hdr_fault"); depth++; - if(!prs_ntstatus("status ", ps, depth, &rpc->status)) + if(!prs_dcerpc_status("status ", ps, depth, &rpc->status)) return False; if(!prs_uint32("reserved", ps, depth, &rpc->reserved)) return False; -- cgit