summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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,