]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[master] allow primary/secondary as synonyms for master/slave
authorEvan Hunt <each@isc.org>
Fri, 15 Dec 2017 09:47:05 +0000 (01:47 -0800)
committerEvan Hunt <each@isc.org>
Fri, 15 Dec 2017 09:47:05 +0000 (01:47 -0800)
4848. [func] Zone types "primary" and "secondary" can now be used
as synonyms for "master" and "slave" in named.conf.
[RT #46713]

13 files changed:
CHANGES
bin/check/named-checkconf.c
bin/named/config.c
bin/named/server.c
bin/named/zoneconf.c
bin/tests/system/checkconf/good.conf
bin/tests/system/checkconf/good.zonelist
bin/tests/system/zonechecks/ns1/named.conf
bin/tests/system/zonechecks/ns2/named.conf
doc/arm/Bv9ARM-book.xml
doc/arm/notes.xml
lib/bind9/check.c
lib/isccfg/namedconf.c

diff --git a/CHANGES b/CHANGES
index 703b411e3b4f67878f43c7e6bc75decb9299e8a2..5301833ce73df71bd2c3dbeeced1643212074682 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+4848.  [func]          Zone types "primary" and "secondary" can now be used
+                       as synonyms for "master" and "slave" in named.conf.
+                       [RT #46713]
+
 4847.  [bug]           dnssec-dnskey-kskonly was not being honoured for
                        CDS and CDNSKEY. [RT #46755]
 
index 36b88efb9c3347377bab024c94161b6a5337bf3a..0b1c33f242b735c8fa9c93db9eb73765dabcf3d3 100644 (file)
@@ -126,8 +126,13 @@ get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) {
                     element = cfg_list_next(element)) {
                        value = cfg_listelt_value(element);
                        type = cfg_tuple_get(value, "type");
-                       if (strcasecmp(cfg_obj_asstring(type), "master") != 0)
+                       if ((strcasecmp(cfg_obj_asstring(type),
+                                       "primary") != 0) &&
+                           (strcasecmp(cfg_obj_asstring(type),
+                                       "master") != 0))
+                       {
                                continue;
+                       }
                        *obj = cfg_tuple_get(value, "mode");
                        return (ISC_TRUE);
                }
@@ -243,11 +248,14 @@ configure_zone(const char *vclass, const char *view,
         * Skip loading checks for any type other than
         * master and redirect
         */
-       if (strcasecmp(cfg_obj_asstring(typeobj), "hint") == 0)
+       if (strcasecmp(cfg_obj_asstring(typeobj), "hint") == 0) {
                return (configure_hint(zfile, zclass, mctx));
-       else if ((strcasecmp(cfg_obj_asstring(typeobj), "master") != 0) &&
-                 (strcasecmp(cfg_obj_asstring(typeobj), "redirect") != 0))
+       } else if ((strcasecmp(cfg_obj_asstring(typeobj), "primary") != 0) &&
+                  (strcasecmp(cfg_obj_asstring(typeobj), "master") != 0) &&
+                  (strcasecmp(cfg_obj_asstring(typeobj), "redirect") != 0))
+       {
                return (ISC_R_SUCCESS);
+       }
 
        /*
         * Is the redirect zone configured as a slave?
index a9be410a9fc32d51bba1190c1abe7b29434e9bd6..8d7af71fb5ff6830047bfc87af217dc11b7841d5 100644 (file)
@@ -422,18 +422,23 @@ named_config_getzonetype(const cfg_obj_t *zonetypeobj) {
        const char *str;
 
        str = cfg_obj_asstring(zonetypeobj);
-       if (strcasecmp(str, "master") == 0)
+       if (strcasecmp(str, "primary") == 0 ||
+           strcasecmp(str, "master") == 0)
+       {
                ztype = dns_zone_master;
-       else if (strcasecmp(str, "slave") == 0)
+       } else if (strcasecmp(str, "secondary") == 0 ||
+                  strcasecmp(str, "slave") == 0)
+       {
                ztype = dns_zone_slave;
-       else if (strcasecmp(str, "stub") == 0)
+       } else if (strcasecmp(str, "stub") == 0) {
                ztype = dns_zone_stub;
-       else if (strcasecmp(str, "static-stub") == 0)
+       } else if (strcasecmp(str, "static-stub") == 0) {
                ztype = dns_zone_staticstub;
-       else if (strcasecmp(str, "redirect") == 0)
+       } else if (strcasecmp(str, "redirect") == 0) {
                ztype = dns_zone_redirect;
-       else
+       } else {
                INSIST(0);
+       }
        return (ztype);
 }
 
index a4e904bc5b14a99b635f3269d97792257fe65e01..c2f2f484da122b7557a47004ce1aee29f30fd13d 100644 (file)
@@ -6031,7 +6031,9 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
        dns_zone_setadded(zone, added);
 
        signing = NULL;
-       if ((strcasecmp(ztypestr, "master") == 0 ||
+       if ((strcasecmp(ztypestr, "primary") == 0 ||
+            strcasecmp(ztypestr, "master") == 0 ||
+            strcasecmp(ztypestr, "secondary") == 0 ||
             strcasecmp(ztypestr, "slave") == 0) &&
            cfg_map_get(zoptions, "inline-signing", &signing) == ISC_R_SUCCESS &&
            cfg_obj_asboolean(signing))
index 610588ed9eae49203ad027b96b4d2e3b344bd439..bf938232ef330de0d573bd3958aa20c738493398 100644 (file)
@@ -1310,16 +1310,21 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
                obj = NULL;
                result = named_config_get(maps, "ixfr-from-differences", &obj);
                INSIST(result == ISC_R_SUCCESS && obj != NULL);
-               if (cfg_obj_isboolean(obj))
+               if (cfg_obj_isboolean(obj)) {
                        ixfrdiff = cfg_obj_asboolean(obj);
-               else if (!strcasecmp(cfg_obj_asstring(obj), "master") &&
-                        ztype == dns_zone_master)
+               } else if (!strcasecmp(cfg_obj_asstring(obj), "primary") &&
+                          !strcasecmp(cfg_obj_asstring(obj), "master") &&
+                          ztype == dns_zone_master)
+               {
                        ixfrdiff = ISC_TRUE;
-               else if (!strcasecmp(cfg_obj_asstring(obj), "slave") &&
-                       ztype == dns_zone_slave)
+               } else if (!strcasecmp(cfg_obj_asstring(obj), "secondary") &&
+                          !strcasecmp(cfg_obj_asstring(obj), "slave") &&
+                          ztype == dns_zone_slave)
+               {
                        ixfrdiff = ISC_TRUE;
-               else
+               } else {
                        ixfrdiff = ISC_FALSE;
+               }
                if (raw != NULL) {
                        dns_zone_setoption(raw, DNS_ZONEOPT_IXFRFROMDIFFS,
                                           ISC_TRUE);
index f68ffb9b2ccc4fdf1e785350af651ffd5f1a3277..9e07b096f3dfc3dfb6702836ffdc03de48562eac 100644 (file)
@@ -130,6 +130,16 @@ view "third" {
                file "file";
                auto-dnssec maintain;
        };
+       zone "p" {
+               type primary;
+               file "pfile";
+       };
+       zone "s" {
+               type secondary;
+               masters {
+                       1.2.3.4;
+               };
+       };
        allow-update {
                "any";
        };
index 7cb9adf2cf508750b4183ff70f40812323a87a52..e4504fc6721a82b1f6eaaa9fcbdfd7cdf7389c14 100644 (file)
@@ -6,4 +6,6 @@ clone IN second in-view first
 . IN second redirect
 clone IN third in-view first
 dnssec IN third master
+p IN third primary
+s IN third secondary
 hostname.bind chaos chaos master
index 5d3b1ec3ab9a2cf0e3a6d519b69cb6b4e20853fd..f43ad17191576aec1e39a485e9abe34640782b80 100644 (file)
@@ -46,7 +46,7 @@ view primary {
        match-clients { any; };
 
        zone "master.example" {
-               type master;
+               type primary;
                file "master.db";
                allow-update { any; };
                allow-transfer { any; };
index 63ca71b8e4c471f8f0065e68e8fd12fa9054975c..6c2cdcf6cacf43503a30125e5d62d09b4e9fbd3b 100644 (file)
@@ -36,7 +36,7 @@ controls {
 };
 
 zone "master.example" {
-       type slave;
+       type secondary;
        masters { 10.53.0.1; };
        file "slave.db";
 };
index eca9320332d59937b950383eebc2a069ec0bc29b..2dd7fc19d949e7d59f05559551db7d8b2920e889 100644 (file)
@@ -6835,13 +6835,13 @@ options {
                  difference set.
                </para>
                <para><command>ixfr-from-differences</command>
-                 also accepts <command>master</command> and
-                 <command>slave</command> at the view and options
-                 levels which causes
+                 also accepts <command>master</command> (or
+                 <command>primary</command>) and
+                 <command>slave</command> (or <command>secondary</command>)
+                 at the view and options levels, which causes
                  <command>ixfr-from-differences</command> to be enabled for
-                 all <command>master</command> or
-                 <command>slave</command> zones respectively.
-                 It is off by default.
+                 all primary or secondary zones, respectively.
+                 It is off for all zones by default.
                </para>
              </listitem>
            </varlistentry>
@@ -11686,7 +11686,7 @@ view "external" {
            Statement Grammar</title></info>
 
 <programlisting><command>zone</command> <replaceable>zone_name</replaceable> [ <replaceable>class</replaceable> ] <command>{</command>
-    <command>type</command> master ;
+    <command>type</command> ( master | primary );
   [ <command>allow-query</command> <command>{</command> <replaceable>address_match_list</replaceable> <command>}</command> ; ]
   [ <command>allow-query-on</command> <command>{</command> <replaceable>address_match_list</replaceable> <command>}</command> ; ]
   [ <command>allow-transfer</command> <command>{</command> <replaceable>address_match_list</replaceable> <command>}</command> ; ]
@@ -11745,7 +11745,7 @@ view "external" {
 <command>}</command> ;
 
 <command>zone</command> <replaceable>zone_name</replaceable> [ <replaceable>class</replaceable> ] <command>{</command>
-    <command>type</command> slave ;
+    <command>type</command> (slave | secondary);
   [ <command>allow-notify</command> <command>{</command> <replaceable>address_match_list</replaceable> <command>}</command> ; ]
   [ <command>allow-query</command> <command>{</command> <replaceable>address_match_list</replaceable> <command>}</command> ; ]
   [ <command>allow-query-on</command> <command>{</command> <replaceable>address_match_list</replaceable> <command>}</command> ; ]
@@ -11905,10 +11905,14 @@ view "external" {
              The <command>type</command> keyword is required
              for the <command>zone</command> configuration unless
              it is an <command>in-view</command> configuration. Its
-             acceptable values include: <varname>delegation-only</varname>,
-             <varname>forward</varname>, <varname>hint</varname>,
-             <varname>master</varname>, <varname>redirect</varname>,
-             <varname>slave</varname>, <varname>static-stub</varname>,
+             acceptable values include:
+             <varname>master</varname> (or <varname>primary</varname>),
+             <varname>slave</varname> (or <varname>secondary</varname>),
+             <varname>delegation-only</varname>,
+             <varname>forward</varname>,
+             <varname>hint</varname>,
+             <varname>redirect</varname>,
+             <varname>static-stub</varname>,
              and <varname>stub</varname>.
            </para>
 
@@ -11929,8 +11933,8 @@ view "external" {
                      <para>
                        The server has a master copy of the data
                        for the zone and will be able to provide authoritative
-                       answers for
-                       it.
+                       answers for it. Type <varname>primary</varname> is
+                       a synonym for <varname>master</varname>.
                      </para>
                    </entry>
                  </row>
@@ -11943,7 +11947,9 @@ view "external" {
                    <entry colname="2">
                      <para>
                        A slave zone is a replica of a master
-                       zone. The <command>masters</command> list
+                       zone. Type <varname>secondary</varname> is a
+                       synonym for <varname>slave</varname>.
+                       The <command>masters</command> list
                        specifies one or more IP addresses
                        of master servers that the slave contacts to update
                        its copy of the zone.
index f8ae123b42daae7cb8fd40eb6d4a088ca60c34f1..7f2a702ee820d90177b15d1f5de6ad60601e9553 100644 (file)
     <itemizedlist>
       <listitem>
        <para>
-         None.
+         Zone types <command>primary</command> and
+         <command>secondary</command> are now available as synonyms for
+         <command>master</command> and <command>slave</command>,
+         respectively, in <filename>named.conf</filename>.
        </para>
       </listitem>
     </itemizedlist>
index 0645cc44cce42e79c6ce8a68a206e0e5c158fd1a..44e416ce887c2c6b1f6895301bbb6166539c8bc3 100644 (file)
@@ -1979,23 +1979,27 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions,
        }
 
        typestr = cfg_obj_asstring(obj);
-       if (strcasecmp(typestr, "master") == 0)
+       if (strcasecmp(typestr, "master") == 0 ||
+           strcasecmp(typestr, "primary") == 0)
+       {
                ztype = MASTERZONE;
-       else if (strcasecmp(typestr, "slave") == 0)
+       } else if (strcasecmp(typestr, "slave") == 0 ||
+                  strcasecmp(typestr, "secondary") == 0)
+       {
                ztype = SLAVEZONE;
-       else if (strcasecmp(typestr, "stub") == 0)
+       } else if (strcasecmp(typestr, "stub") == 0) {
                ztype = STUBZONE;
-       else if (strcasecmp(typestr, "static-stub") == 0)
+       } else if (strcasecmp(typestr, "static-stub") == 0) {
                ztype = STATICSTUBZONE;
-       else if (strcasecmp(typestr, "forward") == 0)
+       } else if (strcasecmp(typestr, "forward") == 0) {
                ztype = FORWARDZONE;
-       else if (strcasecmp(typestr, "hint") == 0)
+       } else if (strcasecmp(typestr, "hint") == 0) {
                ztype = HINTZONE;
-       else if (strcasecmp(typestr, "delegation-only") == 0)
+       } else if (strcasecmp(typestr, "delegation-only") == 0) {
                ztype = DELEGATIONZONE;
-       else if (strcasecmp(typestr, "redirect") == 0)
+       } else if (strcasecmp(typestr, "redirect") == 0) {
                ztype = REDIRECTZONE;
-       else {
+       else {
                cfg_obj_log(obj, logctx, ISC_LOG_ERROR,
                            "zone '%s': invalid type %s",
                            znamestr, typestr);
@@ -3053,8 +3057,11 @@ check_rpz_catz(const char *rpz_catz, const cfg_obj_t *rpz_obj,
                        if (obj != NULL)
                                zonetype = cfg_obj_asstring(obj);
                }
-               if (strcasecmp(zonetype, "master") != 0 &&
-                   strcasecmp(zonetype, "slave") != 0) {
+               if (strcasecmp(zonetype, "primary") != 0 &&
+                   strcasecmp(zonetype, "master") != 0 &&
+                   strcasecmp(zonetype, "secondary") != 0 &&
+                   strcasecmp(zonetype, "slave") != 0)
+               {
                        cfg_obj_log(nameobj, logctx, ISC_LOG_ERROR,
                                    "%s '%s'%s%s is not a master or slave zone",
                                    rpz_catz, zonename, forview, viewname);
index e84ea17bb9377349c3d881d811322b2da90603a6..f531fba5ba64f1fc67ce2400c498c34bf6b7393e 100644 (file)
@@ -521,7 +521,9 @@ static cfg_type_t cfg_type_rrsetorderingelement = {
  * "check-names" option has a different syntax.
  */
 
-static const char *checktype_enums[] = { "master", "slave", "response", NULL };
+static const char *checktype_enums[] = {
+       "primary", "master", "secondary", "slave", "response", NULL
+};
 static cfg_type_t cfg_type_checktype = {
        "checktype", cfg_parse_enum, cfg_print_ustring, cfg_doc_enum,
        &cfg_rep_string, &checktype_enums
@@ -658,8 +660,9 @@ static cfg_type_t cfg_type_forwardtype = {
 };
 
 static const char *zonetype_enums[] = {
-       "delegation-only", "forward", "hint", "master", "redirect",
-       "slave", "static-stub", "stub", NULL
+       "primary", "master", "secondary", "slave",
+       "delegation-only", "forward", "hint", "redirect",
+       "static-stub", "stub", NULL
 };
 static cfg_type_t cfg_type_zonetype = {
        "zonetype", cfg_parse_enum, cfg_print_ustring, cfg_doc_enum,
@@ -2719,7 +2722,9 @@ static cfg_type_t cfg_type_minimal = {
        &cfg_rep_string, minimal_enums,
 };
 
-static const char *ixfrdiff_enums[] = { "master", "slave", NULL };
+static const char *ixfrdiff_enums[] = {
+       "primary", "master", "secondary", "slave", NULL
+};
 static isc_result_t
 parse_ixfrdiff_type(cfg_parser_t *pctx, const cfg_type_t *type,
                    cfg_obj_t **ret)