mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 23:25:38 +00:00
check for in-view zones colliding with other zone definitions; also check the syntax of the in-view zone name
This commit is contained in:
@@ -1893,7 +1893,7 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions,
|
|||||||
cfg_aclconfctx_t *actx, isc_log_t *logctx, isc_mem_t *mctx)
|
cfg_aclconfctx_t *actx, isc_log_t *logctx, isc_mem_t *mctx)
|
||||||
{
|
{
|
||||||
const char *znamestr;
|
const char *znamestr;
|
||||||
const char *typestr;
|
const char *typestr = NULL;
|
||||||
unsigned int ztype;
|
unsigned int ztype;
|
||||||
const cfg_obj_t *zoptions, *goptions = NULL;
|
const cfg_obj_t *zoptions, *goptions = NULL;
|
||||||
const cfg_obj_t *obj = NULL;
|
const cfg_obj_t *obj = NULL;
|
||||||
@@ -1937,25 +1937,8 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions,
|
|||||||
obj = NULL;
|
obj = NULL;
|
||||||
(void)cfg_map_get(zoptions, "in-view", &obj);
|
(void)cfg_map_get(zoptions, "in-view", &obj);
|
||||||
if (obj != NULL) {
|
if (obj != NULL) {
|
||||||
const cfg_obj_t *fwd = NULL;
|
ztype = CFG_ZONE_INVIEW;
|
||||||
unsigned int maxopts = 1;
|
} else {
|
||||||
(void)cfg_map_get(zoptions, "forward", &fwd);
|
|
||||||
if (fwd != NULL)
|
|
||||||
maxopts++;
|
|
||||||
fwd = NULL;
|
|
||||||
(void)cfg_map_get(zoptions, "forwarders", &fwd);
|
|
||||||
if (fwd != NULL)
|
|
||||||
maxopts++;
|
|
||||||
if (cfg_map_count(zoptions) > maxopts) {
|
|
||||||
cfg_obj_log(zconfig, logctx, ISC_LOG_ERROR,
|
|
||||||
"zone '%s': 'in-view' used "
|
|
||||||
"with incompatible zone options",
|
|
||||||
znamestr);
|
|
||||||
return (ISC_R_FAILURE);
|
|
||||||
}
|
|
||||||
return (ISC_R_SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
obj = NULL;
|
obj = NULL;
|
||||||
(void)cfg_map_get(zoptions, "type", &obj);
|
(void)cfg_map_get(zoptions, "type", &obj);
|
||||||
if (obj == NULL) {
|
if (obj == NULL) {
|
||||||
@@ -2018,6 +2001,7 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions,
|
|||||||
return (ISC_R_FAILURE);
|
return (ISC_R_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Look for an already existing zone.
|
* Look for an already existing zone.
|
||||||
@@ -2053,6 +2037,28 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions,
|
|||||||
ula = ISC_TRUE;
|
ula = ISC_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ztype == CFG_ZONE_INVIEW) {
|
||||||
|
const cfg_obj_t *fwd = NULL;
|
||||||
|
unsigned int maxopts = 1;
|
||||||
|
|
||||||
|
(void)cfg_map_get(zoptions, "forward", &fwd);
|
||||||
|
if (fwd != NULL)
|
||||||
|
maxopts++;
|
||||||
|
fwd = NULL;
|
||||||
|
(void)cfg_map_get(zoptions, "forwarders", &fwd);
|
||||||
|
if (fwd != NULL)
|
||||||
|
maxopts++;
|
||||||
|
if (cfg_map_count(zoptions) > maxopts) {
|
||||||
|
cfg_obj_log(zconfig, logctx, ISC_LOG_ERROR,
|
||||||
|
"zone '%s': 'in-view' used "
|
||||||
|
"with incompatible zone options",
|
||||||
|
znamestr);
|
||||||
|
if (result == ISC_R_SUCCESS)
|
||||||
|
result = ISC_R_FAILURE;
|
||||||
|
}
|
||||||
|
return (result);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if value is zero.
|
* Check if value is zero.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user