2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00

- options named.conf statement *must* now come before any zone or view

statements.

- Post-load of named.conf check verifies a slave zone has non-empty list
  of masters defined.

- New per-zone boolean:

	enable-zone yes | no ;

- intended to let a zone be disabled without having to comment out the
  entire zone statement.

- New global and per-view option:

	max-cache-ttl number

- New global and per-view option:

	addition-data internal | minimal | maximal;
This commit is contained in:
James Brister
2000-05-15 12:36:33 +00:00
parent 27fd91edc3
commit 4932a54ed6
10 changed files with 400 additions and 91 deletions

View File

@@ -26,18 +26,16 @@ options {
statistics-file "named.stats"; // _PATH_STATS statistics-file "named.stats"; // _PATH_STATS
memstatistics-file "named.memstats"; // _PATH_MEMSTATS memstatistics-file "named.memstats"; // _PATH_MEMSTATS
additional-data minimal;
max-cache-ttl 999;
auth-nxdomain yes; // always set AA on NXDOMAIN. auth-nxdomain yes; // always set AA on NXDOMAIN.
// don't set this to 'no' unless // don't set this to 'no' unless
// you know what you're doing -- older // you know what you're doing -- older
// servers won't like it. // servers won't like it.
# Obsolete # Obsolete
deallocate-on-exit no; // Painstakingly deallocate all deallocate-on-exit no;
// objects when exiting instead of
// letting the OS clean up for us.
// Useful a memory leak is suspected.
// Final statistics are written to the
// memstatistics-file.
dialup yes; dialup yes;
# Obsolete # Obsolete
@@ -229,6 +227,7 @@ view "test-view" in {
fetch-glue true; fetch-glue true;
notify false; notify false;
rfc2308-type1 false; rfc2308-type1 false;
additional-data internal;
transfer-source 10.0.0.55; transfer-source 10.0.0.55;
transfer-source-v6 4:3:8:1:5:6:7:8; transfer-source-v6 4:3:8:1:5:6:7:8;
query-source port * address 10.0.0.54 ; query-source port * address 10.0.0.54 ;
@@ -239,6 +238,7 @@ view "test-view" in {
min-roots 3; min-roots 3;
lame-ttl 477; lame-ttl 477;
max-ncache-ttl 333; max-ncache-ttl 333;
max-cache-ttl 777;
transfer-format many-answers; transfer-format many-answers;
zone "view-zone.com" { zone "view-zone.com" {
@@ -291,9 +291,16 @@ acl can_query { !1.2.3/24; any; }; // network 1.2.3.0 mask 255.255.255.0
acl can_axfr { 1.2.3.4; can_query; }; // host 1.2.3.4 and any host allowed acl can_axfr { 1.2.3.4; can_query; }; // host 1.2.3.4 and any host allowed
// by can_query are OK // by can_query are OK
zone "disabled-zone.com" {
type master;
file "bar";
# Will make zone configurer skip this one.
enable-zone false;
};
zone "non-default-acl.demo.zone" { zone "non-default-acl.demo.zone" {
type master; type master;
disabled;
file "foo"; file "foo";
allow-query { can_query; }; allow-query { can_query; };
allow-transfer { can_axfr; }; allow-transfer { can_axfr; };

View File

@@ -15,7 +15,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
/* $Id: confcommon.c,v 1.27 2000/05/08 19:23:25 tale Exp $ */ /* $Id: confcommon.c,v 1.28 2000/05/15 12:36:19 brister Exp $ */
#include <config.h> #include <config.h>
@@ -467,6 +467,31 @@ dns_c_forward2string(dns_c_forw_t forw,
const char *
dns_c_addata2string(dns_c_addata_t addata,
isc_boolean_t printable)
{
const char *rval = NULL;
switch (addata) {
case dns_c_ad_internal:
rval = "internal";
break;
case dns_c_ad_minimal:
rval = "minimal";
break;
case dns_c_ad_maximal:
rval = "maximal";
break;
}
return (rval == NULL && printable ? "UNKNOWN_ADDITIONAL_DATA" : rval);
}
int int
dns_c_isanyaddr(isc_sockaddr_t *inaddr) { dns_c_isanyaddr(isc_sockaddr_t *inaddr) {
int result = 0; int result = 0;

View File

@@ -15,7 +15,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
/* $Id: confctx.c,v 1.56 2000/05/08 19:23:27 tale Exp $ */ /* $Id: confctx.c,v 1.57 2000/05/15 12:36:20 brister Exp $ */
#include <config.h> #include <config.h>
@@ -368,6 +368,14 @@ dns_c_checkconfig(dns_c_ctx_t *cfg)
} }
if (dns_c_ctx_getmaxcachettl(cfg, &uintval) != ISC_R_NOTFOUND) {
isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING,
"option 'max-cache-ttl' is not yet "
"implemented.");
}
if (dns_c_ctx_getminroots(cfg, &intval) != ISC_R_NOTFOUND) { if (dns_c_ctx_getminroots(cfg, &intval) != ISC_R_NOTFOUND) {
isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING,
@@ -472,8 +480,12 @@ dns_c_checkconfig(dns_c_ctx_t *cfg)
} }
if (cfg->zlist != NULL) if (cfg->zlist != NULL) {
result = dns_c_zonelist_checkzones(cfg->zlist); tmpres = dns_c_zonelist_checkzones(cfg->zlist);
if (tmpres != ISC_R_SUCCESS) {
result = tmpres;
}
}
if (cfg->views != NULL) { if (cfg->views != NULL) {
tmpres = dns_c_viewtable_checkviews(cfg->views); tmpres = dns_c_viewtable_checkviews(cfg->views);
@@ -927,6 +939,7 @@ dns_c_ctx_optionsprint(FILE *fp, int indent, dns_c_options_t *options)
PRINT_AS_SIZE_CLAUSE(files, "files"); PRINT_AS_SIZE_CLAUSE(files, "files");
PRINT_INTEGER(max_ncache_ttl, "max-ncache-ttl"); PRINT_INTEGER(max_ncache_ttl, "max-ncache-ttl");
PRINT_INTEGER(max_cache_ttl, "max-cache-ttl");
PRINT_AS_BOOLEAN(expert_mode, "expert-mode"); PRINT_AS_BOOLEAN(expert_mode, "expert-mode");
PRINT_AS_BOOLEAN(fake_iquery, "fake-iquery"); PRINT_AS_BOOLEAN(fake_iquery, "fake-iquery");
@@ -954,13 +967,19 @@ dns_c_ctx_optionsprint(FILE *fp, int indent, dns_c_options_t *options)
ISC_TRUE)); ISC_TRUE));
} }
PRINT_IP(transfer_source, "transfer-source"); PRINT_IP(transfer_source, "transfer-source");
PRINT_IP(transfer_source_v6, "transfer-source-v6"); PRINT_IP(transfer_source_v6, "transfer-source-v6");
PRINT_IPANDPORT(query_source, "query-source"); PRINT_IPANDPORT(query_source, "query-source");
PRINT_IPANDPORT(query_source_v6, "query-source-v6"); PRINT_IPANDPORT(query_source_v6, "query-source-v6");
if (options->additional_data != NULL) {
dns_c_printtabs(fp, indent + 1);
fprintf(fp, "additional_data %s;\n",
dns_c_addata2string(*options->additional_data,
ISC_TRUE));
}
PRINT_CHECKNAME(dns_trans_primary); PRINT_CHECKNAME(dns_trans_primary);
PRINT_CHECKNAME(dns_trans_secondary); PRINT_CHECKNAME(dns_trans_secondary);
PRINT_CHECKNAME(dns_trans_response); PRINT_CHECKNAME(dns_trans_response);
@@ -1397,6 +1416,7 @@ dns_c_ctx_optionsnew(isc_mem_t *mem, dns_c_options_t **options)
opts->core_size = NULL; opts->core_size = NULL;
opts->files = NULL; opts->files = NULL;
opts->max_ncache_ttl = NULL; opts->max_ncache_ttl = NULL;
opts->max_cache_ttl = NULL;
opts->expert_mode = NULL; opts->expert_mode = NULL;
opts->fake_iquery = NULL; opts->fake_iquery = NULL;
@@ -1422,6 +1442,7 @@ dns_c_ctx_optionsnew(isc_mem_t *mem, dns_c_options_t **options)
opts->query_source = NULL; opts->query_source = NULL;
opts->query_source_v6 = NULL; opts->query_source_v6 = NULL;
opts->additional_data = NULL;
opts->forward = NULL; opts->forward = NULL;
opts->tkeydhkeycp = NULL; opts->tkeydhkeycp = NULL;
@@ -1543,12 +1564,14 @@ dns_c_ctx_optionsdelete(dns_c_options_t **opts)
FREEFIELD(core_size); FREEFIELD(core_size);
FREEFIELD(files); FREEFIELD(files);
FREEFIELD(max_ncache_ttl); FREEFIELD(max_ncache_ttl);
FREEFIELD(max_cache_ttl);
FREEFIELD(transfer_source); FREEFIELD(transfer_source);
FREEFIELD(transfer_source_v6); FREEFIELD(transfer_source_v6);
FREEFIELD(query_source); FREEFIELD(query_source);
FREEFIELD(query_source_v6); FREEFIELD(query_source_v6);
FREEFIELD(additional_data);
FREEFIELD(forward); FREEFIELD(forward);
FREESTRING(tkeydomain); FREESTRING(tkeydomain);
@@ -1714,6 +1737,10 @@ GETUINT32(maxncachettl, max_ncache_ttl)
SETUINT32(maxncachettl, max_ncache_ttl) SETUINT32(maxncachettl, max_ncache_ttl)
UNSETUINT32(maxncachettl, max_ncache_ttl) UNSETUINT32(maxncachettl, max_ncache_ttl)
GETUINT32(maxcachettl, max_cache_ttl)
SETUINT32(maxcachettl, max_cache_ttl)
UNSETUINT32(maxcachettl, max_cache_ttl)
GETINT32(transfersin, transfers_in) GETINT32(transfersin, transfers_in)
SETINT32(transfersin, transfers_in) SETINT32(transfersin, transfers_in)
UNSETINT32(transfersin, transfers_in) UNSETINT32(transfersin, transfers_in)
@@ -1822,6 +1849,10 @@ GETBYTYPE(dns_transfer_format_t, transferformat, transfer_format)
SETBYTYPE(dns_transfer_format_t, transferformat, transfer_format) SETBYTYPE(dns_transfer_format_t, transferformat, transfer_format)
UNSETBYTYPE(dns_transfer_format_t, transferformat, transfer_format) UNSETBYTYPE(dns_transfer_format_t, transferformat, transfer_format)
GETBYTYPE(dns_c_addata_t, additionaldata, additional_data)
SETBYTYPE(dns_c_addata_t, additionaldata, additional_data)
UNSETBYTYPE(dns_c_addata_t, additionaldata, additional_data)

View File

@@ -16,7 +16,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
/* $Id: confparser.y,v 1.80 2000/05/11 02:18:16 gson Exp $ */ /* $Id: confparser.y,v 1.81 2000/05/15 12:36:23 brister Exp $ */
#include <config.h> #include <config.h>
@@ -114,7 +114,6 @@ static isc_lexspecials_t specials;
static isc_result_t tmpres; static isc_result_t tmpres;
static isc_boolean_t disabled; /* if "disabled" keyword was in zone */
static int debug_lexer; static int debug_lexer;
int yyparse(void); int yyparse(void);
@@ -200,6 +199,7 @@ static isc_boolean_t int_too_big(isc_uint32_t base, isc_uint32_t mult);
struct confssu_s ssu; struct confssu_s ssu;
struct confrdtype_s rdatatypelist; struct confrdtype_s rdatatypelist;
dns_rdatatype_t rdatatype; dns_rdatatype_t rdatatype;
dns_c_addata_t addata;
isc_boolean_t boolean; isc_boolean_t boolean;
dns_rdataclass_t rrclass; dns_rdataclass_t rrclass;
@@ -227,6 +227,7 @@ static isc_boolean_t int_too_big(isc_uint32_t base, isc_uint32_t mult);
%token <ip6_addr> L_IP6ADDR %token <ip6_addr> L_IP6ADDR
%token L_ACL %token L_ACL
%token L_ADDITIONAL_DATA
%token L_ADDRESS %token L_ADDRESS
%token L_ALGID %token L_ALGID
%token L_ALLOW %token L_ALLOW
@@ -255,9 +256,9 @@ static isc_boolean_t int_too_big(isc_uint32_t base, isc_uint32_t mult);
%token L_DENY %token L_DENY
%token L_DIALUP %token L_DIALUP
%token L_DIRECTORY %token L_DIRECTORY
%token L_DISABLED
%token L_DUMP_FILE %token L_DUMP_FILE
%token L_DYNAMIC %token L_DYNAMIC
%token L_ENABLE_ZONE
%token L_END_INCLUDE %token L_END_INCLUDE
%token L_EOS %token L_EOS
%token L_EXPERT_MODE %token L_EXPERT_MODE
@@ -283,6 +284,7 @@ static isc_boolean_t int_too_big(isc_uint32_t base, isc_uint32_t mult);
%token L_INCLUDE %token L_INCLUDE
%token L_INET %token L_INET
%token L_INTERFACE_INTERVAL %token L_INTERFACE_INTERVAL
%token L_INTERNAL
%token L_IXFR_TMP %token L_IXFR_TMP
%token L_KEYS %token L_KEYS
%token L_LAME_TTL %token L_LAME_TTL
@@ -295,13 +297,16 @@ static isc_boolean_t int_too_big(isc_uint32_t base, isc_uint32_t mult);
%token L_MASTERS %token L_MASTERS
%token L_MATCH_CLIENTS %token L_MATCH_CLIENTS
%token L_MAX_LOG_SIZE_IXFR %token L_MAX_LOG_SIZE_IXFR
%token L_MAX_CACHE_TTL
%token L_MAX_NCACHE_TTL %token L_MAX_NCACHE_TTL
%token L_MAX_TRANSFER_IDLE_IN %token L_MAX_TRANSFER_IDLE_IN
%token L_MAX_TRANSFER_IDLE_OUT %token L_MAX_TRANSFER_IDLE_OUT
%token L_MAX_TRANSFER_TIME_IN %token L_MAX_TRANSFER_TIME_IN
%token L_MAX_TRANSFER_TIME_OUT %token L_MAX_TRANSFER_TIME_OUT
%token L_MAXIMAL
%token L_MEMSTATS_FILE %token L_MEMSTATS_FILE
%token L_MIN_ROOTS %token L_MIN_ROOTS
%token L_MINIMAL
%token L_MULTIPLE_CNAMES %token L_MULTIPLE_CNAMES
%token L_NAME %token L_NAME
%token L_NAMED_XFER %token L_NAMED_XFER
@@ -376,6 +381,7 @@ static isc_boolean_t int_too_big(isc_uint32_t base, isc_uint32_t mult);
%token L_ZONE %token L_ZONE
%type <addata> additional_data
%type <boolean> grantp %type <boolean> grantp
%type <boolean> yea_or_nay %type <boolean> yea_or_nay
%type <forward> forward_opt %type <forward> forward_opt
@@ -472,6 +478,13 @@ options_stmt: L_OPTIONS
{ {
dns_c_options_t *options; dns_c_options_t *options;
if (currcfg->zlist != NULL || currcfg->views != NULL) {
parser_error(ISC_FALSE,
"options must come before all "
"zones and views");
YYABORT;
}
tmpres = dns_c_ctx_getoptions(currcfg, &options); tmpres = dns_c_ctx_getoptions(currcfg, &options);
if (tmpres == ISC_R_SUCCESS) { if (tmpres == ISC_R_SUCCESS) {
parser_error(ISC_FALSE, "cannot redefine options"); parser_error(ISC_FALSE, "cannot redefine options");
@@ -1240,6 +1253,19 @@ option: /* Empty */
YYABORT; YYABORT;
} }
} }
| L_MAX_CACHE_TTL L_INTEGER
{
tmpres = dns_c_ctx_setmaxcachettl(currcfg, $2);
if (tmpres == ISC_R_EXISTS) {
parser_error(ISC_FALSE,
"cannot redefine max-cache-ttl.");
YYABORT;
} else if (tmpres != ISC_R_SUCCESS) {
parser_error(ISC_FALSE,
"failed to set max-cache-ttl.");
YYABORT;
}
}
| L_HEARTBEAT L_INTEGER | L_HEARTBEAT L_INTEGER
{ {
if ( int_too_big($2, 60) ) { if ( int_too_big($2, 60) ) {
@@ -1312,6 +1338,19 @@ option: /* Empty */
YYABORT; YYABORT;
} }
} }
| L_ADDITIONAL_DATA additional_data
{
tmpres = dns_c_ctx_setadditionaldata(currcfg, $2);
if (tmpres == ISC_R_EXISTS) {
parser_error(ISC_FALSE,
"cannot redefine additional-data.");
YYABORT;
} else if (tmpres != ISC_R_SUCCESS) {
parser_error(ISC_FALSE,
"failed to set additional-data.");
YYABORT;
}
}
; ;
@@ -1688,6 +1727,19 @@ maybe_zero_port : /* nothing */
} }
; ;
additional_data: L_INTERNAL
{
$$ = dns_c_ad_internal;
}
| L_MINIMAL
{
$$ = dns_c_ad_minimal;
}
| L_MAXIMAL
{
$$ = dns_c_ad_maximal;
};
yea_or_nay: L_YES yea_or_nay: L_YES
{ {
$$ = isc_boolean_true; $$ = isc_boolean_true;
@@ -3563,6 +3615,40 @@ view_option: L_FORWARD zone_forward_opt
YYABORT; YYABORT;
} }
} }
| L_MAX_CACHE_TTL L_INTEGER
{
dns_c_view_t *view = dns_c_ctx_getcurrview(currcfg);
INSIST(view != NULL);
tmpres = dns_c_view_setmaxcachettl(view, $2);
if (tmpres == ISC_R_EXISTS) {
parser_error(ISC_FALSE,
"cannot redefine view max-cache-ttl.");
YYABORT;
} else if (tmpres != ISC_R_SUCCESS) {
parser_error(ISC_FALSE,
"failed to set view max-cache-ttl.");
YYABORT;
}
}
| L_ADDITIONAL_DATA additional_data
{
dns_c_view_t *view = dns_c_ctx_getcurrview(currcfg);
INSIST(view != NULL);
tmpres = dns_c_view_setadditionaldata(view, $2);
if (tmpres == ISC_R_EXISTS) {
parser_error(ISC_FALSE,
"cannot redefine view additional-data.");
YYABORT;
} else if (tmpres != ISC_R_SUCCESS) {
parser_error(ISC_FALSE,
"failed to set view additional-data.");
YYABORT;
}
}
| L_TRANSFER_FORMAT transfer_format | L_TRANSFER_FORMAT transfer_format
{ {
dns_c_view_t *view = dns_c_ctx_getcurrview(currcfg); dns_c_view_t *view = dns_c_ctx_getcurrview(currcfg);
@@ -3837,8 +3923,6 @@ zone_stmt: L_ZONE domain_name optional_class L_LBRACE L_TYPE zone_type L_EOS
{ {
dns_c_zone_t *zone; dns_c_zone_t *zone;
disabled = ISC_FALSE;
if (currcfg->zlist == NULL) { if (currcfg->zlist == NULL) {
tmpres = dns_c_zonelist_new(currcfg->mem, tmpres = dns_c_zonelist_new(currcfg->mem,
&currcfg->zlist); &currcfg->zlist);
@@ -3887,19 +3971,10 @@ zone_stmt: L_ZONE domain_name optional_class L_LBRACE L_TYPE zone_type L_EOS
zone = dns_c_ctx_getcurrzone(currcfg); zone = dns_c_ctx_getcurrzone(currcfg);
view = dns_c_ctx_getcurrview(currcfg); view = dns_c_ctx_getcurrview(currcfg);
if (disabled) { zone->view = view;
isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG,
ISC_LOG_WARNING, "zone '%s' is disabled",
zone->name);
dns_c_zonelist_rmzone(currcfg->zlist, zone);
zone = NULL;
} else {
zone->view = view;
if (view != NULL) { if (view != NULL) {
dns_c_view_addzone(view, zone); dns_c_view_addzone(view, zone);
}
} }
dns_c_ctx_setcurrzone(currcfg, NULL); dns_c_ctx_setcurrzone(currcfg, NULL);
@@ -4031,7 +4106,7 @@ zone_non_type_keywords: L_FILE | L_FILE_IXFR | L_IXFR_TMP | L_MASTERS |
L_MAX_TRANSFER_TIME_OUT | L_MAX_TRANSFER_IDLE_IN | L_MAX_TRANSFER_TIME_OUT | L_MAX_TRANSFER_IDLE_IN |
L_MAX_TRANSFER_IDLE_OUT | L_MAX_LOG_SIZE_IXFR | L_NOTIFY | L_MAX_TRANSFER_IDLE_OUT | L_MAX_LOG_SIZE_IXFR | L_NOTIFY |
L_MAINTAIN_IXFR_BASE | L_PUBKEY | L_ALSO_NOTIFY | L_DIALUP | L_MAINTAIN_IXFR_BASE | L_PUBKEY | L_ALSO_NOTIFY | L_DIALUP |
L_DISABLED | L_DATABASE L_ENABLE_ZONE | L_DATABASE
; ;
@@ -4491,9 +4566,22 @@ zone_option: L_FILE L_QSTRING
YYABORT; YYABORT;
} }
} }
| L_DISABLED | L_ENABLE_ZONE yea_or_nay
{ {
disabled = ISC_TRUE; dns_c_zone_t *zone = dns_c_ctx_getcurrzone(currcfg);
INSIST(zone != NULL);
tmpres = dns_c_zone_setenabled(zone, $2);
if (tmpres == ISC_R_EXISTS) {
parser_error(ISC_FALSE,
"cannot redefine enable-zone.");
YYABORT;
} else if (tmpres != ISC_R_SUCCESS) {
parser_error(ISC_FALSE,
"failed to set enable-zone.");
YYABORT;
}
} }
| L_DATABASE L_QSTRING | L_DATABASE L_QSTRING
{ {
@@ -4738,6 +4826,7 @@ static struct token keyword_tokens [] = {
{ "!", L_BANG }, { "!", L_BANG },
{ "acl", L_ACL }, { "acl", L_ACL },
{ "additional-data", L_ADDITIONAL_DATA },
{ "address", L_ADDRESS }, { "address", L_ADDRESS },
{ "algorithm", L_ALGID }, { "algorithm", L_ALGID },
{ "allow", L_ALLOW }, { "allow", L_ALLOW },
@@ -4764,9 +4853,9 @@ static struct token keyword_tokens [] = {
{ "default", L_DEFAULT }, { "default", L_DEFAULT },
{ "dialup", L_DIALUP }, { "dialup", L_DIALUP },
{ "directory", L_DIRECTORY }, { "directory", L_DIRECTORY },
{ "disabled", L_DISABLED },
{ "dump-file", L_DUMP_FILE }, { "dump-file", L_DUMP_FILE },
{ "dynamic", L_DYNAMIC }, { "dynamic", L_DYNAMIC },
{ "enable-zone", L_ENABLE_ZONE },
{ "expert-mode", L_EXPERT_MODE }, { "expert-mode", L_EXPERT_MODE },
{ "fail", L_FAIL }, { "fail", L_FAIL },
{ "fake-iquery", L_FAKE_IQUERY }, { "fake-iquery", L_FAKE_IQUERY },
@@ -4793,6 +4882,7 @@ static struct token keyword_tokens [] = {
{ "include", L_INCLUDE }, { "include", L_INCLUDE },
{ "inet", L_INET }, { "inet", L_INET },
{ "interface-interval", L_INTERFACE_INTERVAL }, { "interface-interval", L_INTERFACE_INTERVAL },
{ "internal", L_INTERNAL },
{ "ixfr-base", L_FILE_IXFR }, { "ixfr-base", L_FILE_IXFR },
{ "ixfr-tmp-file", L_IXFR_TMP }, { "ixfr-tmp-file", L_IXFR_TMP },
{ "key", L_SEC_KEY }, { "key", L_SEC_KEY },
@@ -4806,14 +4896,17 @@ static struct token keyword_tokens [] = {
{ "masters", L_MASTERS }, { "masters", L_MASTERS },
{ "match-clients", L_MATCH_CLIENTS }, { "match-clients", L_MATCH_CLIENTS },
{ "max-ixfr-log-size", L_MAX_LOG_SIZE_IXFR }, { "max-ixfr-log-size", L_MAX_LOG_SIZE_IXFR },
{ "max-cache-ttl", L_MAX_CACHE_TTL },
{ "max-ncache-ttl", L_MAX_NCACHE_TTL }, { "max-ncache-ttl", L_MAX_NCACHE_TTL },
{ "max-transfer-time-in", L_MAX_TRANSFER_TIME_IN }, { "max-transfer-time-in", L_MAX_TRANSFER_TIME_IN },
{ "max-transfer-time-out", L_MAX_TRANSFER_TIME_OUT }, { "max-transfer-time-out", L_MAX_TRANSFER_TIME_OUT },
{ "max-transfer-idle-in", L_MAX_TRANSFER_IDLE_IN }, { "max-transfer-idle-in", L_MAX_TRANSFER_IDLE_IN },
{ "max-transfer-idle-out", L_MAX_TRANSFER_IDLE_OUT }, { "max-transfer-idle-out", L_MAX_TRANSFER_IDLE_OUT },
{ "maximal", L_MAXIMAL },
{ "memstatistics-file", L_MEMSTATS_FILE }, { "memstatistics-file", L_MEMSTATS_FILE },
{ "multiple-cnames", L_MULTIPLE_CNAMES }, { "multiple-cnames", L_MULTIPLE_CNAMES },
{ "min-roots", L_MIN_ROOTS }, { "min-roots", L_MIN_ROOTS },
{ "minimal", L_MINIMAL },
{ "name", L_NAME }, { "name", L_NAME },
{ "named-xfer", L_NAMED_XFER }, { "named-xfer", L_NAMED_XFER },
{ "no", L_NO }, { "no", L_NO },

View File

@@ -15,7 +15,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
/* $Id: confview.c,v 1.27 2000/05/08 19:23:29 tale Exp $ */ /* $Id: confview.c,v 1.28 2000/05/15 12:36:26 brister Exp $ */
#include <config.h> #include <config.h>
@@ -376,6 +376,12 @@ dns_c_viewtable_checkviews(dns_c_viewtable_t *viewtable) {
"view 'max-ncache-ttl' is not yet " "view 'max-ncache-ttl' is not yet "
"implemented."); "implemented.");
if (dns_c_view_getmaxcachettl(elem, &bival) != ISC_R_NOTFOUND)
isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING,
"view 'max-cache-ttl' is not yet "
"implemented.");
if (dns_c_view_getlamettl(elem, &bival) != ISC_R_NOTFOUND) if (dns_c_view_getlamettl(elem, &bival) != ISC_R_NOTFOUND)
isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING,
@@ -474,7 +480,9 @@ dns_c_view_new(isc_mem_t *mem, const char *name, dns_rdataclass_t viewclass,
view->min_roots = NULL; view->min_roots = NULL;
view->lamettl = NULL; view->lamettl = NULL;
view->max_ncache_ttl = NULL; view->max_ncache_ttl = NULL;
view->max_cache_ttl = NULL;
view->additional_data = NULL;
view->transfer_format = NULL; view->transfer_format = NULL;
view->keydefs = NULL; view->keydefs = NULL;
view->peerlist = NULL; view->peerlist = NULL;
@@ -636,6 +644,13 @@ dns_c_view_print(FILE *fp, int indent, dns_c_view_t *view) {
PRINT_INT32(min_roots, "min-roots"); PRINT_INT32(min_roots, "min-roots");
PRINT_INT32(lamettl, "lame-ttl"); PRINT_INT32(lamettl, "lame-ttl");
PRINT_INT32(max_ncache_ttl, "max-ncache-ttl"); PRINT_INT32(max_ncache_ttl, "max-ncache-ttl");
PRINT_INT32(max_cache_ttl, "max-cache-ttl");
if (view->additional_data != NULL) {
dns_c_printtabs(fp, indent + 1);
fprintf(fp, "additional-data %s;\n",
dns_c_addata2string(*view->additional_data, ISC_TRUE));
}
if (view->transfer_format != NULL) { if (view->transfer_format != NULL) {
dns_c_printtabs(fp, indent + 1); dns_c_printtabs(fp, indent + 1);
@@ -750,7 +765,9 @@ dns_c_view_delete(dns_c_view_t **viewptr) {
FREEFIELD(min_roots); FREEFIELD(min_roots);
FREEFIELD(lamettl); FREEFIELD(lamettl);
FREEFIELD(max_ncache_ttl); FREEFIELD(max_ncache_ttl);
FREEFIELD(max_cache_ttl);
FREEFIELD(additional_data);
FREEFIELD(transfer_format); FREEFIELD(transfer_format);
dns_c_view_unsetkeydefs(view); dns_c_view_unsetkeydefs(view);
@@ -1308,6 +1325,14 @@ SETINT32(maxncachettl, max_ncache_ttl)
GETINT32(maxncachettl, max_ncache_ttl) GETINT32(maxncachettl, max_ncache_ttl)
UNSETINT32(maxncachettl, max_ncache_ttl) UNSETINT32(maxncachettl, max_ncache_ttl)
SETINT32(maxcachettl, max_cache_ttl)
GETINT32(maxcachettl, max_cache_ttl)
UNSETINT32(maxcachettl, max_cache_ttl)
GETBYTYPE(dns_c_addata_t, additionaldata, additional_data)
SETBYTYPE(dns_c_addata_t, additionaldata, additional_data)
UNSETBYTYPE(dns_c_addata_t, additionaldata, additional_data)
GETBYTYPE(dns_transfer_format_t, transferformat, transfer_format) GETBYTYPE(dns_transfer_format_t, transferformat, transfer_format)
SETBYTYPE(dns_transfer_format_t, transferformat, transfer_format) SETBYTYPE(dns_transfer_format_t, transferformat, transfer_format)

View File

@@ -15,7 +15,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
/* $Id: confzone.c,v 1.41 2000/05/13 19:46:26 tale Exp $ */ /* $Id: confzone.c,v 1.42 2000/05/15 12:36:28 brister Exp $ */
#include <config.h> #include <config.h>
@@ -195,11 +195,16 @@ dns_c_zonelist_delete(dns_c_zonelist_t **zlist) {
isc_result_t isc_result_t
dns_c_zonelist_checkzones(dns_c_zonelist_t *list) { dns_c_zonelist_checkzones(dns_c_zonelist_t *list) {
dns_c_zone_t *zone; dns_c_zone_t *zone;
dns_c_ipmatchlist_t *ipmlist = NULL; dns_c_ipmatchlist_t *ipmlist;
dns_c_iplist_t *iplist;
dns_ssutable_t *ssutable = NULL; dns_ssutable_t *ssutable = NULL;
isc_result_t result; isc_result_t tmpres;
const char *autherr = "zone `%s': allow-update is ignored when " isc_result_t result = ISC_R_SUCCESS;
"update-policy is also used."; 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)); REQUIRE(DNS_C_ZONELIST_VALID(list));
@@ -214,11 +219,12 @@ dns_c_zonelist_checkzones(dns_c_zonelist_t *list) {
* Check for allow-update and update-policty together * Check for allow-update and update-policty together
*/ */
if (zone->ztype == dns_c_zone_master) { if (zone->ztype == dns_c_zone_master) {
result = dns_c_zone_getallowupd(zone, &ipmlist); ipmlist = NULL;
if (result == ISC_R_SUCCESS) { tmpres = dns_c_zone_getallowupd(zone, &ipmlist);
result = dns_c_zone_getssuauth(zone, if (tmpres == ISC_R_SUCCESS) {
tmpres = dns_c_zone_getssuauth(zone,
&ssutable); &ssutable);
if (result == ISC_R_SUCCESS) { if (tmpres == ISC_R_SUCCESS) {
isc_log_write(dns_lctx, isc_log_write(dns_lctx,
DNS_LOGCATEGORY_CONFIG, DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG, DNS_LOGMODULE_CONFIG,
@@ -228,11 +234,28 @@ dns_c_zonelist_checkzones(dns_c_zonelist_t *list) {
} }
dns_c_ipmatchlist_detach(&ipmlist); 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 (ISC_R_SUCCESS); return (result);
} }
isc_result_t isc_result_t
@@ -464,6 +487,7 @@ dns_c_zone_new(isc_mem_t *mem,
newzone->ztype = ztype; newzone->ztype = ztype;
newzone->zclass = zclass; newzone->zclass = zclass;
newzone->view = NULL; newzone->view = NULL;
newzone->enabled = NULL;
newzone->afteropts = ISC_FALSE; newzone->afteropts = ISC_FALSE;
newzone->name = isc_mem_strdup(mem, name); newzone->name = isc_mem_strdup(mem, name);
newzone->internalname = (internalname == NULL ? newzone->internalname = (internalname == NULL ?
@@ -576,11 +600,16 @@ dns_c_zone_print(FILE *fp, int indent, dns_c_zone_t *zone) {
} }
if (zone->database != NULL) { if (zone->database != NULL) {
fprintf(fp, "\n");
dns_c_printtabs(fp, indent + 1); dns_c_printtabs(fp, indent + 1);
fprintf(fp, "database \"%s\";\n", zone->database); fprintf(fp, "database \"%s\";\n", zone->database);
} }
if (zone->enabled != NULL) {
dns_c_printtabs(fp, indent + 1);
fprintf(fp, "enable-zone %s;\n",
(*zone->enabled ? "true" : "false"));
}
dns_c_printtabs(fp, indent); dns_c_printtabs(fp, indent);
fprintf(fp, "};\n"); fprintf(fp, "};\n");
} }
@@ -3674,6 +3703,11 @@ zone_delete(dns_c_zone_t **zone) {
z->database = NULL; z->database = NULL;
} }
if (z->enabled != NULL) {
isc_mem_put(z->mem, z->enabled, sizeof (z->enabled));
z->enabled = NULL;
}
switch(z->ztype) { switch(z->ztype) {
case dns_c_zone_master: case dns_c_zone_master:
res = master_zone_clear(z->mem, &z->u.mzone); res = master_zone_clear(z->mem, &z->u.mzone);
@@ -3976,3 +4010,63 @@ dns_c_zone_unsetdatabase(dns_c_zone_t *zone)
} }
} }
isc_result_t
dns_c_zone_setenabled(dns_c_zone_t *zone, isc_boolean_t enabled)
{
isc_boolean_t existed = ISC_FALSE;
REQUIRE(DNS_C_ZONE_VALID(zone));
if (zone->enabled != NULL) {
existed = ISC_TRUE;
} else {
zone->enabled = isc_mem_get(zone->mem, sizeof (zone->enabled));
}
*zone->enabled = enabled;
if (existed) {
return (ISC_R_EXISTS);
} else {
return (ISC_R_SUCCESS);
}
}
isc_result_t
dns_c_zone_getenabled(dns_c_zone_t *zone, isc_boolean_t *retval)
{
REQUIRE(DNS_C_ZONE_VALID(zone));
REQUIRE(retval != NULL);
if (zone->enabled == NULL) {
return (ISC_R_NOTFOUND);
} else {
*retval = *zone->enabled;
return (ISC_R_SUCCESS);
}
}
isc_result_t
dns_c_zone_unsetenabled(dns_c_zone_t *zone)
{
REQUIRE(DNS_C_ZONE_VALID(zone));
if (zone->enabled == NULL) {
return (ISC_R_NOTFOUND);
} else {
isc_mem_put(zone->mem, zone->enabled, sizeof (zone->enabled));
zone->enabled = NULL;
return (ISC_R_SUCCESS);
}
}

View File

@@ -109,15 +109,6 @@ typedef enum {
dns_c_forw_nodomain dns_c_forw_nodomain
} dns_c_forw_t; } dns_c_forw_t;
/* value of a 'check-names' method */
#if 0
typedef enum {
dns_c_severity_ignore,
dns_c_severity_warn,
dns_c_severity_fail
} dns_c_severity_t;
#endif
/* Value of a 'check-names' type. */ /* Value of a 'check-names' type. */
typedef enum { typedef enum {
dns_trans_primary, dns_trans_primary,
@@ -142,13 +133,6 @@ typedef enum {
} dns_c_ordering_t; } dns_c_ordering_t;
#if 0
typedef enum {
dns_one_answer, dns_many_answers
} dns_c_transferformat_t;
#endif
/* Possible zone types */ /* Possible zone types */
typedef enum { typedef enum {
dns_c_zone_master, dns_c_zone_master,
@@ -193,35 +177,13 @@ typedef enum {
} dns_c_logseverity_t; } dns_c_logseverity_t;
#if 0 /* XXXJAB remove this */ /* Type of additional-data field */
/* Possible logging categories. */
typedef enum { typedef enum {
dns_c_cat_default, dns_c_ad_minimal,
dns_c_cat_config, dns_c_ad_maximal,
dns_c_cat_parser, dns_c_ad_internal
dns_c_cat_queries, } dns_c_addata_t;
dns_c_cat_lameservers,
dns_c_cat_statistics,
dns_c_cat_panic,
dns_c_cat_update,
dns_c_cat_ncache,
dns_c_cat_xferin,
dns_c_cat_xferout,
dns_c_cat_db,
dns_c_cat_eventlib,
dns_c_cat_packet,
dns_c_cat_notify,
dns_c_cat_cname,
dns_c_cat_security,
dns_c_cat_os,
dns_c_cat_insist,
dns_c_cat_maint,
dns_c_cat_load,
dns_c_cat_respchecks,
dns_c_cat_control,
dns_c_cat_none
} dns_c_category_t;
#endif
/* Type of the bit sets used in various structures. Macros in confpvt.h /* Type of the bit sets used in various structures. Macros in confpvt.h
* depending on this being an integer type, and some structures need more * depending on this being an integer type, and some structures need more
@@ -282,6 +244,9 @@ dns_c_nameseverity2string(dns_severity_t severity, isc_boolean_t printable);
const char * const char *
dns_c_forward2string(dns_c_forw_t forw, isc_boolean_t printable); dns_c_forward2string(dns_c_forw_t forw, isc_boolean_t printable);
const char *
dns_c_addata2string(dns_c_addata_t addata, isc_boolean_t printable);
/* /*
* The following dns_c_string2xxx() functions will look up the string * The following dns_c_string2xxx() functions will look up the string
* argument in a table of values and will return the appropriate enum/integer * argument in a table of values and will return the appropriate enum/integer

View File

@@ -140,6 +140,7 @@ struct dns_c_options {
isc_uint32_t *core_size; isc_uint32_t *core_size;
isc_uint32_t *files; isc_uint32_t *files;
isc_uint32_t *max_ncache_ttl; isc_uint32_t *max_ncache_ttl;
isc_uint32_t *max_cache_ttl;
isc_boolean_t *expert_mode; isc_boolean_t *expert_mode;
isc_boolean_t *fake_iquery; isc_boolean_t *fake_iquery;
@@ -165,6 +166,8 @@ struct dns_c_options {
isc_sockaddr_t *query_source; isc_sockaddr_t *query_source;
isc_sockaddr_t *query_source_v6; isc_sockaddr_t *query_source_v6;
dns_c_addata_t *additional_data;
dns_c_forw_t *forward; dns_c_forw_t *forward;
char *tkeydhkeycp; char *tkeydhkeycp;
@@ -544,6 +547,7 @@ dns_c_ctx_getstacksize(dns_c_ctx_t *cfg,
isc_result_t isc_result_t
dns_c_ctx_unsetstacksize(dns_c_ctx_t *cfg); dns_c_ctx_unsetstacksize(dns_c_ctx_t *cfg);
isc_result_t isc_result_t
dns_c_ctx_setcoresize(dns_c_ctx_t *cfg, isc_uint32_t newval); dns_c_ctx_setcoresize(dns_c_ctx_t *cfg, isc_uint32_t newval);
@@ -553,6 +557,7 @@ dns_c_ctx_getcoresize(dns_c_ctx_t *cfg, isc_uint32_t *retval);
isc_result_t isc_result_t
dns_c_ctx_unsetcoresize(dns_c_ctx_t *cfg); dns_c_ctx_unsetcoresize(dns_c_ctx_t *cfg);
isc_result_t isc_result_t
dns_c_ctx_setfiles(dns_c_ctx_t *cfg, isc_uint32_t newval); dns_c_ctx_setfiles(dns_c_ctx_t *cfg, isc_uint32_t newval);
@@ -562,6 +567,7 @@ dns_c_ctx_getfiles(dns_c_ctx_t *cfg, isc_uint32_t *retval);
isc_result_t isc_result_t
dns_c_ctx_unsetfiles(dns_c_ctx_t *cfg); dns_c_ctx_unsetfiles(dns_c_ctx_t *cfg);
isc_result_t isc_result_t
dns_c_ctx_setmaxncachettl(dns_c_ctx_t *cfg, isc_uint32_t newval); dns_c_ctx_setmaxncachettl(dns_c_ctx_t *cfg, isc_uint32_t newval);
@@ -571,6 +577,17 @@ dns_c_ctx_getmaxncachettl(dns_c_ctx_t *cfg, isc_uint32_t *retval);
isc_result_t isc_result_t
dns_c_ctx_unsetmaxncachettl(dns_c_ctx_t *cfg); dns_c_ctx_unsetmaxncachettl(dns_c_ctx_t *cfg);
isc_result_t
dns_c_ctx_setmaxcachettl(dns_c_ctx_t *cfg, isc_uint32_t newval);
isc_result_t
dns_c_ctx_getmaxcachettl(dns_c_ctx_t *cfg, isc_uint32_t *retval);
isc_result_t
dns_c_ctx_unsetmaxcachettl(dns_c_ctx_t *cfg);
isc_result_t isc_result_t
dns_c_ctx_setexpertmode(dns_c_ctx_t *cfg, isc_boolean_t newval); dns_c_ctx_setexpertmode(dns_c_ctx_t *cfg, isc_boolean_t newval);
@@ -762,6 +779,7 @@ dns_c_ctx_getquerysource(dns_c_ctx_t *ctx, isc_sockaddr_t *query_source);
isc_result_t isc_result_t
dns_c_ctx_unsetquerysource(dns_c_ctx_t *ctx); dns_c_ctx_unsetquerysource(dns_c_ctx_t *ctx);
isc_result_t isc_result_t
dns_c_ctx_setquerysourcev6(dns_c_ctx_t *ctx, isc_sockaddr_t query_source_v6); dns_c_ctx_setquerysourcev6(dns_c_ctx_t *ctx, isc_sockaddr_t query_source_v6);
@@ -771,6 +789,18 @@ dns_c_ctx_getquerysourcev6(dns_c_ctx_t *ctx, isc_sockaddr_t *query_source_v6);
isc_result_t isc_result_t
dns_c_ctx_unsetquerysourcev6(dns_c_ctx_t *ctx); dns_c_ctx_unsetquerysourcev6(dns_c_ctx_t *ctx);
isc_result_t
dns_c_ctx_setadditionaldata(dns_c_ctx_t *ctx, dns_c_addata_t addata);
isc_result_t
dns_c_ctx_getadditionaldata(dns_c_ctx_t *ctx, dns_c_addata_t *addata);
isc_result_t
dns_c_ctx_unsetadditionaldata(dns_c_ctx_t *ctx);
isc_result_t isc_result_t
dns_c_ctx_setforward(dns_c_ctx_t *cfg, dns_c_forw_t forward); dns_c_ctx_setforward(dns_c_ctx_t *cfg, dns_c_forw_t forward);

View File

@@ -132,7 +132,9 @@ struct dns_c_view {
isc_int32_t *min_roots; isc_int32_t *min_roots;
isc_int32_t *lamettl; isc_int32_t *lamettl;
isc_int32_t *max_ncache_ttl; isc_int32_t *max_ncache_ttl;
isc_int32_t *max_cache_ttl;
dns_c_addata_t *additional_data;
dns_transfer_format_t *transfer_format; dns_transfer_format_t *transfer_format;
dns_c_kdeflist_t *keydefs; dns_c_kdeflist_t *keydefs;
@@ -478,6 +480,7 @@ dns_c_view_setlamettl(dns_c_view_t *view, isc_int32_t newval);
isc_result_t isc_result_t
dns_c_view_unsetlamettl(dns_c_view_t *view); dns_c_view_unsetlamettl(dns_c_view_t *view);
isc_result_t isc_result_t
dns_c_view_getmaxncachettl(dns_c_view_t *view, isc_int32_t *retval); dns_c_view_getmaxncachettl(dns_c_view_t *view, isc_int32_t *retval);
@@ -487,6 +490,29 @@ dns_c_view_setmaxncachettl(dns_c_view_t *view, isc_int32_t newval);
isc_result_t isc_result_t
dns_c_view_unsetmaxncachettl(dns_c_view_t *view); dns_c_view_unsetmaxncachettl(dns_c_view_t *view);
isc_result_t
dns_c_view_getmaxcachettl(dns_c_view_t *view, isc_int32_t *retval);
isc_result_t
dns_c_view_setmaxcachettl(dns_c_view_t *view, isc_int32_t newval);
isc_result_t
dns_c_view_unsetmaxcachettl(dns_c_view_t *view);
isc_result_t
dns_c_view_setadditionaldata(dns_c_view_t *view, dns_c_addata_t newval);
isc_result_t
dns_c_view_getadditionaldata(dns_c_view_t *view, dns_c_addata_t *retval);
isc_result_t
dns_c_view_unsetadditionaldata(dns_c_view_t *cfg);
isc_result_t isc_result_t
dns_c_view_settransferformat(dns_c_view_t *view, dns_c_view_settransferformat(dns_c_view_t *view,
dns_transfer_format_t tformat); dns_transfer_format_t tformat);

View File

@@ -200,6 +200,7 @@ struct dns_c_zone {
char *database; char *database;
dns_rdataclass_t zclass; dns_rdataclass_t zclass;
dns_c_view_t *view; dns_c_view_t *view;
isc_boolean_t *enabled;
dns_c_zonetype_t ztype; dns_c_zonetype_t ztype;
union union
@@ -457,6 +458,18 @@ isc_result_t
dns_c_zone_unsetdatabase(dns_c_zone_t *zone); dns_c_zone_unsetdatabase(dns_c_zone_t *zone);
isc_result_t
dns_c_zone_setenabled(dns_c_zone_t *zone, isc_boolean_t enabled);
isc_result_t
dns_c_zone_getenabled(dns_c_zone_t *zone, isc_boolean_t *retval);
isc_result_t
dns_c_zone_unsetenabled(dns_c_zone_t *zone);
ISC_LANG_ENDDECLS ISC_LANG_ENDDECLS
#endif /* DNS_CONFZONE_H */ #endif /* DNS_CONFZONE_H */