From 3c3fe072252aecffae43e6349125663c315b092d Mon Sep 17 00:00:00 2001 From: Andreas Gustafsson Date: Tue, 16 Oct 2001 22:18:59 +0000 Subject: [PATCH] 1055. [func] Version and hostname queries can now be disabled using "version none;" and "hostname none;", respectively. (for consistency with "pid-file none" and each other) --- CHANGES | 4 ++++ bin/named/server.c | 9 ++++++--- doc/arm/Bv9ARM-book.xml | 35 ++++++++++++++++++----------------- lib/isccfg/parser.c | 6 +++--- 4 files changed, 31 insertions(+), 23 deletions(-) diff --git a/CHANGES b/CHANGES index 77da3535be..5223e61cd7 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +1055. [func] Version and hostname queries can now be disabled + using "version none;" and "hostname none;", + respectively. + 1054. [bug] On Win32, cfg_categories and cfg_modules need to be exported from the libisccfg DLL. diff --git a/bin/named/server.c b/bin/named/server.c index e73886ee1f..63ce366a4b 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: server.c,v 1.350 2001/10/16 20:04:36 gson Exp $ */ +/* $Id: server.c,v 1.351 2001/10/16 22:18:58 gson Exp $ */ #include @@ -917,6 +917,9 @@ create_version_zone(cfg_obj_t **maps, dns_zonemgr_t *zmgr, dns_view_t *view) { result = ns_config_get(maps, "version", &obj); INSIST(result == ISC_R_SUCCESS); + if (cfg_obj_isvoid(obj)) + return (ISC_R_SUCCESS); + versiontext = cfg_obj_asstring(obj); len = strlen(versiontext); if (len > 255) @@ -995,10 +998,10 @@ create_hostname_zone(cfg_obj_t **maps, dns_zonemgr_t *zmgr, dns_view_t *view) { result = ns_config_get(maps, "hostname", &obj); if (result == ISC_R_SUCCESS) { + if (cfg_obj_isvoid(obj)) + return (ISC_R_SUCCESS); hostnametext = cfg_obj_asstring(obj); len = strlen(hostnametext); - if (len == 0) - return (ISC_R_SUCCESS); if (len > 255) len = 255; /* Silently truncate. */ buf[0] = len; diff --git a/doc/arm/Bv9ARM-book.xml b/doc/arm/Bv9ARM-book.xml index f52970ccbc..38f9490d29 100644 --- a/doc/arm/Bv9ARM-book.xml +++ b/doc/arm/Bv9ARM-book.xml @@ -2,7 +2,7 @@ - + BIND 9 Administrator Reference Manual @@ -2736,8 +2736,8 @@ exact match lookup before search path elements are appended. statement in the named.conf file: options { - hostname hostname_string; version version_string; + hostname hostname_string; directory path_name; named-xfer path_name; tkey-domain domainname; @@ -2837,23 +2837,24 @@ be used. -hostname -This defaults to the hostname of the machine hosting -the nameserver as found by gethostname(). -Its prime purpose is to be able to identify which of a -number of anycast servers is actually answering your queries by sending a -TXT query for hostname.bind in -class CHAOS to the anycast server and getting back a -unique name. -Setting the hostname to a empty string ("") will -disable processing of the queries. - - version The version the server should report -via a query of name version.bind in -class CHAOS. -The default is the real version number of this server. +via a query of the name version.bind +with type TXT, class CHAOS. +The default is the real version number of this server. +Specifying version none; +disables processing of the queries. + + +hostname +The hostname the server should report via a query of +the name hostname.bind +with type TXT, class CHAOS. +This defaults to the hostname of the machine hosting the nameserver as +found by gethostname(). The primary purpose of such queries is to +identify which of a group of anycast servers is actually +answering your queries. Specifying hostname none; +disables processing of the queries. directory diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c index e921f8b81e..0b84e97dbf 100644 --- a/lib/isccfg/parser.c +++ b/lib/isccfg/parser.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: parser.c,v 1.80 2001/10/16 20:04:41 gson Exp $ */ +/* $Id: parser.c,v 1.81 2001/10/16 22:18:57 gson Exp $ */ #include @@ -857,7 +857,7 @@ options_clauses[] = { { "has-old-clients", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE }, { "heartbeat-interval", &cfg_type_uint32, 0 }, { "host-statistics", &cfg_type_boolean, CFG_CLAUSEFLAG_NOTIMP }, - { "hostname", &cfg_type_qstring, 0 }, + { "hostname", &cfg_type_qstringornone, 0 }, { "interface-interval", &cfg_type_uint32, 0 }, { "listen-on", &cfg_type_listenon, CFG_CLAUSEFLAG_MULTI }, { "listen-on-v6", &cfg_type_listenon, CFG_CLAUSEFLAG_MULTI }, @@ -886,7 +886,7 @@ options_clauses[] = { { "treat-cr-as-space", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE }, { "use-id-pool", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE }, { "use-ixfr", &cfg_type_boolean, 0 }, - { "version", &cfg_type_qstring, 0 }, + { "version", &cfg_type_qstringornone, 0 }, { NULL, NULL, 0 } };