mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 22:15:20 +00:00
854. [bug] The config parser didn't properly handle config
options that were specified in units of time other than seconds. [RT #1372]
This commit is contained in:
4
CHANGES
4
CHANGES
@@ -1,3 +1,7 @@
|
||||
854. [bug] The config parser didn't properly handle config
|
||||
options that were specified in units of time other
|
||||
than seconds. [RT #1372]
|
||||
|
||||
853. [bug] configure_view_acl() failed to detach existing acls.
|
||||
[RT #1374]
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: config.c,v 1.8 2001/03/26 21:32:53 bwelling Exp $ */
|
||||
/* $Id: config.c,v 1.9 2001/06/04 21:51:23 bwelling Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -51,9 +51,9 @@ options {\n\
|
||||
fake-iquery no;\n\
|
||||
files default;\n\
|
||||
has-old-clients false;\n\
|
||||
heartbeat-interval 3600;\n\
|
||||
heartbeat-interval 60;\n\
|
||||
host-statistics no;\n\
|
||||
interface-interval 3600;\n\
|
||||
interface-interval 60;\n\
|
||||
listen-on {any;};\n\
|
||||
listen-on-v6 {none;};\n\
|
||||
match-mapped-addresses no;\n\
|
||||
@@ -75,7 +75,7 @@ options {\n\
|
||||
serial-query-rate 20;\n\
|
||||
stacksize default;\n\
|
||||
statistics-file \"named.stats\";\n\
|
||||
statistics-interval 3600;\n\
|
||||
statistics-interval 60;\n\
|
||||
tcp-clients 100;\n\
|
||||
# tkey-dhkey <none>\n\
|
||||
# tkey-gssapi-credential <none>\n\
|
||||
@@ -108,7 +108,7 @@ options {\n\
|
||||
query-source-v6 address *;\n\
|
||||
notify-source *;\n\
|
||||
notify-source-v6 *;\n\
|
||||
cleaning-interval 3600;\n\
|
||||
cleaning-interval 60;\n\
|
||||
min-roots 2;\n\
|
||||
lame-ttl 600;\n\
|
||||
max-ncache-ttl 10800; /* 3 hours */\n\
|
||||
@@ -131,10 +131,10 @@ options {\n\
|
||||
# max-ixfr-log-size <obsolete>\n\
|
||||
transfer-source *;\n\
|
||||
transfer-source-v6 *;\n\
|
||||
max-transfer-time-in 7200;\n\
|
||||
max-transfer-time-out 7200;\n\
|
||||
max-transfer-idle-in 3600;\n\
|
||||
max-transfer-idle-out 3600;\n\
|
||||
max-transfer-time-in 120;\n\
|
||||
max-transfer-time-out 120;\n\
|
||||
max-transfer-idle-in 60;\n\
|
||||
max-transfer-idle-out 60;\n\
|
||||
max-retry-time 1209600; /* 2 weeks */\n\
|
||||
min-retry-time 500;\n\
|
||||
max-refresh-time 2419200; /* 4 weeks */\n\
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: server.c,v 1.329 2001/06/04 14:08:34 marka Exp $ */
|
||||
/* $Id: server.c,v 1.330 2001/06/04 21:51:24 bwelling Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -591,7 +591,7 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
|
||||
obj = NULL;
|
||||
result = ns_config_get(maps, "cleaning-interval", &obj);
|
||||
INSIST(result == ISC_R_SUCCESS);
|
||||
dns_cache_setcleaninginterval(cache, cfg_obj_asuint32(obj));
|
||||
dns_cache_setcleaninginterval(cache, cfg_obj_asuint32(obj) * 60);
|
||||
|
||||
obj = NULL;
|
||||
result = ns_config_get(maps, "max-cache-size", &obj);
|
||||
@@ -1756,7 +1756,7 @@ load_configuration(const char *filename, ns_server_t *server,
|
||||
obj = NULL;
|
||||
result = ns_config_get(maps, "interface-interval", &obj);
|
||||
INSIST(result == ISC_R_SUCCESS);
|
||||
interface_interval = cfg_obj_asuint32(obj);
|
||||
interface_interval = cfg_obj_asuint32(obj) * 60;
|
||||
if (interface_interval == 0) {
|
||||
isc_timer_reset(server->interface_timer,
|
||||
isc_timertype_inactive,
|
||||
@@ -1775,7 +1775,7 @@ load_configuration(const char *filename, ns_server_t *server,
|
||||
obj = NULL;
|
||||
result = ns_config_get(maps, "heartbeat-interval", &obj);
|
||||
INSIST(result == ISC_R_SUCCESS);
|
||||
heartbeat_interval = cfg_obj_asuint32(obj);
|
||||
heartbeat_interval = cfg_obj_asuint32(obj) * 60;
|
||||
if (heartbeat_interval == 0) {
|
||||
isc_timer_reset(server->heartbeat_timer,
|
||||
isc_timertype_inactive,
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: zoneconf.c,v 1.85 2001/04/12 21:09:35 tale Exp $ */
|
||||
/* $Id: zoneconf.c,v 1.86 2001/06/04 21:51:26 bwelling Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -459,12 +459,12 @@ ns_zone_configure(cfg_obj_t *config, cfg_obj_t *vconfig, cfg_obj_t *zconfig,
|
||||
obj = NULL;
|
||||
result = ns_config_get(maps, "max-transfer-time-out", &obj);
|
||||
INSIST(result == ISC_R_SUCCESS);
|
||||
dns_zone_setmaxxfrout(zone, cfg_obj_asuint32(obj));
|
||||
dns_zone_setmaxxfrout(zone, cfg_obj_asuint32(obj) * 60);
|
||||
|
||||
obj = NULL;
|
||||
result = ns_config_get(maps, "max-transfer-idle-out", &obj);
|
||||
INSIST(result == ISC_R_SUCCESS);
|
||||
dns_zone_setidleout(zone, cfg_obj_asuint32(obj));
|
||||
dns_zone_setidleout(zone, cfg_obj_asuint32(obj) * 60);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -491,7 +491,8 @@ ns_zone_configure(cfg_obj_t *config, cfg_obj_t *vconfig, cfg_obj_t *zconfig,
|
||||
obj = NULL;
|
||||
result = ns_config_get(maps, "sig-validity-interval", &obj);
|
||||
INSIST(result == ISC_R_SUCCESS);
|
||||
dns_zone_setsigvalidityinterval(zone, cfg_obj_asuint32(obj));
|
||||
dns_zone_setsigvalidityinterval(zone,
|
||||
cfg_obj_asuint32(obj) * 86400);
|
||||
} else if (ztype == dns_zone_slave) {
|
||||
RETERR(configure_zone_acl(zconfig, NULL, config,
|
||||
"allow-update-forwarding", ac, zone,
|
||||
@@ -534,12 +535,12 @@ ns_zone_configure(cfg_obj_t *config, cfg_obj_t *vconfig, cfg_obj_t *zconfig,
|
||||
obj = NULL;
|
||||
result = ns_config_get(maps, "max-transfer-time-in", &obj);
|
||||
INSIST(result == ISC_R_SUCCESS);
|
||||
dns_zone_setmaxxfrin(zone, cfg_obj_asuint32(obj));
|
||||
dns_zone_setmaxxfrin(zone, cfg_obj_asuint32(obj) * 60);
|
||||
|
||||
obj = NULL;
|
||||
result = ns_config_get(maps, "max-transfer-idle-in", &obj);
|
||||
INSIST(result == ISC_R_SUCCESS);
|
||||
dns_zone_setidlein(zone, cfg_obj_asuint32(obj));
|
||||
dns_zone_setidlein(zone, cfg_obj_asuint32(obj) * 60);
|
||||
|
||||
obj = NULL;
|
||||
result = ns_config_get(maps, "max-refresh-time", &obj);
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: check.c,v 1.10 2001/06/03 23:53:50 bwelling Exp $ */
|
||||
/* $Id: check.c,v 1.11 2001/06/04 21:51:27 bwelling Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -46,6 +46,49 @@ check_forward(cfg_obj_t *options, isc_log_t *logctx) {
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
unsigned int scale;
|
||||
} intervaltable;
|
||||
|
||||
static isc_result_t
|
||||
check_options(cfg_obj_t *options, isc_log_t *logctx) {
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
unsigned int i;
|
||||
|
||||
static intervaltable intervals[] = {
|
||||
{ "cleaning-interval", 60 },
|
||||
{ "heartbeat-interval", 60 },
|
||||
{ "interface-interval", 60 },
|
||||
{ "max-transfer-idle-in", 60 },
|
||||
{ "max-transfer-idle-out", 60 },
|
||||
{ "max-transfer-time-in", 60 },
|
||||
{ "max-transfer-time-out", 60 },
|
||||
{ "sig-validity-interval", 86400},
|
||||
{ "statistics-interval", 60 },
|
||||
};
|
||||
|
||||
/*
|
||||
* Check that fields specified in units of time other than seconds
|
||||
* have reasonable values.
|
||||
*/
|
||||
for (i = 0; i < sizeof(intervals) / sizeof(intervals[0]); i++) {
|
||||
isc_uint32_t val;
|
||||
cfg_obj_t *obj = NULL;
|
||||
(void)cfg_map_get(options, intervals[i].name, &obj);
|
||||
if (obj == NULL)
|
||||
continue;
|
||||
val = cfg_obj_asuint32(obj);
|
||||
if (val > (ISC_UINT32_MAX / intervals[i].scale)) {
|
||||
cfg_obj_log(obj, logctx, ISC_LOG_ERROR,
|
||||
"%s '%d' is out of range",
|
||||
intervals[i].name, val);
|
||||
result = ISC_R_RANGE;
|
||||
}
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
#define MASTERZONE 1
|
||||
#define SLAVEZONE 2
|
||||
#define STUBZONE 4
|
||||
@@ -241,6 +284,13 @@ check_zoneconf(cfg_obj_t *zconfig, isc_symtab_t *symtab, isc_log_t *logctx) {
|
||||
if (check_forward(zoptions, logctx) != ISC_R_SUCCESS)
|
||||
result = ISC_R_FAILURE;
|
||||
|
||||
/*
|
||||
* Check various options.
|
||||
*/
|
||||
tresult = check_options(zoptions, logctx);
|
||||
if (tresult != ISC_R_SUCCESS)
|
||||
result = tresult;
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
@@ -333,6 +383,10 @@ check_viewconf(cfg_obj_t *vconfig, const char *vname, isc_log_t *logctx,
|
||||
result = ISC_R_FAILURE;
|
||||
}
|
||||
|
||||
tresult = check_options(vconfig, logctx);
|
||||
if (tresult != ISC_R_SUCCESS)
|
||||
result = tresult;
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
@@ -348,6 +402,9 @@ cfg_check_namedconf(cfg_obj_t *config, isc_log_t *logctx, isc_mem_t *mctx) {
|
||||
|
||||
(void)cfg_map_get(config, "options", &options);
|
||||
|
||||
if (options != NULL)
|
||||
check_options(options, logctx);
|
||||
|
||||
(void)cfg_map_get(config, "view", &views);
|
||||
|
||||
if (views == NULL) {
|
||||
|
Reference in New Issue
Block a user