From: Evan Hunt Date: Sat, 26 Dec 2015 18:50:32 +0000 (-0800) Subject: [master] fix geoip options X-Git-Tag: v9.11.0a1~232 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=fbed5f0f44515f5b3ca499a3466c875507852970;p=thirdparty%2Fbind9.git [master] fix geoip options 4284. [bug] Some GeoIP options were incorrectly documented using abbreviated forms which were not accepted by named. The code has been updated to allow both long and abbreviated forms. [RT #41381] --- diff --git a/CHANGES b/CHANGES index 37dbbf77312..01af9bda639 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,8 @@ +4284. [bug] Some GeoIP options were incorrectly documented + using abbreviated forms which were not accepted by + named. The code has been updated to allow both + long and abbreviated forms. [RT #41381] + 4283. [bug] OPENSSL_config is no longer re-callable. [RT #41348] 4282. [func] 'dig +[no]mapped' determine whether the use of mapped diff --git a/bin/tests/system/geoip/options.conf b/bin/tests/system/geoip/options.conf new file mode 100644 index 00000000000..eed3fe2b256 --- /dev/null +++ b/bin/tests/system/geoip/options.conf @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +// NS2 + +controls { /* empty */ }; + +options { + query-source address 10.53.0.2; + notify-source 10.53.0.2; + transfer-source 10.53.0.2; + port 5300; + pid-file "named.pid"; + listen-on { 10.53.0.2; }; + listen-on-v6 { none; }; + recursion no; + geoip-directory "data"; + allow-query { + geoip area 831; + geoip areacode 831; + geoip metro 828; + geoip metrocode 828; + geoip tz PST; + geoip timezone PST; + geoip postal 95060; + geoip postalcode 95060; + }; +}; + diff --git a/bin/tests/system/geoip/tests.sh b/bin/tests/system/geoip/tests.sh index 9befdf4768f..e762983005f 100644 --- a/bin/tests/system/geoip/tests.sh +++ b/bin/tests/system/geoip/tests.sh @@ -477,5 +477,12 @@ fi [ $ret -eq 0 ] || echo "I:failed" status=`expr $status + $ret` +n=`expr $n + 1` +echo "I:checking other GeoIP options are parsed correctly ($n)" +ret=0 +$CHECKCONF options.conf || ret=1 +[ $ret -eq 0 ] || echo "I:failed" +status=`expr $status + $ret` + echo "I:exit status: $status" exit $status diff --git a/doc/arm/notes.xml b/doc/arm/notes.xml index 9cc519eb600..1ec28bffaa4 100644 --- a/doc/arm/notes.xml +++ b/doc/arm/notes.xml @@ -743,6 +743,14 @@
Bug Fixes + + + Some of the options for GeoIP ACLs, including "areacode", + "metrocode", and "timezone", were incorrectly documented + as "area", "metro" and "tz". Both the long and abbreviated + versions are now accepted. + + dig, host and diff --git a/lib/isccfg/aclconf.c b/lib/isccfg/aclconf.c index 03dd4401ecd..5e10023d0e6 100644 --- a/lib/isccfg/aclconf.c +++ b/lib/isccfg/aclconf.c @@ -532,21 +532,32 @@ parse_geoip_element(const cfg_obj_t *obj, isc_log_t *lctx, subtype = dns_geoip_city_name; strlcpy(de.geoip_elem.as_string, search, sizeof(de.geoip_elem.as_string)); - } else if (strcasecmp(stype, "postal") == 0 && len < 7) { - subtype = dns_geoip_city_postalcode; - strlcpy(de.geoip_elem.as_string, search, - sizeof(de.geoip_elem.as_string)); - } else if (strcasecmp(stype, "postal") == 0) { - cfg_obj_log(obj, lctx, ISC_LOG_ERROR, - "geoiop postal code (%s) too long", search); - return (ISC_R_FAILURE); - } else if (strcasecmp(stype, "metro") == 0) { + } else if (strcasecmp(stype, "postal") == 0 || + strcasecmp(stype, "postalcode") == 0) + { + if (len < 7) { + subtype = dns_geoip_city_postalcode; + strlcpy(de.geoip_elem.as_string, search, + sizeof(de.geoip_elem.as_string)); + } else { + cfg_obj_log(obj, lctx, ISC_LOG_ERROR, + "geoiop postal code (%s) too long", + search); + return (ISC_R_FAILURE); + } + } else if (strcasecmp(stype, "metro") == 0 || + strcasecmp(stype, "metrocode") == 0) + { subtype = dns_geoip_city_metrocode; de.geoip_elem.as_int = atoi(search); - } else if (strcasecmp(stype, "area") == 0) { + } else if (strcasecmp(stype, "area") == 0 || + strcasecmp(stype, "areacode") == 0) + { subtype = dns_geoip_city_areacode; de.geoip_elem.as_int = atoi(search); - } else if (strcasecmp(stype, "tz") == 0) { + } else if (strcasecmp(stype, "tz") == 0 || + strcasecmp(stype, "timezone") == 0) + { subtype = dns_geoip_city_timezonecode; strlcpy(de.geoip_elem.as_string, search, sizeof(de.geoip_elem.as_string)); diff --git a/lib/isccfg/namedconf.c b/lib/isccfg/namedconf.c index ec3895aebdc..bd9d6703ddd 100644 --- a/lib/isccfg/namedconf.c +++ b/lib/isccfg/namedconf.c @@ -2483,8 +2483,9 @@ static cfg_type_t cfg_type_optional_keyref = { */ static const char *geoiptype_enums[] = { "country", "country3", "countryname", "region", "regionname", - "city", "postal", "metrocode", "areacode", "timezone", "continent", - "isp", "domain", "asnum", "org", "netspeed", NULL + "city", "postalcode", "postal", "metrocode", "metro", + "areacode", "area", "timezone", "tz", "continent", "isp", + "domain", "asnum", "org", "netspeed", NULL }; static cfg_type_t cfg_type_geoiptype = { "geoiptype", cfg_parse_enum, cfg_print_ustring,