Commit fbed5f0f authored by Evan Hunt's avatar Evan Hunt

[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]
parent 4fa9eaf0
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
......
/*
* 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;
};
};
......@@ -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
......@@ -743,6 +743,14 @@
</section>
<section xml:id="relnotes_bugs"><info><title>Bug Fixes</title></info>
<itemizedlist>
<listitem>
<para>
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.
</para>
</listitem>
<listitem>
<para>
<command>dig</command>, <command>host</command> and
......
......@@ -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));
......
......@@ -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,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment