From 0553f5554f2ecfa137565b83378f566edc8fe6ab Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 6 Oct 2004 05:56:29 +0000 Subject: [PATCH] 1729. [func] Improve check-names error messages. 1728. [doc] Update check-names documentation. 1727. [bug] named-checkzone: check-names support didn't match documentation. --- CHANGES | 7 ++++--- bin/check/check-tool.c | 6 ++++-- bin/check/named-checkzone.c | 14 ++++++++++---- doc/arm/Bv9ARM-book.xml | 36 ++++++++++++++++++++++++++++++++---- lib/dns/rdata.c | 4 ++-- lib/dns/zone.c | 7 ++++--- 6 files changed, 56 insertions(+), 18 deletions(-) diff --git a/CHANGES b/CHANGES index 9fec354559..59265cf90e 100644 --- a/CHANGES +++ b/CHANGES @@ -26,11 +26,12 @@ 1730. [port] Determine the length type used by the socket API. [RT #12581] -1729. [placeholder] rt12634 +1729. [func] Improve check-names error messages. -1728. [placeholder] rt12634 +1728. [doc] Update check-names documentation. -1727. [placeholder] rt12634 +1727. [bug] named-checkzone: check-names support didn't match + documentation. 1726. [port] aix5: add support for aix5 diff --git a/bin/check/check-tool.c b/bin/check/check-tool.c index cdfb702f3f..6cbc1dc519 100644 --- a/bin/check/check-tool.c +++ b/bin/check/check-tool.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: check-tool.c,v 1.10 2004/03/05 04:57:20 marka Exp $ */ +/* $Id: check-tool.c,v 1.11 2004/10/06 05:56:28 marka Exp $ */ #include @@ -48,7 +48,9 @@ static const char *dbtype[] = { "rbt" }; int debug = 0; isc_boolean_t nomerge = ISC_TRUE; -unsigned int zone_options = DNS_ZONEOPT_CHECKNS|DNS_ZONEOPT_MANYERRORS; +unsigned int zone_options = DNS_ZONEOPT_CHECKNS | + DNS_ZONEOPT_MANYERRORS | + DNS_ZONEOPT_CHECKNAMES; isc_result_t setup_logging(isc_mem_t *mctx, isc_log_t **logp) { diff --git a/bin/check/named-checkzone.c b/bin/check/named-checkzone.c index 7260be9ec2..a201b6c61e 100644 --- a/bin/check/named-checkzone.c +++ b/bin/check/named-checkzone.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: named-checkzone.c,v 1.29 2004/03/05 04:57:20 marka Exp $ */ +/* $Id: named-checkzone.c,v 1.30 2004/10/06 05:56:28 marka Exp $ */ #include @@ -63,7 +63,8 @@ static void usage(void) { fprintf(stderr, "usage: named-checkzone [-djqvD] [-c class] [-o output] " - "[-t directory] [-w directory] [-k option] zonename filename\n"); + "[-t directory] [-w directory] [-k (ignore|warn|fail)] " + "[-n (ignore|warn|fail)] zonename filename\n"); exit(1); } @@ -111,12 +112,17 @@ main(int argc, char **argv) { break; case 'k': - if (!strcmp(isc_commandline_argument, "check-names")) { + if (!strcmp(isc_commandline_argument, "warn")) { zone_options |= DNS_ZONEOPT_CHECKNAMES; + zone_options &= ~DNS_ZONEOPT_CHECKNAMESFAIL; } else if (!strcmp(isc_commandline_argument, - "check-names-fail")) { + "fail")) { zone_options |= DNS_ZONEOPT_CHECKNAMES | DNS_ZONEOPT_CHECKNAMESFAIL; + } else if (!strcmp(isc_commandline_argument, + "ignore")) { + zone_options &= ~(DNS_ZONEOPT_CHECKNAMES | + DNS_ZONEOPT_CHECKNAMESFAIL); } break; diff --git a/doc/arm/Bv9ARM-book.xml b/doc/arm/Bv9ARM-book.xml index 25315785bb..9a9a2aa3d5 100644 --- a/doc/arm/Bv9ARM-book.xml +++ b/doc/arm/Bv9ARM-book.xml @@ -2,7 +2,7 @@ - + BIND 9 Administrator Reference Manual @@ -679,8 +679,13 @@ of a server. syntax and consistency. named-checkzone - -dq + -djqvD -c class + -o output + -t directory + -w directory + -k (ignore|warn|fail) + -n (ignore|warn|fail) zone filename @@ -2720,7 +2725,7 @@ statement in the named.conf file: forward ( only | first ); forwarders { ip_addr port ip_port ; ip_addr port ip_port ; ... }; dual-stack-servers port ip_port { ( domain_name port ip_port | ip_addr port ip_port ) ; ... }; - check-names ( master | slave | response )( warn | fail | ignore ); + check-names ( master | slave | response )( warn | fail | ignore ); allow-notify { address_match_list }; allow-query { address_match_list }; allow-transfer { address_match_list }; @@ -3340,6 +3345,28 @@ If querylog is not specified then the query logging is determined by the presence of the logging category queries. +check-names + + +This option is used to restrict the character set and syntax of +certain domain names in master files and/or DNS responses received +from the network. The default varies according to usage area. For +master zones the default is fail. +For slave zones the default is warn. +For answer received from the network (response) +the default is ignore. + +The rules for legal hostnames / mail domains are derived from RFC 952 +and RFC 821 as modified by RFC 1123. + +check-names applies to the owner names of A, AAA and +MX records. It also applies to the domain names in the RDATA of NS, SOA and MX +records. It also applies to the RDATA of PTR records where the owner name +indicated that it is a reverse lookup of a hostname (the owner name ends in +IN-ADDR.ARPA, IP6.ARPA, IP6.INT). + + + @@ -4730,7 +4757,8 @@ The default is the empty list. This option is used to restrict the character set and syntax of certain domain names in master files and/or DNS responses received from the -network. +network. The default varies according to zone type. For master zones the default is fail. For slave +zones the default is warn. diff --git a/lib/dns/rdata.c b/lib/dns/rdata.c index a6575a588a..93aaf07e1a 100644 --- a/lib/dns/rdata.c +++ b/lib/dns/rdata.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rdata.c,v 1.184 2004/03/16 05:52:18 marka Exp $ */ +/* $Id: rdata.c,v 1.185 2004/10/06 05:56:29 marka Exp $ */ #include #include @@ -1588,7 +1588,7 @@ warn_badname(dns_name_t *name, isc_lex_t *lexer, file = isc_lex_getsourcename(lexer); line = isc_lex_getsourceline(lexer); dns_name_format(name, namebuf, sizeof(namebuf)); - (*callbacks->warn)(callbacks, "%s:%u: %s: %s", + (*callbacks->warn)(callbacks, "%s:%u: warning: %s: %s", file, line, namebuf, dns_result_totext(DNS_R_BADNAME)); } diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 155fc71c79..98b31a14f7 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: zone.c,v 1.420 2004/08/28 05:53:12 marka Exp $ */ +/* $Id: zone.c,v 1.421 2004/10/06 05:56:29 marka Exp $ */ #include @@ -1266,12 +1266,13 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime, "no master file"); else if (result != DNS_R_NOMASTERFILE) dns_zone_log(zone, ISC_LOG_ERROR, - "loading master file %s: %s", + "loading from master file %s " + "failed: %s", zone->masterfile, dns_result_totext(result)); } else dns_zone_log(zone, ISC_LOG_ERROR, - "loading master file %s: %s", + "loading from master file %s failed: %s", zone->masterfile, dns_result_totext(result)); goto cleanup;