diff --git a/lib/dns/config/confctx.c b/lib/dns/config/confctx.c index 6ab5792872..a9653cbcaf 100644 --- a/lib/dns/config/confctx.c +++ b/lib/dns/config/confctx.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: confctx.c,v 1.45 2000/04/06 09:38:32 brister Exp $ */ +/* $Id: confctx.c,v 1.46 2000/04/06 20:10:56 brister Exp $ */ #include @@ -206,19 +206,11 @@ static isc_result_t cfg_set_iplist(dns_c_options_t *options, dns_c_iplist_t **fieldaddr, dns_c_iplist_t *newval, isc_boolean_t copy); -static isc_result_t cfg_set_ipmatchlist(dns_c_options_t *options, - dns_c_ipmatchlist_t **fieldaddr, - dns_c_ipmatchlist_t *newval, - isc_boolean_t copy); - static isc_result_t cfg_set_string(dns_c_options_t *options, char **field, const char *newval); -static isc_result_t cfg_get_ipmatchlist(dns_c_options_t *options, - dns_c_ipmatchlist_t *field, - dns_c_ipmatchlist_t **resval); static isc_result_t cfg_get_iplist(dns_c_options_t *options, dns_c_iplist_t *field, dns_c_iplist_t **resval); @@ -236,9 +228,12 @@ dns_c_checkconfig(dns_c_ctx_t *cfg) dns_severity_t severity; isc_int32_t intval; dns_c_ipmatchlist_t *ipml; + dns_c_iplist_t *iplist; isc_result_t result = ISC_R_SUCCESS; isc_result_t tmpres; + dns_c_rrsolist_t *olist; + if (dns_c_ctx_getnamedxfer(cfg, &cpval) != ISC_R_NOTFOUND) { isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, @@ -249,7 +244,7 @@ dns_c_checkconfig(dns_c_ctx_t *cfg) if (dns_c_ctx_getdumpfilename(cfg, &cpval) != ISC_R_NOTFOUND) { isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, - "dump-file is not yet implemented."); + "option `dump-file' is not yet implemented."); } @@ -276,6 +271,13 @@ dns_c_checkconfig(dns_c_ctx_t *cfg) } + if (dns_c_ctx_getdialup(cfg, &bval) != ISC_R_NOTFOUND) { + isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, + "option `dialup' is not yet implemted."); + } + + if (dns_c_ctx_getfakeiquery(cfg, &bval) != ISC_R_NOTFOUND) { isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, @@ -312,6 +314,20 @@ dns_c_checkconfig(dns_c_ctx_t *cfg) } + if (dns_c_ctx_getnotify(cfg, &bval) != ISC_R_NOTFOUND) { + isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, + "option `notify' is not yet implemented."); + } + + + if (dns_c_ctx_getrfc2308type1(cfg, &bval) != ISC_R_NOTFOUND) { + isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, + "option `rfc2308-type-1' is not yet " + "implemented."); + } + if (dns_c_ctx_getuseidpool(cfg, &bval) != ISC_R_NOTFOUND) { isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, @@ -319,6 +335,22 @@ dns_c_checkconfig(dns_c_ctx_t *cfg) } + if (dns_c_ctx_gettreatcrasspace(cfg, &bval) != ISC_R_NOTFOUND) { + isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, + "option `treat-cr-as-space' is obsolete."); + } + + + if (dns_c_ctx_getalsonotify(cfg, &iplist) != ISC_R_NOTFOUND) { + dns_c_iplist_detach(&iplist); + isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, + "option `also-notify' is not yet implemented."); + } + + + if ((dns_c_ctx_getchecknames(cfg, dns_trans_primary, &severity) != ISC_R_NOTFOUND) || (dns_c_ctx_getchecknames(cfg, dns_trans_secondary, @@ -331,6 +363,46 @@ dns_c_checkconfig(dns_c_ctx_t *cfg) } + if (dns_c_ctx_getblackhole(cfg, &ipml) != ISC_R_NOTFOUND) { + dns_c_ipmatchlist_detach(&ipml); + isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, + "option `blackhole' is not yet implemented."); + } + + + if (dns_c_ctx_getlamettl(cfg, &intval) != ISC_R_NOTFOUND) { + isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, + "option `lame-ttl' is not yet " + "implemented."); + } + + + if (dns_c_ctx_getmaxncachettl(cfg, &intval) != ISC_R_NOTFOUND) { + isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, + "option `max-ncache-ttl' is not yet " + "implemented."); + } + + + if (dns_c_ctx_getminroots(cfg, &intval) != ISC_R_NOTFOUND) { + isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, + "option `min-roots' is not yet " + "implemented."); + } + + + if (dns_c_ctx_getserialqueries(cfg, &intval) != ISC_R_NOTFOUND) { + isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, + "option `serial-queries' is not yet " + "implemented."); + } + + if (dns_c_ctx_getmaxlogsizeixfr(cfg, &intval) != ISC_R_NOTFOUND) { isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, @@ -339,6 +411,46 @@ dns_c_checkconfig(dns_c_ctx_t *cfg) } + if (dns_c_ctx_getcoresize(cfg, &intval) != ISC_R_NOTFOUND) { + isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, + "option `coresize' is not yet " + "implemented."); + } + + + if (dns_c_ctx_getdatasize(cfg, &intval) != ISC_R_NOTFOUND) { + isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, + "option `datasize' is not yet " + "implemented."); + } + + + if (dns_c_ctx_getfiles(cfg, &intval) != ISC_R_NOTFOUND) { + isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, + "option `files' is not yet " + "implemented."); + } + + + if (dns_c_ctx_getstacksize(cfg, &intval) != ISC_R_NOTFOUND) { + isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, + "option `stacksize' is not yet " + "implemented."); + } + + + if (dns_c_ctx_getheartbeatinterval(cfg, &intval) != ISC_R_NOTFOUND) { + isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, + "option `heartbeat-interval' is not yet " + "implemented."); + } + + if (dns_c_ctx_getstatsinterval(cfg, &intval) != ISC_R_NOTFOUND) { isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, @@ -354,6 +466,7 @@ dns_c_checkconfig(dns_c_ctx_t *cfg) "option `topology' is deprecated."); } + if (dns_c_ctx_getsortlist(cfg, &ipml) != ISC_R_NOTFOUND) { dns_c_ipmatchlist_detach(&ipml); isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, @@ -361,6 +474,13 @@ dns_c_checkconfig(dns_c_ctx_t *cfg) "option `sortlist' is not yet implemented."); } + + if (dns_c_ctx_getrrsetorderlist(cfg, &olist) != ISC_R_NOTFOUND) { + isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, + "option `rrset-order' is not yet implemented."); + } + if (dns_c_ctx_getallowupdateforwarding(cfg, &ipml) != ISC_R_NOTFOUND) { dns_c_ipmatchlist_detach(&ipml); @@ -371,13 +491,6 @@ dns_c_checkconfig(dns_c_ctx_t *cfg) } - if (dns_c_ctx_getrfc2308type1(cfg, &bval) != ISC_R_NOTFOUND) { - isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, - DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, - "option `rfc2308-type-1' is not yet " - "implemented."); - } - if (cfg->zlist != NULL) result = dns_c_zonelist_checkzones(cfg->zlist); @@ -1858,27 +1971,31 @@ dns_c_ctx_unsetchecknames(dns_c_ctx_t *cfg, -#define SETIPMLIST(FUNCNAME, FIELDNAME) \ -isc_result_t \ -PVT_CONCAT(dns_c_ctx_set, FUNCNAME)(dns_c_ctx_t *cfg, isc_boolean_t copy, \ - dns_c_ipmatchlist_t *newval) \ -{ \ - isc_result_t res; \ - \ - REQUIRE(DNS_C_CONFCTX_VALID(cfg)); \ - \ - res = make_options(cfg); \ - if (res != ISC_R_SUCCESS) { \ - return (res); \ - } \ - \ - REQUIRE(newval != NULL); \ - \ - res = cfg_set_ipmatchlist(cfg->options, &cfg->options->FIELDNAME, \ - newval, copy); \ - \ - return (res); \ -} +#define SETIPMLIST(FUNCNAME, FIELD) \ +isc_result_t \ +PVT_CONCAT(dns_c_ctx_set, FUNCNAME)(dns_c_ctx_t *cfg, \ + dns_c_ipmatchlist_t *newval) \ +{ \ + isc_result_t res; \ + \ + REQUIRE(DNS_C_CONFCTX_VALID(cfg)); \ + \ + res = make_options(cfg); \ + if (res != ISC_R_SUCCESS) { \ + return (res); \ + } \ + \ + REQUIRE(newval != NULL); \ + \ + if (cfg->options->FIELD != NULL) { \ + dns_c_ipmatchlist_detach(&cfg->options->FIELD); \ + } \ + \ + dns_c_ipmatchlist_attach(newval, &cfg->options->FIELD); \ + return (ISC_R_SUCCESS); \ +} \ + + #define GETIPMLIST(FUNC, FIELD) \ isc_result_t \ @@ -1893,10 +2010,17 @@ PVT_CONCAT(dns_c_ctx_get, FUNC)(dns_c_ctx_t *cfg, \ \ REQUIRE(retval != NULL); \ \ - return (cfg_get_ipmatchlist(cfg->options, cfg->options->FIELD, \ - retval)); \ + if (cfg->options->FIELD != NULL) { \ + dns_c_ipmatchlist_attach(cfg->options->FIELD, retval); \ + return (ISC_R_SUCCESS); \ + } else { \ + return (ISC_R_NOTFOUND); \ + } \ } + + + #define UNSETIPMLIST(FUNC, FIELD) \ isc_result_t \ PVT_CONCAT(dns_c_ctx_unset, FUNC)(dns_c_ctx_t *cfg) \ @@ -1913,172 +2037,41 @@ PVT_CONCAT(dns_c_ctx_unset, FUNC)(dns_c_ctx_t *cfg) \ } -SETIPMLIST(queryacl, queryacl) -UNSETIPMLIST(queryacl, queryacl) -GETIPMLIST(queryacl, queryacl) +SETIPMLIST(allowquery, queryacl) +UNSETIPMLIST(allowquery, queryacl) +GETIPMLIST(allowquery, queryacl) + + +SETIPMLIST(allowtransfer, transferacl) +UNSETIPMLIST(allowtransfer, transferacl) +GETIPMLIST(allowtransfer, transferacl) + + +SETIPMLIST(allowrecursion, recursionacl) +UNSETIPMLIST(allowrecursion, recursionacl) +GETIPMLIST(allowrecursion, recursionacl) + + +SETIPMLIST(blackhole, blackhole) +UNSETIPMLIST(blackhole, blackhole) +GETIPMLIST(blackhole, blackhole) + + +SETIPMLIST(topology, topology) +UNSETIPMLIST(topology, topology) +GETIPMLIST(topology, topology) + + +SETIPMLIST(sortlist, sortlist) +UNSETIPMLIST(sortlist, sortlist) +GETIPMLIST(sortlist, sortlist) + SETIPMLIST(allowupdateforwarding, allowupdateforwarding) UNSETIPMLIST(allowupdateforwarding, allowupdateforwarding) GETIPMLIST(allowupdateforwarding, allowupdateforwarding) - - - - -#if 0 - - -isc_result_t -dns_c_ctx_setqueryacl(dns_c_ctx_t *cfg, isc_boolean_t copy, - dns_c_ipmatchlist_t *iml) -{ - isc_result_t res; - - REQUIRE(DNS_C_CONFCTX_VALID(cfg)); - - res = make_options(cfg); - if (res != ISC_R_SUCCESS) { - return (res); - } - - REQUIRE(iml != NULL); - - res = cfg_set_ipmatchlist(cfg->options, &cfg->options->queryacl, - iml, copy); - - return (res); -} - - -isc_result_t -dns_c_ctx_getqueryacl(dns_c_ctx_t *cfg, dns_c_ipmatchlist_t **list) -{ - REQUIRE(DNS_C_CONFCTX_VALID(cfg)); - - if (cfg->options == NULL) { - return (ISC_R_NOTFOUND); - } - - REQUIRE(list != NULL); - - return (cfg_get_ipmatchlist(cfg->options, cfg->options->queryacl, - list)); -} - - -#endif - - -isc_result_t -dns_c_ctx_settransferacl(dns_c_ctx_t *cfg, isc_boolean_t copy, - dns_c_ipmatchlist_t *iml) -{ - isc_result_t res; - - REQUIRE(DNS_C_CONFCTX_VALID(cfg)); - - res = make_options(cfg); - if (res != ISC_R_SUCCESS) { - return (res); - } - - REQUIRE(iml != NULL); - - res = cfg_set_ipmatchlist(cfg->options, &cfg->options->transferacl, - iml, copy); - - return (res); -} - - -isc_result_t -dns_c_ctx_setrecursionacl(dns_c_ctx_t *cfg, isc_boolean_t copy, - dns_c_ipmatchlist_t *iml) -{ - isc_result_t res; - - REQUIRE(DNS_C_CONFCTX_VALID(cfg)); - - res = make_options(cfg); - if (res != ISC_R_SUCCESS) { - return (res); - } - - REQUIRE(iml != NULL); - - res = cfg_set_ipmatchlist(cfg->options, &cfg->options->recursionacl, - iml, copy); - - return (res); -} - - -isc_result_t -dns_c_ctx_setblackhole(dns_c_ctx_t *cfg, isc_boolean_t copy, - dns_c_ipmatchlist_t *iml) -{ - isc_result_t res; - - REQUIRE(DNS_C_CONFCTX_VALID(cfg)); - - res = make_options(cfg); - if (res != ISC_R_SUCCESS) { - return (res); - } - - REQUIRE(iml != NULL); - - res = cfg_set_ipmatchlist(cfg->options, &cfg->options->blackhole, - iml, copy); - - return (res); -} - - -isc_result_t -dns_c_ctx_settopology(dns_c_ctx_t *cfg, isc_boolean_t copy, - dns_c_ipmatchlist_t *iml) -{ - isc_result_t res; - - REQUIRE(DNS_C_CONFCTX_VALID(cfg)); - - res = make_options(cfg); - if (res != ISC_R_SUCCESS) { - return (res); - } - - REQUIRE(iml != NULL); - - res = cfg_set_ipmatchlist(cfg->options, &cfg->options->topology, - iml, copy); - - return (res); -} - - -isc_result_t -dns_c_ctx_setsortlist(dns_c_ctx_t *cfg, isc_boolean_t copy, - dns_c_ipmatchlist_t *iml) -{ - isc_result_t res; - - REQUIRE(DNS_C_CONFCTX_VALID(cfg)); - - res = make_options(cfg); - if (res != ISC_R_SUCCESS) { - return (res); - } - - REQUIRE(iml != NULL); - - res = cfg_set_ipmatchlist(cfg->options, &cfg->options->sortlist, - iml, copy); - - return (res); -} - isc_result_t @@ -2268,87 +2261,6 @@ dns_c_ctx_gettkeydhkey(dns_c_ctx_t *cfg, - -isc_result_t -dns_c_ctx_gettransferacl(dns_c_ctx_t *cfg, dns_c_ipmatchlist_t **list) -{ - REQUIRE(DNS_C_CONFCTX_VALID(cfg)); - - if (cfg->options == NULL) { - return (ISC_R_NOTFOUND); - } - - REQUIRE(list != NULL); - - return (cfg_get_ipmatchlist(cfg->options, - cfg->options->transferacl, list)); -} - - -isc_result_t -dns_c_ctx_getrecursionacl(dns_c_ctx_t *cfg, dns_c_ipmatchlist_t **list) -{ - REQUIRE(DNS_C_CONFCTX_VALID(cfg)); - - if (cfg->options == NULL) { - return (ISC_R_NOTFOUND); - } - - REQUIRE(list != NULL); - - return (cfg_get_ipmatchlist(cfg->options, cfg->options->recursionacl, - list)); -} - - -isc_result_t -dns_c_ctx_getblackhole(dns_c_ctx_t *cfg, dns_c_ipmatchlist_t **list) -{ - REQUIRE(DNS_C_CONFCTX_VALID(cfg)); - - if (cfg->options == NULL) { - return (ISC_R_NOTFOUND); - } - - REQUIRE(list != NULL); - - return (cfg_get_ipmatchlist(cfg->options, - cfg->options->blackhole, list)); -} - - -isc_result_t -dns_c_ctx_gettopology(dns_c_ctx_t *cfg, dns_c_ipmatchlist_t **list) -{ - REQUIRE(DNS_C_CONFCTX_VALID(cfg)); - - if (cfg->options == NULL) { - return (ISC_R_NOTFOUND); - } - - REQUIRE(list != NULL); - - return (cfg_get_ipmatchlist(cfg->options, - cfg->options->topology, list)); -} - - -isc_result_t -dns_c_ctx_getsortlist(dns_c_ctx_t *cfg, dns_c_ipmatchlist_t **list) -{ - REQUIRE(DNS_C_CONFCTX_VALID(cfg)); - - if (cfg->options == NULL) { - return (ISC_R_NOTFOUND); - } - - REQUIRE(list != NULL); - - return (cfg_get_ipmatchlist(cfg->options, - cfg->options->sortlist, list)); -} - - isc_result_t dns_c_ctx_getlistenlist(dns_c_ctx_t *cfg, dns_c_lstnlist_t **ll) { @@ -2455,14 +2367,13 @@ dns_c_ctx_gettrustedkeys(dns_c_ctx_t *cfg, dns_c_tkeylist_t **retval) } - - - +/* +** +*/ isc_result_t dns_c_ctx_setalsonotify(dns_c_ctx_t *cfg, - dns_c_iplist_t *iml, - isc_boolean_t copy) + dns_c_iplist_t *iml) { isc_result_t result; @@ -2475,10 +2386,12 @@ dns_c_ctx_setalsonotify(dns_c_ctx_t *cfg, REQUIRE(iml != NULL); - result = cfg_set_iplist(cfg->options, &cfg->options->also_notify, - iml, copy); + if (cfg->options->also_notify != NULL) + dns_c_iplist_detach(&cfg->options->also_notify); - return (result); + dns_c_iplist_attach(iml, &cfg->options->also_notify); + + return (ISC_R_SUCCESS); } @@ -2487,16 +2400,19 @@ dns_c_ctx_getalsonotify(dns_c_ctx_t *cfg, dns_c_iplist_t **ret) { REQUIRE(DNS_C_CONFCTX_VALID(cfg)); - if (cfg->options == NULL) { + if (cfg->options == NULL || cfg->options->also_notify == NULL) { return (ISC_R_NOTFOUND); } REQUIRE(ret != NULL); - return (cfg_get_iplist(cfg->options, cfg->options->also_notify, ret)); + dns_c_iplist_attach(cfg->options->also_notify, ret); + + return (ISC_R_SUCCESS); } + isc_result_t dns_c_ctx_unsetalsonotify(dns_c_ctx_t *cfg) { @@ -2517,6 +2433,9 @@ dns_c_ctx_unsetalsonotify(dns_c_ctx_t *cfg) } +/* +** +*/ isc_boolean_t @@ -2637,80 +2556,10 @@ cfg_set_iplist(dns_c_options_t *options, } -static isc_result_t -cfg_set_ipmatchlist(dns_c_options_t *options, - dns_c_ipmatchlist_t **fieldaddr, - dns_c_ipmatchlist_t *newval, - isc_boolean_t copy) -{ - isc_result_t res; - isc_boolean_t existed = ISC_FALSE; - - REQUIRE(DNS_C_CONFOPT_VALID(options)); - REQUIRE(fieldaddr != NULL); - - if (*fieldaddr != NULL) { - existed = ISC_TRUE; - } - - if (newval == NULL) { - res = dns_c_ipmatchlist_new(options->mem, fieldaddr); - } else if (copy) { - if (*fieldaddr != NULL) { - res = dns_c_ipmatchlist_empty(*fieldaddr); - if (res == ISC_R_SUCCESS && newval != NULL) { - res = dns_c_ipmatchlist_append(*fieldaddr, - newval, - ISC_FALSE); - } - } else { - res = dns_c_ipmatchlist_copy(options->mem, - fieldaddr, newval); - } - } else { - if (*fieldaddr != NULL) { - res = dns_c_ipmatchlist_detach(fieldaddr); - if (res != ISC_R_SUCCESS) { - return (res); - } - } - - res = ISC_R_SUCCESS; - - *fieldaddr = newval; - } - - if (res == ISC_R_SUCCESS && existed) { - res = ISC_R_EXISTS; - } - - return (res); -} -static isc_result_t -cfg_get_ipmatchlist(dns_c_options_t *options, - dns_c_ipmatchlist_t *field, - dns_c_ipmatchlist_t **resval) -{ - isc_result_t res; - - REQUIRE(DNS_C_CONFOPT_VALID(options)); - REQUIRE(resval != NULL); - - if (field != NULL && !ISC_LIST_EMPTY(field->elements)) { - dns_c_ipmatchlist_attach(field, resval); - res = ISC_R_SUCCESS; - } else { - *resval = NULL; - res = ISC_R_NOTFOUND; - } - - return (res); -} - static isc_result_t cfg_get_iplist(dns_c_options_t *options,