Commit 8977ab7c authored by James Brister's avatar James Brister
Browse files

Zone configuration validation is now done at end of config file parsing,

and before loading callbacks.
parent 8d837d26
192. [bug] Zone configuration validation is now done at end
of config file parsing, and before loading
callbacks.
191. [func] Patched to compile on UnixWare 7.x. This platform
is not directly supported by the ISC.
......
......@@ -16,7 +16,7 @@
* SOFTWARE.
*/
/* $Id: confparser.y,v 1.81 2000/05/15 12:36:23 brister Exp $ */
/* $Id: confparser.y,v 1.82 2000/05/18 23:20:18 brister Exp $ */
#include <config.h>
......@@ -3981,6 +3981,11 @@ zone_stmt: L_ZONE domain_name optional_class L_LBRACE L_TYPE zone_type L_EOS
if (zone != NULL &&
callbacks != NULL && callbacks->zonecbk != NULL) {
tmpres = dns_c_zone_validate(zone);
if (tmpres != ISC_R_SUCCESS) {
YYABORT;
}
tmpres = callbacks->zonecbk(currcfg,
zone,
view,
......@@ -4582,6 +4587,11 @@ zone_option: L_FILE L_QSTRING
"failed to set enable-zone.");
YYABORT;
}
if ($2 == ISC_FALSE) {
parser_warning(ISC_FALSE, "zone '%s' is disabled",
zone->name);
}
}
| L_DATABASE L_QSTRING
{
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: confzone.c,v 1.42 2000/05/15 12:36:28 brister Exp $ */
/* $Id: confzone.c,v 1.43 2000/05/18 23:20:19 brister Exp $ */
#include <config.h>
......@@ -195,63 +195,17 @@ dns_c_zonelist_delete(dns_c_zonelist_t **zlist) {
isc_result_t
dns_c_zonelist_checkzones(dns_c_zonelist_t *list) {
dns_c_zone_t *zone;
dns_c_ipmatchlist_t *ipmlist;
dns_c_iplist_t *iplist;
dns_ssutable_t *ssutable = NULL;
isc_result_t tmpres;
isc_result_t result = ISC_R_SUCCESS;
const char *autherr = "zone '%s': allow-update is ignored when "
"update-policy is also used";
const char *nomasterserr = "zone '%s': missing 'masters' entry";
const char *emptymasterserr = "zone '%s': 'masters' value is empty";
REQUIRE(DNS_C_ZONELIST_VALID(list));
for (zone = dns_c_zonelist_firstzone(list) ;
zone != NULL ;
zone = dns_c_zonelist_nextzone(list, zone)) {
ipmlist = NULL;
ssutable = NULL;
/*
* Check for allow-update and update-policty together
*/
if (zone->ztype == dns_c_zone_master) {
ipmlist = NULL;
tmpres = dns_c_zone_getallowupd(zone, &ipmlist);
if (tmpres == ISC_R_SUCCESS) {
tmpres = dns_c_zone_getssuauth(zone,
&ssutable);
if (tmpres == ISC_R_SUCCESS) {
isc_log_write(dns_lctx,
DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG,
ISC_LOG_WARNING, autherr,
zone->name);
dns_c_zone_unsetallowupd(zone);
}
dns_c_ipmatchlist_detach(&ipmlist);
}
} else if (zone->ztype == dns_c_zone_slave) {
iplist = NULL;
tmpres = dns_c_zone_getmasterips(zone, &iplist);
if (tmpres != ISC_R_SUCCESS) {
isc_log_write(dns_lctx,
DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG,
ISC_LOG_WARNING, nomasterserr,
zone->name);
result = ISC_R_FAILURE;
} else if (iplist->nextidx == 0) {
isc_log_write(dns_lctx,
DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG,
ISC_LOG_WARNING, emptymasterserr,
zone->name);
result = ISC_R_FAILURE;
}
tmpres = dns_c_zone_validate(zone);
if (result == ISC_R_SUCCESS) {
result = tmpres;
}
}
......@@ -4068,5 +4022,56 @@ dns_c_zone_unsetenabled(dns_c_zone_t *zone)
}
isc_result_t
dns_c_zone_validate(dns_c_zone_t *zone)
{
dns_c_ipmatchlist_t *ipmlist = NULL;
dns_c_iplist_t *iplist = NULL;
dns_ssutable_t *ssutable = NULL;
isc_result_t tmpres;
isc_result_t result = ISC_R_SUCCESS;
const char *autherr = "zone '%s': allow-update is ignored when "
"update-policy is also used";
const char *nomasterserr = "zone '%s': missing 'masters' entry";
const char *emptymasterserr = "zone '%s': 'masters' value is empty";
/*
* Check for allow-update and update-policty together
*/
if (zone->ztype == dns_c_zone_master) {
tmpres = dns_c_zone_getallowupd(zone, &ipmlist);
if (tmpres == ISC_R_SUCCESS) {
tmpres = dns_c_zone_getssuauth(zone,
&ssutable);
if (tmpres == ISC_R_SUCCESS) {
isc_log_write(dns_lctx,
DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG,
ISC_LOG_WARNING, autherr,
zone->name);
dns_c_zone_unsetallowupd(zone);
}
dns_c_ipmatchlist_detach(&ipmlist);
}
} else if (zone->ztype == dns_c_zone_slave) {
iplist = NULL;
tmpres = dns_c_zone_getmasterips(zone, &iplist);
if (tmpres != ISC_R_SUCCESS) {
isc_log_write(dns_lctx,
DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG,
ISC_LOG_WARNING, nomasterserr,
zone->name);
result = ISC_R_FAILURE;
} else if (iplist->nextidx == 0) {
isc_log_write(dns_lctx,
DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG,
ISC_LOG_WARNING, emptymasterserr,
zone->name);
result = ISC_R_FAILURE;
}
}
return (result);
}
......@@ -468,6 +468,8 @@ isc_result_t
dns_c_zone_unsetenabled(dns_c_zone_t *zone);
isc_result_t
dns_c_zone_validate(dns_c_zone_t *zone);
ISC_LANG_ENDDECLS
......
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