source: branches/samba-3.2.x/source/libsmb/dcerpc_err.c

Last change on this file was 133, checked in by Paul Smedley, 17 years ago

Update trunk to 3.2.0pre3

File size: 1.6 KB
Line 
1/*
2 * Unix SMB/CIFS implementation.
3 * Copyright (C) Stefan Metzmacher 2004
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include "includes.h"
20
21struct dcerpc_fault_table {
22 const char *errstr;
23 uint32_t faultcode;
24};
25
26static const struct dcerpc_fault_table dcerpc_faults[] =
27{
28 { "DCERPC_FAULT_OP_RNG_ERROR", DCERPC_FAULT_OP_RNG_ERROR },
29 { "DCERPC_FAULT_UNK_IF", DCERPC_FAULT_UNK_IF },
30 { "DCERPC_FAULT_NDR", DCERPC_FAULT_NDR },
31 { "DCERPC_FAULT_INVALID_TAG", DCERPC_FAULT_INVALID_TAG },
32 { "DCERPC_FAULT_CONTEXT_MISMATCH", DCERPC_FAULT_CONTEXT_MISMATCH },
33 { "DCERPC_FAULT_OTHER", DCERPC_FAULT_OTHER },
34 { "DCERPC_FAULT_ACCESS_DENIED", DCERPC_FAULT_ACCESS_DENIED },
35
36 { NULL, 0}
37};
38
39const char *dcerpc_errstr(uint32 fault_code)
40{
41 char *result;
42 int idx = 0;
43
44 while (dcerpc_faults[idx].errstr != NULL) {
45 if (dcerpc_faults[idx].faultcode == fault_code) {
46 return dcerpc_faults[idx].errstr;
47 }
48 idx++;
49 }
50
51 result = talloc_asprintf(talloc_tos(), "DCERPC fault 0x%08x",
52 fault_code);
53 SMB_ASSERT(result != NULL);
54 return result;
55}
Note: See TracBrowser for help on using the repository browser.