From dd741aefc308ea86c431162257e13fc350a40952 Mon Sep 17 00:00:00 2001 From: Brian Wellington Date: Sat, 3 Mar 2001 23:05:23 +0000 Subject: [PATCH] check that 'max-cache-size' is not 'default' --- lib/isccfg/check.c | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/lib/isccfg/check.c b/lib/isccfg/check.c index 2799e1154b..b3c001703d 100644 --- a/lib/isccfg/check.c +++ b/lib/isccfg/check.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: check.c,v 1.3 2001/03/02 03:09:27 bwelling Exp $ */ +/* $Id: check.c,v 1.4 2001/03/03 23:05:23 bwelling Exp $ */ #include @@ -194,11 +194,14 @@ check_zoneconf(cfg_obj_t *zconfig, isc_log_t *logctx) { isc_result_t cfg_check_namedconf(cfg_obj_t *config, isc_log_t *logctx) { + cfg_obj_t *options = NULL; cfg_obj_t *views = NULL; cfg_obj_t *obj; cfg_listelt_t *velement; isc_result_t result = ISC_R_SUCCESS; + (void)cfg_map_get(config, "options", &options); + (void)cfg_map_get(config, "view", &views); if (views == NULL) { @@ -257,20 +260,28 @@ cfg_check_namedconf(cfg_obj_t *config, isc_log_t *logctx) { } } - if (views != NULL) { - cfg_obj_t *options = NULL; - (void)cfg_map_get(config, "options", &options); + if (views != NULL && options != NULL) { + obj = NULL; + result = cfg_map_get(options, "cache-file", &obj); + if (result == ISC_R_SUCCESS) { + cfg_obj_log(obj, logctx, ISC_LOG_ERROR, + "'cache-file' cannot be a global " + "option if views are present"); + result = ISC_R_FAILURE; + } + result = ISC_R_SUCCESS; + } - if (options != NULL) { - obj = NULL; - result = cfg_map_get(options, "cache-file", &obj); - if (result == ISC_R_SUCCESS) { - cfg_obj_log(obj, logctx, ISC_LOG_ERROR, - "'cache-file' cannot be a global " - "option if views are present"); - result = ISC_R_FAILURE; - } - result = ISC_R_SUCCESS; + if (options != NULL) { + obj = NULL; + result = cfg_map_get(options, "max-cache-size", &obj); + if (result == ISC_R_SUCCESS && + cfg_obj_isstring(obj)) + { + cfg_obj_log(obj, logctx, ISC_LOG_ERROR, + "'max-cache-size' cannot have the " + "value 'default'"); + result = ISC_R_FAILURE; } }