]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[master] fix geoip options
authorEvan Hunt <each@isc.org>
Sat, 26 Dec 2015 18:50:32 +0000 (10:50 -0800)
committerEvan Hunt <each@isc.org>
Sat, 26 Dec 2015 18:50:32 +0000 (10:50 -0800)
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]

CHANGES
bin/tests/system/geoip/options.conf [new file with mode: 0644]
bin/tests/system/geoip/tests.sh
doc/arm/notes.xml
lib/isccfg/aclconf.c
lib/isccfg/namedconf.c

diff --git a/CHANGES b/CHANGES
index 37dbbf773125064c2d572498bf2a55e8b6fd5b2a..01af9bda639d044a561f3d5505c8ec8a59d3d9e5 100644 (file)
--- 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 (file)
index 0000000..eed3fe2
--- /dev/null
@@ -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;
+        };
+};
+
index 9befdf4768f1eef15409b5142823f2a5bcbe18e1..e762983005fca9f1e802812d44021d55a739b20f 100644 (file)
@@ -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
index 9cc519eb600f3946c038067dceb70c387f3390b2..1ec28bffaa49a4b05e5a752f79c6561303dde0b7 100644 (file)
   </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
index 03dd4401ecd47807891adb3601ef5f214bcaa0de..5e10023d0e6deab9945167c4a493ed150ce4cc31 100644 (file)
@@ -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));
index ec3895aebdcf8221f90833310bfc50eb2b6a9b9f..bd9d6703ddd74adad35d8f18b05d6d9fa6fd6baf 100644 (file)
@@ -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,