summaryrefslogtreecommitdiff
path: root/librpc
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-03-20 11:31:55 +0100
committerStefan Metzmacher <metze@samba.org>2010-04-15 09:34:03 +0200
commitfed16f4015f8209dc4705fc1464fc45a093d9349 (patch)
tree7f4d6b72b112e38417a28f4353483433d49af640 /librpc
parentc0736c70d6ab442055f998e7b1308a0536f99a95 (diff)
downloadsamba-fed16f4015f8209dc4705fc1464fc45a093d9349.tar.gz
samba-fed16f4015f8209dc4705fc1464fc45a093d9349.tar.bz2
samba-fed16f4015f8209dc4705fc1464fc45a093d9349.zip
librpc/rpc: add dcerpc_fault_to_nt_status()
For now this only handles fault codes with we've seen yet and for which we have explicit torture checks. metze
Diffstat (limited to 'librpc')
-rw-r--r--librpc/rpc/dcerpc_error.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/librpc/rpc/dcerpc_error.c b/librpc/rpc/dcerpc_error.c
index 69cd08b7c1..713e32e7ed 100644
--- a/librpc/rpc/dcerpc_error.c
+++ b/librpc/rpc/dcerpc_error.c
@@ -95,3 +95,27 @@ _PUBLIC_ const char *dcerpc_errstr(TALLOC_CTX *mem_ctx, uint32_t fault_code)
return win_errstr(werr);
}
+
+_PUBLIC_ NTSTATUS dcerpc_fault_to_nt_status(uint32_t fault_code)
+{
+ /* TODO: add more mappings */
+ switch (fault_code) {
+ case DCERPC_FAULT_OP_RNG_ERROR:
+ return NT_STATUS_RPC_PROCNUM_OUT_OF_RANGE;
+ case DCERPC_FAULT_UNK_IF:
+ return NT_STATUS_RPC_UNKNOWN_IF;
+ case DCERPC_FAULT_NDR:
+ return NT_STATUS_RPC_BAD_STUB_DATA;
+ case DCERPC_FAULT_INVALID_TAG:
+ return NT_STATUS_RPC_ENUM_VALUE_OUT_OF_RANGE;
+ case DCERPC_FAULT_CONTEXT_MISMATCH:
+ return NT_STATUS_RPC_SS_CONTEXT_MISMATCH;
+ case DCERPC_FAULT_OTHER:
+ return NT_STATUS_RPC_CALL_FAILED;
+ case DCERPC_FAULT_ACCESS_DENIED:
+ return NT_STATUS_ACCESS_DENIED;
+ }
+
+ return NT_STATUS_RPC_PROTOCOL_ERROR;
+}
+