2 Unix SMB/CIFS implementation.
6 Copyright (C) 2010 Kai Blin
7 Copyright (C) 2014 Stefan Metzmacher
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program 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
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #include "libcli/util/ntstatus.h"
25 #include "libcli/util/werror.h"
26 #include "librpc/ndr/libndr.h"
27 #include "librpc/gen_ndr/ndr_dns.h"
28 #include "librpc/gen_ndr/ndr_dnsp.h"
30 #include "dsdb/samdb/samdb.h"
31 #include "dsdb/common/util.h"
32 #include "dns_server/dnsserver_common.h"
35 #define DBGC_CLASS DBGC_DNS
37 uint8_t werr_to_dns_err(WERROR werr)
39 if (W_ERROR_EQUAL(WERR_OK, werr)) {
41 } else if (W_ERROR_EQUAL(DNS_ERR(FORMAT_ERROR), werr)) {
42 return DNS_RCODE_FORMERR;
43 } else if (W_ERROR_EQUAL(DNS_ERR(SERVER_FAILURE), werr)) {
44 return DNS_RCODE_SERVFAIL;
45 } else if (W_ERROR_EQUAL(DNS_ERR(NAME_ERROR), werr)) {
46 return DNS_RCODE_NXDOMAIN;
47 } else if (W_ERROR_EQUAL(WERR_DNS_ERROR_NAME_DOES_NOT_EXIST, werr)) {
48 return DNS_RCODE_NXDOMAIN;
49 } else if (W_ERROR_EQUAL(DNS_ERR(NOT_IMPLEMENTED), werr)) {
50 return DNS_RCODE_NOTIMP;
51 } else if (W_ERROR_EQUAL(DNS_ERR(REFUSED), werr)) {
52 return DNS_RCODE_REFUSED;
53 } else if (W_ERROR_EQUAL(DNS_ERR(YXDOMAIN), werr)) {
54 return DNS_RCODE_YXDOMAIN;
55 } else if (W_ERROR_EQUAL(DNS_ERR(YXRRSET), werr)) {
56 return DNS_RCODE_YXRRSET;
57 } else if (W_ERROR_EQUAL(DNS_ERR(NXRRSET), werr)) {
58 return DNS_RCODE_NXRRSET;
59 } else if (W_ERROR_EQUAL(DNS_ERR(NOTAUTH), werr)) {
60 return DNS_RCODE_NOTAUTH;
61 } else if (W_ERROR_EQUAL(DNS_ERR(NOTZONE), werr)) {
62 return DNS_RCODE_NOTZONE;
63 } else if (W_ERROR_EQUAL(DNS_ERR(BADKEY), werr)) {
64 return DNS_RCODE_BADKEY;
66 DEBUG(5, ("No mapping exists for %s\n", win_errstr(werr)));
67 return DNS_RCODE_SERVFAIL;