r14643: Merge dcerpc_errstr from Samba 4.
[Samba/nascimento.git] / source3 / libsmb / dcerpc_err.c
blob89db4aa69968ee23d09218d519df50b6fe544f28
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 2 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.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include "includes.h"
22 struct dcerpc_fault_table {
23 const char *errstr;
24 uint32_t faultcode;
27 static const struct dcerpc_fault_table dcerpc_faults[] =
29 { "DCERPC_FAULT_OP_RNG_ERROR", DCERPC_FAULT_OP_RNG_ERROR },
30 { "DCERPC_FAULT_UNK_IF", DCERPC_FAULT_UNK_IF },
31 { "DCERPC_FAULT_NDR", DCERPC_FAULT_NDR },
32 { "DCERPC_FAULT_INVALID_TAG", DCERPC_FAULT_INVALID_TAG },
33 { "DCERPC_FAULT_CONTEXT_MISMATCH", DCERPC_FAULT_CONTEXT_MISMATCH },
34 { "DCERPC_FAULT_OTHER", DCERPC_FAULT_OTHER },
35 { "DCERPC_FAULT_ACCESS_DENIED", DCERPC_FAULT_ACCESS_DENIED },
37 { NULL, 0}
40 const char *dcerpc_errstr(uint32 fault_code)
42 static pstring msg;
43 int idx = 0;
45 slprintf(msg, sizeof(msg), "DCERPC fault 0x%08x", fault_code);
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 msg;
56 /*
57 * Unix SMB/CIFS implementation.
58 * Copyright (C) Stefan Metzmacher 2004
60 * This program is free software; you can redistribute it and/or modify
61 * it under the terms of the GNU General Public License as published by
62 * the Free Software Foundation; either version 2 of the License, or
63 * (at your option) any later version.
65 * This program is distributed in the hope that it will be useful,
66 * but WITHOUT ANY WARRANTY; without even the implied warranty of
67 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
68 * GNU General Public License for more details.
70 * You should have received a copy of the GNU General Public License
71 * along with this program; if not, write to the Free Software
72 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
75 #include "includes.h"
77 struct dcerpc_fault_table {
78 const char *errstr;
79 uint32_t faultcode;
82 static const struct dcerpc_fault_table dcerpc_faults[] =
84 { "DCERPC_FAULT_OP_RNG_ERROR", DCERPC_FAULT_OP_RNG_ERROR },
85 { "DCERPC_FAULT_UNK_IF", DCERPC_FAULT_UNK_IF },
86 { "DCERPC_FAULT_NDR", DCERPC_FAULT_NDR },
87 { "DCERPC_FAULT_INVALID_TAG", DCERPC_FAULT_INVALID_TAG },
88 { "DCERPC_FAULT_CONTEXT_MISMATCH", DCERPC_FAULT_CONTEXT_MISMATCH },
89 { "DCERPC_FAULT_OTHER", DCERPC_FAULT_OTHER },
90 { "DCERPC_FAULT_ACCESS_DENIED", DCERPC_FAULT_ACCESS_DENIED },
92 { NULL, 0}
95 const char *dcerpc_errstr(uint32 fault_code)
97 static pstring msg;
98 int idx = 0;
100 slprintf(msg, sizeof(msg), "DCERPC fault 0x%08x", fault_code);
102 while (dcerpc_faults[idx].errstr != NULL) {
103 if (dcerpc_faults[idx].faultcode == fault_code) {
104 return dcerpc_faults[idx].errstr;
106 idx++;
109 return msg;