summaryrefslogtreecommitdiff
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
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
-rw-r--r--librpc/rpc/dcerpc_error.c24
-rw-r--r--source4/librpc/rpc/dcerpc.h1
2 files changed, 25 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;
+}
+
diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h
index 22988e62ba..69de8c5467 100644
--- a/source4/librpc/rpc/dcerpc.h
+++ b/source4/librpc/rpc/dcerpc.h
@@ -303,6 +303,7 @@ NTSTATUS dcerpc_pipe_connect_b(TALLOC_CTX *parent_ctx,
struct tevent_context *ev,
struct loadparm_context *lp_ctx);
const char *dcerpc_errstr(TALLOC_CTX *mem_ctx, uint32_t fault_code);
+NTSTATUS dcerpc_fault_to_nt_status(uint32_t fault_code);
NTSTATUS dcerpc_pipe_auth(TALLOC_CTX *mem_ctx,
struct dcerpc_pipe **p,