1 | /*
|
---|
2 | Unix SMB/CIFS implementation.
|
---|
3 |
|
---|
4 | dcerpc fault functions
|
---|
5 |
|
---|
6 | Copyright (C) Stefan Metzmacher 2004
|
---|
7 |
|
---|
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.
|
---|
12 |
|
---|
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.
|
---|
17 |
|
---|
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/>.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #include "includes.h"
|
---|
23 | #include "librpc/rpc/dcerpc.h"
|
---|
24 |
|
---|
25 | struct dcerpc_fault_table {
|
---|
26 | const char *errstr;
|
---|
27 | uint32_t faultcode;
|
---|
28 | };
|
---|
29 |
|
---|
30 | static const struct dcerpc_fault_table dcerpc_faults[] =
|
---|
31 | {
|
---|
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 },
|
---|
39 | { "DCERPC_FAULT_SEC_PKG_ERROR", DCERPC_FAULT_SEC_PKG_ERROR },
|
---|
40 |
|
---|
41 | { NULL, 0}
|
---|
42 | };
|
---|
43 |
|
---|
44 | _PUBLIC_ const char *dcerpc_errstr(TALLOC_CTX *mem_ctx, uint32_t fault_code)
|
---|
45 | {
|
---|
46 | int idx = 0;
|
---|
47 |
|
---|
48 | while (dcerpc_faults[idx].errstr != NULL) {
|
---|
49 | if (dcerpc_faults[idx].faultcode == fault_code) {
|
---|
50 | return dcerpc_faults[idx].errstr;
|
---|
51 | }
|
---|
52 | idx++;
|
---|
53 | }
|
---|
54 |
|
---|
55 | return talloc_asprintf(mem_ctx, "DCERPC fault 0x%08x", fault_code);
|
---|
56 | }
|
---|