2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-22 10:10:06 +00:00

[master] allow primary/secondary as synonyms for master/slave

4848.	[func]		Zone types "primary" and "secondary" can now be used
			as synonyms for "master" and "slave" in named.conf.
			[RT #46713]
This commit is contained in:
Evan Hunt 2017-12-15 01:47:05 -08:00
parent d40f4c9885
commit 79c2400d91
13 changed files with 107 additions and 50 deletions

View File

@ -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 4847. [bug] dnssec-dnskey-kskonly was not being honoured for
CDS and CDNSKEY. [RT #46755] CDS and CDNSKEY. [RT #46755]

View File

@ -126,8 +126,13 @@ get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) {
element = cfg_list_next(element)) { element = cfg_list_next(element)) {
value = cfg_listelt_value(element); value = cfg_listelt_value(element);
type = cfg_tuple_get(value, "type"); 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; continue;
}
*obj = cfg_tuple_get(value, "mode"); *obj = cfg_tuple_get(value, "mode");
return (ISC_TRUE); return (ISC_TRUE);
} }
@ -243,11 +248,14 @@ configure_zone(const char *vclass, const char *view,
* Skip loading checks for any type other than * Skip loading checks for any type other than
* master and redirect * 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)); return (configure_hint(zfile, zclass, mctx));
else if ((strcasecmp(cfg_obj_asstring(typeobj), "master") != 0) && } else if ((strcasecmp(cfg_obj_asstring(typeobj), "primary") != 0) &&
(strcasecmp(cfg_obj_asstring(typeobj), "redirect") != 0)) (strcasecmp(cfg_obj_asstring(typeobj), "master") != 0) &&
(strcasecmp(cfg_obj_asstring(typeobj), "redirect") != 0))
{
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
}
/* /*
* Is the redirect zone configured as a slave? * Is the redirect zone configured as a slave?

View File

@ -422,18 +422,23 @@ named_config_getzonetype(const cfg_obj_t *zonetypeobj) {
const char *str; const char *str;
str = cfg_obj_asstring(zonetypeobj); str = cfg_obj_asstring(zonetypeobj);
if (strcasecmp(str, "master") == 0) if (strcasecmp(str, "primary") == 0 ||
strcasecmp(str, "master") == 0)
{
ztype = dns_zone_master; ztype = dns_zone_master;
else if (strcasecmp(str, "slave") == 0) } else if (strcasecmp(str, "secondary") == 0 ||
strcasecmp(str, "slave") == 0)
{
ztype = dns_zone_slave; ztype = dns_zone_slave;
else if (strcasecmp(str, "stub") == 0) } else if (strcasecmp(str, "stub") == 0) {
ztype = dns_zone_stub; ztype = dns_zone_stub;
else if (strcasecmp(str, "static-stub") == 0) } else if (strcasecmp(str, "static-stub") == 0) {
ztype = dns_zone_staticstub; ztype = dns_zone_staticstub;
else if (strcasecmp(str, "redirect") == 0) } else if (strcasecmp(str, "redirect") == 0) {
ztype = dns_zone_redirect; ztype = dns_zone_redirect;
else } else {
INSIST(0); INSIST(0);
}
return (ztype); return (ztype);
} }

View File

@ -6031,7 +6031,9 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
dns_zone_setadded(zone, added); dns_zone_setadded(zone, added);
signing = NULL; signing = NULL;
if ((strcasecmp(ztypestr, "master") == 0 || if ((strcasecmp(ztypestr, "primary") == 0 ||
strcasecmp(ztypestr, "master") == 0 ||
strcasecmp(ztypestr, "secondary") == 0 ||
strcasecmp(ztypestr, "slave") == 0) && strcasecmp(ztypestr, "slave") == 0) &&
cfg_map_get(zoptions, "inline-signing", &signing) == ISC_R_SUCCESS && cfg_map_get(zoptions, "inline-signing", &signing) == ISC_R_SUCCESS &&
cfg_obj_asboolean(signing)) cfg_obj_asboolean(signing))

View File

@ -1310,16 +1310,21 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
obj = NULL; obj = NULL;
result = named_config_get(maps, "ixfr-from-differences", &obj); result = named_config_get(maps, "ixfr-from-differences", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL); INSIST(result == ISC_R_SUCCESS && obj != NULL);
if (cfg_obj_isboolean(obj)) if (cfg_obj_isboolean(obj)) {
ixfrdiff = cfg_obj_asboolean(obj); ixfrdiff = cfg_obj_asboolean(obj);
else if (!strcasecmp(cfg_obj_asstring(obj), "master") && } else if (!strcasecmp(cfg_obj_asstring(obj), "primary") &&
ztype == dns_zone_master) !strcasecmp(cfg_obj_asstring(obj), "master") &&
ztype == dns_zone_master)
{
ixfrdiff = ISC_TRUE; ixfrdiff = ISC_TRUE;
else if (!strcasecmp(cfg_obj_asstring(obj), "slave") && } else if (!strcasecmp(cfg_obj_asstring(obj), "secondary") &&
ztype == dns_zone_slave) !strcasecmp(cfg_obj_asstring(obj), "slave") &&
ztype == dns_zone_slave)
{
ixfrdiff = ISC_TRUE; ixfrdiff = ISC_TRUE;
else } else {
ixfrdiff = ISC_FALSE; ixfrdiff = ISC_FALSE;
}
if (raw != NULL) { if (raw != NULL) {
dns_zone_setoption(raw, DNS_ZONEOPT_IXFRFROMDIFFS, dns_zone_setoption(raw, DNS_ZONEOPT_IXFRFROMDIFFS,
ISC_TRUE); ISC_TRUE);

View File

@ -130,6 +130,16 @@ view "third" {
file "file"; file "file";
auto-dnssec maintain; auto-dnssec maintain;
}; };
zone "p" {
type primary;
file "pfile";
};
zone "s" {
type secondary;
masters {
1.2.3.4;
};
};
allow-update { allow-update {
"any"; "any";
}; };

View File

@ -6,4 +6,6 @@ clone IN second in-view first
. IN second redirect . IN second redirect
clone IN third in-view first clone IN third in-view first
dnssec IN third master dnssec IN third master
p IN third primary
s IN third secondary
hostname.bind chaos chaos master hostname.bind chaos chaos master

View File

@ -46,7 +46,7 @@ view primary {
match-clients { any; }; match-clients { any; };
zone "master.example" { zone "master.example" {
type master; type primary;
file "master.db"; file "master.db";
allow-update { any; }; allow-update { any; };
allow-transfer { any; }; allow-transfer { any; };

View File

@ -36,7 +36,7 @@ controls {
}; };
zone "master.example" { zone "master.example" {
type slave; type secondary;
masters { 10.53.0.1; }; masters { 10.53.0.1; };
file "slave.db"; file "slave.db";
}; };

View File

@ -6835,13 +6835,13 @@ options {
difference set. difference set.
</para> </para>
<para><command>ixfr-from-differences</command> <para><command>ixfr-from-differences</command>
also accepts <command>master</command> and also accepts <command>master</command> (or
<command>slave</command> at the view and options <command>primary</command>) and
levels which causes <command>slave</command> (or <command>secondary</command>)
at the view and options levels, which causes
<command>ixfr-from-differences</command> to be enabled for <command>ixfr-from-differences</command> to be enabled for
all <command>master</command> or all primary or secondary zones, respectively.
<command>slave</command> zones respectively. It is off for all zones by default.
It is off by default.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@ -11686,7 +11686,7 @@ view "external" {
Statement Grammar</title></info> Statement Grammar</title></info>
<programlisting><command>zone</command> <replaceable>zone_name</replaceable> [ <replaceable>class</replaceable> ] <command>{</command> <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</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-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> ; ] [ <command>allow-transfer</command> <command>{</command> <replaceable>address_match_list</replaceable> <command>}</command> ; ]
@ -11745,7 +11745,7 @@ view "external" {
<command>}</command> ; <command>}</command> ;
<command>zone</command> <replaceable>zone_name</replaceable> [ <replaceable>class</replaceable> ] <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-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</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-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 The <command>type</command> keyword is required
for the <command>zone</command> configuration unless for the <command>zone</command> configuration unless
it is an <command>in-view</command> configuration. Its it is an <command>in-view</command> configuration. Its
acceptable values include: <varname>delegation-only</varname>, acceptable values include:
<varname>forward</varname>, <varname>hint</varname>, <varname>master</varname> (or <varname>primary</varname>),
<varname>master</varname>, <varname>redirect</varname>, <varname>slave</varname> (or <varname>secondary</varname>),
<varname>slave</varname>, <varname>static-stub</varname>, <varname>delegation-only</varname>,
<varname>forward</varname>,
<varname>hint</varname>,
<varname>redirect</varname>,
<varname>static-stub</varname>,
and <varname>stub</varname>. and <varname>stub</varname>.
</para> </para>
@ -11929,8 +11933,8 @@ view "external" {
<para> <para>
The server has a master copy of the data The server has a master copy of the data
for the zone and will be able to provide authoritative for the zone and will be able to provide authoritative
answers for answers for it. Type <varname>primary</varname> is
it. a synonym for <varname>master</varname>.
</para> </para>
</entry> </entry>
</row> </row>
@ -11943,7 +11947,9 @@ view "external" {
<entry colname="2"> <entry colname="2">
<para> <para>
A slave zone is a replica of a master 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 specifies one or more IP addresses
of master servers that the slave contacts to update of master servers that the slave contacts to update
its copy of the zone. its copy of the zone.

View File

@ -60,7 +60,10 @@
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<para> <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> </para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>

View File

@ -1979,23 +1979,27 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions,
} }
typestr = cfg_obj_asstring(obj); typestr = cfg_obj_asstring(obj);
if (strcasecmp(typestr, "master") == 0) if (strcasecmp(typestr, "master") == 0 ||
strcasecmp(typestr, "primary") == 0)
{
ztype = MASTERZONE; ztype = MASTERZONE;
else if (strcasecmp(typestr, "slave") == 0) } else if (strcasecmp(typestr, "slave") == 0 ||
strcasecmp(typestr, "secondary") == 0)
{
ztype = SLAVEZONE; ztype = SLAVEZONE;
else if (strcasecmp(typestr, "stub") == 0) } else if (strcasecmp(typestr, "stub") == 0) {
ztype = STUBZONE; ztype = STUBZONE;
else if (strcasecmp(typestr, "static-stub") == 0) } else if (strcasecmp(typestr, "static-stub") == 0) {
ztype = STATICSTUBZONE; ztype = STATICSTUBZONE;
else if (strcasecmp(typestr, "forward") == 0) } else if (strcasecmp(typestr, "forward") == 0) {
ztype = FORWARDZONE; ztype = FORWARDZONE;
else if (strcasecmp(typestr, "hint") == 0) } else if (strcasecmp(typestr, "hint") == 0) {
ztype = HINTZONE; ztype = HINTZONE;
else if (strcasecmp(typestr, "delegation-only") == 0) } else if (strcasecmp(typestr, "delegation-only") == 0) {
ztype = DELEGATIONZONE; ztype = DELEGATIONZONE;
else if (strcasecmp(typestr, "redirect") == 0) } else if (strcasecmp(typestr, "redirect") == 0) {
ztype = REDIRECTZONE; ztype = REDIRECTZONE;
else { } else {
cfg_obj_log(obj, logctx, ISC_LOG_ERROR, cfg_obj_log(obj, logctx, ISC_LOG_ERROR,
"zone '%s': invalid type %s", "zone '%s': invalid type %s",
znamestr, typestr); znamestr, typestr);
@ -3053,8 +3057,11 @@ check_rpz_catz(const char *rpz_catz, const cfg_obj_t *rpz_obj,
if (obj != NULL) if (obj != NULL)
zonetype = cfg_obj_asstring(obj); zonetype = cfg_obj_asstring(obj);
} }
if (strcasecmp(zonetype, "master") != 0 && if (strcasecmp(zonetype, "primary") != 0 &&
strcasecmp(zonetype, "slave") != 0) { strcasecmp(zonetype, "master") != 0 &&
strcasecmp(zonetype, "secondary") != 0 &&
strcasecmp(zonetype, "slave") != 0)
{
cfg_obj_log(nameobj, logctx, ISC_LOG_ERROR, cfg_obj_log(nameobj, logctx, ISC_LOG_ERROR,
"%s '%s'%s%s is not a master or slave zone", "%s '%s'%s%s is not a master or slave zone",
rpz_catz, zonename, forview, viewname); rpz_catz, zonename, forview, viewname);

View File

@ -521,7 +521,9 @@ static cfg_type_t cfg_type_rrsetorderingelement = {
* "check-names" option has a different syntax. * "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 = { static cfg_type_t cfg_type_checktype = {
"checktype", cfg_parse_enum, cfg_print_ustring, cfg_doc_enum, "checktype", cfg_parse_enum, cfg_print_ustring, cfg_doc_enum,
&cfg_rep_string, &checktype_enums &cfg_rep_string, &checktype_enums
@ -658,8 +660,9 @@ static cfg_type_t cfg_type_forwardtype = {
}; };
static const char *zonetype_enums[] = { static const char *zonetype_enums[] = {
"delegation-only", "forward", "hint", "master", "redirect", "primary", "master", "secondary", "slave",
"slave", "static-stub", "stub", NULL "delegation-only", "forward", "hint", "redirect",
"static-stub", "stub", NULL
}; };
static cfg_type_t cfg_type_zonetype = { static cfg_type_t cfg_type_zonetype = {
"zonetype", cfg_parse_enum, cfg_print_ustring, cfg_doc_enum, "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, &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 static isc_result_t
parse_ixfrdiff_type(cfg_parser_t *pctx, const cfg_type_t *type, parse_ixfrdiff_type(cfg_parser_t *pctx, const cfg_type_t *type,
cfg_obj_t **ret) cfg_obj_t **ret)