Commit 69b691c9 authored by James Brister's avatar James Brister
Browse files

Support new 'port' clause in config file options section. Causes

'listen-on', 'masters' and 'also-notify' statements to use its value
instead of default (53).
parent 527bf549
231. [func] Support new 'port' clause in config file options
section. Causes 'listen-on', 'masters' and
'also-notify' statements to use its value instead of
default (53).
230. [func] Replace the dst sign/verify API with a cleaner one.
229. [func] Support config file sig-validity-interval statement
......
......@@ -18,6 +18,8 @@ options {
version "my version string";
directory "/tmp";
port 666;
sig-validity-interval 33;
# Obsolete
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: confctx.c,v 1.59 2000/06/02 17:31:33 gson Exp $ */
/* $Id: confctx.c,v 1.60 2000/06/04 19:51:13 brister Exp $ */
#include <config.h>
......@@ -778,7 +778,7 @@ dns_c_ctx_print(FILE *fp, int indent, dns_c_ctx_t *cfg)
if (cfg->zlist != NULL) {
dns_c_zonelist_print(fp, indent, cfg->zlist);
dns_c_zonelist_print(fp, indent, cfg->zlist, NULL);
fprintf(fp, "\n");
}
......@@ -801,6 +801,7 @@ dns_c_ctx_optionsprint(FILE *fp, int indent, dns_c_options_t *options)
{
dns_severity_t nameseverity;
in_port_t port;
in_port_t defport = DNS_C_DEFAULTPORT;
REQUIRE(fp != NULL);
......@@ -810,6 +811,10 @@ dns_c_ctx_optionsprint(FILE *fp, int indent, dns_c_options_t *options)
REQUIRE(DNS_C_CONFOPT_VALID(options));
if (options->port != NULL) {
defport = *options->port;
}
#define PRINT_INTEGER(FIELD, NAME) \
if (options->FIELD != NULL) { \
dns_c_printtabs(fp, indent + 1); \
......@@ -903,6 +908,8 @@ dns_c_ctx_optionsprint(FILE *fp, int indent, dns_c_options_t *options)
PRINT_CHAR_P(memstats_filename, "memstatistics-file");
PRINT_CHAR_P(named_xfer, "named-xfer");
PRINT_INTEGER(port, "port");
PRINT_INTEGER(transfers_in, "transfers-in");
PRINT_INTEGER(transfers_per_ns, "transfers-per-ns");
PRINT_INTEGER(transfers_out, "transfers-out");
......@@ -991,7 +998,8 @@ dns_c_ctx_optionsprint(FILE *fp, int indent, dns_c_options_t *options)
if (options->listens != NULL) {
dns_c_lstnlist_print(fp, indent + 1,
options->listens);
options->listens,
defport);
}
dns_c_ctx_forwarderprint(fp, indent + 1, options);
......@@ -1387,6 +1395,8 @@ dns_c_ctx_optionsnew(isc_mem_t *mem, dns_c_options_t **options)
opts->memstats_filename = NULL;
opts->named_xfer = NULL;
opts->port = NULL;
opts->transfers_in = NULL;
opts->transfers_per_ns = NULL;
opts->transfers_out = NULL;
......@@ -1536,6 +1546,8 @@ dns_c_ctx_optionsdelete(dns_c_options_t **opts)
FREEFIELD(treat_cr_as_space);
FREEFIELD(port);
FREEFIELD(transfers_in);
FREEFIELD(transfers_per_ns);
FREEFIELD(transfers_out);
......@@ -1631,233 +1643,288 @@ SETSTRING(directory, directory)
GETSTRING(directory, directory)
UNSETSTRING(directory, directory)
SETSTRING(version, version)
GETSTRING(version, version)
UNSETSTRING(version, version)
SETSTRING(dumpfilename, dump_filename)
GETSTRING(dumpfilename, dump_filename)
UNSETSTRING(dumpfilename, dump_filename)
SETSTRING(pidfilename, pid_filename)
GETSTRING(pidfilename, pid_filename)
UNSETSTRING(pidfilename, pid_filename)
SETSTRING(statsfilename, stats_filename)
GETSTRING(statsfilename, stats_filename)
UNSETSTRING(statsfilename, stats_filename)
SETSTRING(memstatsfilename, memstats_filename)
GETSTRING(memstatsfilename, memstats_filename)
UNSETSTRING(memstatsfilename, memstats_filename)
SETSTRING(namedxfer, named_xfer)
GETSTRING(namedxfer, named_xfer)
UNSETSTRING(namedxfer, named_xfer)
GETBYTYPE(in_port_t, port, port)
SETBYTYPE(in_port_t, port, port)
UNSETBYTYPE(in_port_t, port, port)
GETBOOL(expertmode, expert_mode)
SETBOOL(expertmode, expert_mode)
UNSETBOOL(expertmode, expert_mode)
GETBOOL(fakeiquery, fake_iquery)
SETBOOL(fakeiquery, fake_iquery)
UNSETBOOL(fakeiquery, fake_iquery)
GETBOOL(recursion, recursion)
SETBOOL(recursion, recursion)
UNSETBOOL(recursion, recursion)
GETBOOL(fetchglue, fetch_glue)
SETBOOL(fetchglue, fetch_glue)
UNSETBOOL(fetchglue, fetch_glue)
GETBOOL(notify, notify)
SETBOOL(notify, notify)
UNSETBOOL(notify, notify)
GETBOOL(hoststatistics, host_statistics)
SETBOOL(hoststatistics, host_statistics)
UNSETBOOL(hoststatistics, host_statistics)
GETBOOL(dealloconexit, dealloc_on_exit)
SETBOOL(dealloconexit, dealloc_on_exit)
UNSETBOOL(dealloconexit, dealloc_on_exit)
GETBOOL(useixfr, use_ixfr)
SETBOOL(useixfr, use_ixfr)
UNSETBOOL(useixfr, use_ixfr)
GETBOOL(maintainixfrbase, maintain_ixfr_base)
SETBOOL(maintainixfrbase, maintain_ixfr_base)
UNSETBOOL(maintainixfrbase, maintain_ixfr_base)
GETBOOL(hasoldclients, has_old_clients)
SETBOOL(hasoldclients, has_old_clients)
UNSETBOOL(hasoldclients, has_old_clients)
GETBOOL(authnxdomain, auth_nx_domain)
SETBOOL(authnxdomain, auth_nx_domain)
UNSETBOOL(authnxdomain, auth_nx_domain)
GETBOOL(multiplecnames, multiple_cnames)
SETBOOL(multiplecnames, multiple_cnames)
UNSETBOOL(multiplecnames, multiple_cnames)
GETBOOL(useidpool, use_id_pool)
SETBOOL(useidpool, use_id_pool)
UNSETBOOL(useidpool, use_id_pool)
GETBOOL(dialup, dialup)
SETBOOL(dialup, dialup)
UNSETBOOL(dialup, dialup)
GETBOOL(rfc2308type1, rfc2308_type1)
SETBOOL(rfc2308type1, rfc2308_type1)
UNSETBOOL(rfc2308type1, rfc2308_type1)
GETBOOL(requestixfr, request_ixfr)
SETBOOL(requestixfr, request_ixfr)
UNSETBOOL(requestixfr, request_ixfr)
GETBOOL(provideixfr, provide_ixfr)
SETBOOL(provideixfr, provide_ixfr)
UNSETBOOL(provideixfr, provide_ixfr)
GETBOOL(treatcrasspace, treat_cr_as_space)
SETBOOL(treatcrasspace, treat_cr_as_space)
UNSETBOOL(treatcrasspace, treat_cr_as_space)
GETUINT32(maxncachettl, max_ncache_ttl)
SETUINT32(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)
SETINT32(transfersin, transfers_in)
UNSETINT32(transfersin, transfers_in)
GETINT32(transfersperns, transfers_per_ns)
SETINT32(transfersperns, transfers_per_ns)
UNSETINT32(transfersperns, transfers_per_ns)
GETINT32(transfersout, transfers_out)
SETINT32(transfersout, transfers_out)
UNSETINT32(transfersout, transfers_out)
GETINT32(maxlogsizeixfr, max_log_size_ixfr)
SETINT32(maxlogsizeixfr, max_log_size_ixfr)
UNSETINT32(maxlogsizeixfr, max_log_size_ixfr)
GETINT32(cleaninterval, clean_interval)
SETINT32(cleaninterval, clean_interval)
UNSETINT32(cleaninterval, clean_interval)
GETINT32(interfaceinterval, interface_interval)
SETINT32(interfaceinterval, interface_interval)
UNSETINT32(interfaceinterval, interface_interval)
GETINT32(statsinterval, stats_interval)
SETINT32(statsinterval, stats_interval)
UNSETINT32(statsinterval, stats_interval)
GETINT32(heartbeatinterval, heartbeat_interval)
SETINT32(heartbeatinterval, heartbeat_interval)
UNSETINT32(heartbeatinterval, heartbeat_interval)
GETINT32(maxtransfertimein, max_transfer_time_in)
SETINT32(maxtransfertimein, max_transfer_time_in)
UNSETINT32(maxtransfertimein, max_transfer_time_in)
GETINT32(maxtransfertimeout, max_transfer_time_out)
SETINT32(maxtransfertimeout, max_transfer_time_out)
UNSETINT32(maxtransfertimeout, max_transfer_time_out)
GETINT32(maxtransferidlein, max_transfer_idle_in)
SETINT32(maxtransferidlein, max_transfer_idle_in)
UNSETINT32(maxtransferidlein, max_transfer_idle_in)
GETINT32(maxtransferidleout, max_transfer_idle_out)
SETINT32(maxtransferidleout, max_transfer_idle_out)
UNSETINT32(maxtransferidleout, max_transfer_idle_out)
GETINT32(lamettl, lamettl)
SETINT32(lamettl, lamettl)
UNSETINT32(lamettl, lamettl)
GETINT32(tcpclients, tcp_clients)
SETINT32(tcpclients, tcp_clients)
UNSETINT32(tcpclients, tcp_clients)
GETINT32(recursiveclients, recursive_clients)
SETINT32(recursiveclients, recursive_clients)
UNSETINT32(recursiveclients, recursive_clients)
GETINT32(minroots, min_roots)
SETINT32(minroots, min_roots)
UNSETINT32(minroots, min_roots)
GETINT32(serialqueries, serial_queries)
SETINT32(serialqueries, serial_queries)
UNSETINT32(serialqueries, serial_queries)
GETINT32(sigvalidityinterval, sig_valid_interval)
SETINT32(sigvalidityinterval, sig_valid_interval)
UNSETINT32(sigvalidityinterval, sig_valid_interval)
GETUINT32(datasize, data_size)
SETUINT32(datasize, data_size)
UNSETUINT32(datasize, data_size)
GETUINT32(stacksize, stack_size)
SETUINT32(stacksize, stack_size)
UNSETUINT32(stacksize, stack_size)
GETUINT32(coresize, core_size)
SETUINT32(coresize, core_size)
UNSETUINT32(coresize, core_size)
GETUINT32(files, files)
SETUINT32(files, files)
UNSETUINT32(files, files)
GETUINT32(maxncachettl, max_ncache_ttl)
SETUINT32(maxncachettl, max_ncache_ttl)
UNSETUINT32(maxncachettl, max_ncache_ttl)
GETUINT32(maxcachettl, max_cache_ttl)
SETUINT32(maxcachettl, max_cache_ttl)
UNSETUINT32(maxcachettl, max_cache_ttl)
GETBOOL(expertmode, expert_mode)
SETBOOL(expertmode, expert_mode)
UNSETBOOL(expertmode, expert_mode)
GETBOOL(fakeiquery, fake_iquery)
SETBOOL(fakeiquery, fake_iquery)
UNSETBOOL(fakeiquery, fake_iquery)
GETBOOL(recursion, recursion)
SETBOOL(recursion, recursion)
UNSETBOOL(recursion, recursion)
GETBOOL(fetchglue, fetch_glue)
SETBOOL(fetchglue, fetch_glue)
UNSETBOOL(fetchglue, fetch_glue)
GETBOOL(notify, notify)
SETBOOL(notify, notify)
UNSETBOOL(notify, notify)
GETBOOL(hoststatistics, host_statistics)
SETBOOL(hoststatistics, host_statistics)
UNSETBOOL(hoststatistics, host_statistics)
GETBOOL(dealloconexit, dealloc_on_exit)
SETBOOL(dealloconexit, dealloc_on_exit)
UNSETBOOL(dealloconexit, dealloc_on_exit)
GETBOOL(useixfr, use_ixfr)
SETBOOL(useixfr, use_ixfr)
UNSETBOOL(useixfr, use_ixfr)
GETBOOL(maintainixfrbase, maintain_ixfr_base)
SETBOOL(maintainixfrbase, maintain_ixfr_base)
UNSETBOOL(maintainixfrbase, maintain_ixfr_base)
GETBOOL(hasoldclients, has_old_clients)
SETBOOL(hasoldclients, has_old_clients)
UNSETBOOL(hasoldclients, has_old_clients)
GETBOOL(authnxdomain, auth_nx_domain)
SETBOOL(authnxdomain, auth_nx_domain)
UNSETBOOL(authnxdomain, auth_nx_domain)
GETBOOL(multiplecnames, multiple_cnames)
SETBOOL(multiplecnames, multiple_cnames)
UNSETBOOL(multiplecnames, multiple_cnames)
GETBOOL(useidpool, use_id_pool)
SETBOOL(useidpool, use_id_pool)
UNSETBOOL(useidpool, use_id_pool)
GETBOOL(dialup, dialup)
SETBOOL(dialup, dialup)
UNSETBOOL(dialup, dialup)
GETBOOL(rfc2308type1, rfc2308_type1)
SETBOOL(rfc2308type1, rfc2308_type1)
UNSETBOOL(rfc2308type1, rfc2308_type1)
GETBOOL(requestixfr, request_ixfr)
SETBOOL(requestixfr, request_ixfr)
UNSETBOOL(requestixfr, request_ixfr)
GETBOOL(provideixfr, provide_ixfr)
SETBOOL(provideixfr, provide_ixfr)
UNSETBOOL(provideixfr, provide_ixfr)
GETBOOL(treatcrasspace, treat_cr_as_space)
SETBOOL(treatcrasspace, treat_cr_as_space)
UNSETBOOL(treatcrasspace, treat_cr_as_space)
GETSOCKADDR(transfersource, transfer_source)
SETSOCKADDR(transfersource, transfer_source)
UNSETSOCKADDR(transfersource, transfer_source)
GETSOCKADDR(transfersourcev6, transfer_source_v6)
SETSOCKADDR(transfersourcev6, transfer_source_v6)
UNSETSOCKADDR(transfersourcev6, transfer_source_v6)
GETSOCKADDR(querysource, query_source)
SETSOCKADDR(querysource, query_source)
UNSETSOCKADDR(querysource, query_source)
GETSOCKADDR(querysourcev6, query_source_v6)
SETSOCKADDR(querysourcev6, query_source_v6)
UNSETSOCKADDR(querysourcev6, query_source_v6)
GETBYTYPE(dns_c_forw_t, forward, forward)
SETBYTYPE(dns_c_forw_t, forward, forward)
UNSETBYTYPE(dns_c_forw_t, forward, forward)
GETBYTYPE(dns_transfer_format_t, transferformat, transfer_format)
SETBYTYPE(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)
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: conflsn.c,v 1.13 2000/05/08 14:35:30 tale Exp $ */
/* $Id: conflsn.c,v 1.14 2000/06/04 19:51:14 brister Exp $ */
#include <config.h>
......@@ -161,7 +161,9 @@ dns_c_lstnlist_delete(dns_c_lstnlist_t **llist) {
}
isc_result_t
dns_c_lstnlist_print(FILE *fp, int indent, dns_c_lstnlist_t *ll) {
dns_c_lstnlist_print(FILE *fp, int indent, dns_c_lstnlist_t *ll,
in_port_t default_port)
{
dns_c_lstnon_t *lo;
REQUIRE(DNS_C_LISTENLIST_VALID(ll));
......@@ -169,7 +171,7 @@ dns_c_lstnlist_print(FILE *fp, int indent, dns_c_lstnlist_t *ll) {
lo = ISC_LIST_HEAD(ll->elements);
while (lo != NULL) {
dns_c_printtabs(fp, indent);
dns_c_lstnon_print(fp, indent, lo);
dns_c_lstnon_print(fp, indent, lo, default_port);
lo = ISC_LIST_NEXT(lo, next);
fprintf(fp, "\n");
}
......@@ -178,12 +180,13 @@ dns_c_lstnlist_print(FILE *fp, int indent, dns_c_lstnlist_t *ll) {
}
isc_result_t
dns_c_lstnon_print(FILE *fp, int indent, dns_c_lstnon_t *lo) {
dns_c_lstnon_print(FILE *fp, int indent, dns_c_lstnon_t *lo,
in_port_t default_port) {
REQUIRE(lo != NULL);
REQUIRE(DNS_C_LISTEN_VALID(lo));
fprintf(fp, "listen-on ");
if (lo->port != DNS_C_DEFAULTPORT) {
if (lo->port != default_port) {
fprintf(fp, "port %d ", lo->port);
}
......
......@@ -16,7 +16,7 @@
* SOFTWARE.
*/
/* $Id: confparser.y,v 1.88 2000/06/02 17:31:34 gson Exp $ */
/* $Id: confparser.y,v 1.89 2000/06/04 19:51:16 brister Exp $ */
#include <config.h>
......@@ -115,6 +115,7 @@ static isc_lexspecials_t specials;
static isc_result_t tmpres;
static int debug_lexer;
static in_port_t default_port;
int yyparse(void);
static int yylex(void);
......@@ -1063,6 +1064,20 @@ option: /* Empty */
YYABORT;
}
}
| L_PORT in_port
{
tmpres = dns_c_ctx_setport(currcfg, $2);
if (tmpres == ISC_R_EXISTS) {
parser_error(ISC_FALSE,
"cannot redefine port");
YYABORT;
} else if (tmpres != ISC_R_SUCCESS) {
parser_error(ISC_FALSE,
"failed to set port");
YYABORT;
}
default_port = $2;
}
| L_MAX_TRANSFER_TIME_OUT L_INTEGER
{
if ( int_too_big($2, 60) ) {
......@@ -1619,7 +1634,7 @@ port_ip_list: maybe_zero_port L_LBRACE ip_and_port_list L_RBRACE
unsigned int i;
if (port == 0)
port = DNS_C_DEFAULTPORT;
port = default_port;
for (i = 0 ; i < list->nextidx ; i++) {
if (isc_sockaddr_getport(&list->ips[i]) == 0) {
......@@ -1725,7 +1740,7 @@ query_source_v4: L_ADDRESS maybe_wild_ip4_only_addr
maybe_port: /* nothing */
{
$$ = DNS_C_DEFAULTPORT;
$$ = default_port;
}
| L_PORT in_port
{
......@@ -4012,10 +4027,6 @@ zone_stmt: L_ZONE domain_name optional_class L_LBRACE L_TYPE zone_type L_EOS
YYABORT;
}
if (currcfg->options != NULL) {
zone->afteropts = ISC_TRUE;
}
tmpres = dns_c_zonelist_addzone(currcfg->zlist, zone);
if (tmpres != ISC_R_SUCCESS) {
dns_c_zone_detach(&zone);
......@@ -4176,7 +4187,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_IDLE_OUT | L_MAX_LOG_SIZE_IXFR | L_NOTIFY |
L_MAINTAIN_IXFR_BASE | L_PUBKEY | L_ALSO_NOTIFY | L_DIALUP |
L_ENABLE_ZONE | L_DATABASE
L_ENABLE_ZONE | L_DATABASE | L_PORT
;
......@@ -5156,10 +5167,8 @@ dns_c_parse_namedconf(const char *filename, isc_mem_t *mem,
specials['/'] = 1;
specials['"'] = 1;
specials['!'] = 1;
#if 0
specials['*'] = 1;
#endif
default_port = DNS_C_DEFAULTPORT;
/*
* This memory context is only used by the lexer routines (and must
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: confview.c,v 1.31 2000/06/02 17:31:36 gson Exp $ */
/* $Id: confview.c,v 1.32 2000/06/04 19:51:17 brister Exp $ */
#include <config.h>
......@@ -703,7 +703,7 @@ dns_c_view_print(FILE *fp, int indent, dns_c_view_t *view) {
fprintf(fp, "\n");
if (view->zonelist != NULL) {
dns_c_zonelist_print(fp, indent + 1, view->zonelist);
dns_c_zonelist_print(fp, indent + 1, view->zonelist, view);
}
dns_c_printtabs(fp, indent);
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: confzone.c,v 1.45 2000/06/02 17:31:38 gson Exp $ */
/* $Id: confzone.c,v 1.46 2000/06/04 19:51:18 brister Exp $ */
#include <config.h>
......@@ -326,7 +326,9 @@ dns_c_zonelist_rmzone(dns_c_zonelist_t *zlist, dns_c_zone_t *zone) {
}
void
dns_c_zonelist_print(FILE *fp, int indent, dns_c_zonelist_t *list) {
dns_c_zonelist_print(FILE *fp, int indent, dns_c_zonelist_t *list,
dns_c_view_t *view)
{
dns_c_zonelem_t *zoneelem;
REQUIRE(DNS_C_ZONELIST_VALID(list));
......@@ -339,11 +341,14 @@ dns_c_zonelist_print(FILE *fp, int indent, dns_c_zonelist_t *list) {
zoneelem = ISC_LIST_HEAD(list->zones);
while (zoneelem != NULL) {