s4: Make unixid optional
[Samba/ekacnet.git] / librpc / rpc / dcerpc_error.c
blobdbab7835677154d7cc1df3f267c7c613f3f613d5
1 /*
2 Unix SMB/CIFS implementation.
4 dcerpc fault functions
6 Copyright (C) Stefan Metzmacher 2004
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "includes.h"
23 #include "librpc/rpc/dcerpc.h"
25 struct dcerpc_fault_table {
26 const char *errstr;
27 uint32_t faultcode;
30 static const struct dcerpc_fault_table dcerpc_faults[] =
32 { "DCERPC_FAULT_OP_RNG_ERROR", DCERPC_FAULT_OP_RNG_ERROR },
33 { "DCERPC_FAULT_UNK_IF", DCERPC_FAULT_UNK_IF },
34 { "DCERPC_FAULT_NDR", DCERPC_FAULT_NDR },
35 { "DCERPC_FAULT_INVALID_TAG", DCERPC_FAULT_INVALID_TAG },
36 { "DCERPC_FAULT_CONTEXT_MISMATCH", DCERPC_FAULT_CONTEXT_MISMATCH },
37 { "DCERPC_FAULT_OTHER", DCERPC_FAULT_OTHER },
38 { "DCERPC_FAULT_ACCESS_DENIED", DCERPC_FAULT_ACCESS_DENIED },
40 { NULL, 0}
43 _PUBLIC_ const char *dcerpc_errstr(TALLOC_CTX *mem_ctx, uint32_t fault_code)
45 int idx = 0;
47 while (dcerpc_faults[idx].errstr != NULL) {
48 if (dcerpc_faults[idx].faultcode == fault_code) {
49 return dcerpc_faults[idx].errstr;
51 idx++;
54 return talloc_asprintf(mem_ctx, "DCERPC fault 0x%08x", fault_code);