s3: smbd: Remove open_file_fchmod().
[Samba.git] / lib / addns / error.c
blob361388cea3c1d0d73c8c2e5b85ed2d642c667491
1 /*
2 Linux DNS client library implementation
3 Copyright (C) 2010 Guenther Deschner
5 ** NOTE! The following LGPL license applies to the libaddns
6 ** library. This does NOT imply that all of Samba is released
7 ** under the LGPL
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 2.1 of the License, or (at your option) any later version.
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
19 You should have received a copy of the GNU Lesser General Public
20 License along with this library; if not, see <http://www.gnu.org/licenses/>.
23 #include "dns.h"
24 #include "dnserr.h"
26 typedef struct {
27 const char *dns_errstr;
28 DNS_ERROR dns_errcode;
29 } dns_err_code_struct;
31 static const dns_err_code_struct dns_errs[] =
33 { "ERROR_DNS_SUCCESS", ERROR_DNS_SUCCESS },
34 { "ERROR_DNS_RECORD_NOT_FOUND", ERROR_DNS_RECORD_NOT_FOUND },
35 { "ERROR_DNS_BAD_RESPONSE", ERROR_DNS_BAD_RESPONSE },
36 { "ERROR_DNS_INVALID_PARAMETER", ERROR_DNS_INVALID_PARAMETER },
37 { "ERROR_DNS_NO_MEMORY", ERROR_DNS_NO_MEMORY },
38 { "ERROR_DNS_INVALID_NAME_SERVER", ERROR_DNS_INVALID_NAME_SERVER },
39 { "ERROR_DNS_CONNECTION_FAILED", ERROR_DNS_CONNECTION_FAILED },
40 { "ERROR_DNS_GSS_ERROR", ERROR_DNS_GSS_ERROR },
41 { "ERROR_DNS_INVALID_NAME", ERROR_DNS_INVALID_NAME },
42 { "ERROR_DNS_INVALID_MESSAGE", ERROR_DNS_INVALID_MESSAGE },
43 { "ERROR_DNS_SOCKET_ERROR", ERROR_DNS_SOCKET_ERROR },
44 { "ERROR_DNS_UPDATE_FAILED", ERROR_DNS_UPDATE_FAILED },
45 { NULL, ERROR_DNS_SUCCESS },
48 const char *dns_errstr(DNS_ERROR err)
50 int i;
52 for (i=0; dns_errs[i].dns_errstr != NULL; i++) {
53 if (ERR_DNS_EQUAL(err, dns_errs[i].dns_errcode)) {
54 return dns_errs[i].dns_errstr;
58 return NULL;