config.c revision 4e1d3e67cdc76609bad5f0310ac48de10b442b9f
/*
* Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2001-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: config.c,v 1.59 2005/08/23 02:36:06 marka Exp $ */
/*! \file */
#include <config.h>
#include <stdlib.h>
#include <string.h>
#include <isc/sockaddr.h>
#include <isccfg/namedconf.h>
#include <dns/fixedname.h>
#include <dns/rdataclass.h>
#include <dns/rdatatype.h>
/*% default configuration */
static char defaultconf[] = "\
options {\n\
# blackhole {none;};\n"
#ifndef WIN32
" coresize default;\n\
datasize default;\n\
files default;\n\
stacksize default;\n"
#endif
" deallocate-on-exit true;\n\
# directory <none>\n\
dump-file \"named_dump.db\";\n\
fake-iquery no;\n\
has-old-clients false;\n\
heartbeat-interval 60;\n\
host-statistics no;\n\
interface-interval 60;\n\
listen-on {any;};\n\
listen-on-v6 {none;};\n\
match-mapped-addresses no;\n\
memstatistics-file \"named.memstats\";\n\
multiple-cnames no;\n\
# named-xfer <obsolete>;\n\
port 53;\n\
recursing-file \"named.recursing\";\n\
"
#ifdef PATH_RANDOMDEV
"\
"
#endif
"\
recursive-clients 1000;\n\
rrset-order {order cyclic;};\n\
serial-queries 20;\n\
serial-query-rate 20;\n\
server-id none;\n\
statistics-file \"named.stats\";\n\
statistics-interval 60;\n\
tcp-clients 100;\n\
tcp-listen-queue 3;\n\
# tkey-dhkey <none>\n\
# tkey-gssapi-credential <none>\n\
# tkey-domain <none>\n\
transfers-per-ns 2;\n\
transfers-in 10;\n\
transfers-out 10;\n\
treat-cr-as-space true;\n\
use-id-pool true;\n\
use-ixfr true;\n\
edns-udp-size 4096;\n\
\n\
/* view */\n\
allow-notify {none;};\n\
allow-update-forwarding {none;};\n\
allow-recursion {any;};\n\
# allow-v6-synthesis <obsolete>;\n\
# sortlist <none>\n\
# topology <none>\n\
auth-nxdomain false;\n\
minimal-responses false;\n\
recursion true;\n\
provide-ixfr true;\n\
request-ixfr true;\n\
fetch-glue no;\n\
rfc2308-type1 no;\n\
additional-from-auth true;\n\
additional-from-cache true;\n\
query-source address *;\n\
query-source-v6 address *;\n\
notify-source *;\n\
notify-source-v6 *;\n\
cleaning-interval 60;\n\
min-roots 2;\n\
lame-ttl 600;\n\
max-ncache-ttl 10800; /* 3 hours */\n\
max-cache-ttl 604800; /* 1 week */\n\
transfer-format many-answers;\n\
max-cache-size 0;\n\
check-names master fail;\n\
check-names slave warn;\n\
check-names response ignore;\n\
check-mx warn;\n\
use-additional-cache true;\n\
acache-cleaning-interval 60;\n\
max-acache-size 0;\n\
dnssec-enable no; /* Make yes for 9.4. */ \n\
integrity-check yes;\n\
clients-per-query 10;\n\
max-clients-per-query 100;\n\
"
" /* zone */\n\
allow-query {any;};\n\
allow-transfer {any;};\n\
notify yes;\n\
# also-notify <none>\n\
notify-delay 5;\n\
dialup no;\n\
# forward <none>\n\
# forwarders <none>\n\
maintain-ixfr-base no;\n\
# max-ixfr-log-size <obsolete>\n\
transfer-source *;\n\
transfer-source-v6 *;\n\
alt-transfer-source *;\n\
alt-transfer-source-v6 *;\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\
min-refresh-time 300;\n\
multi-master no;\n\
sig-validity-interval 30; /* days */\n\
zone-statistics false;\n\
max-journal-size unlimited;\n\
ixfr-from-differences false;\n\
check-wildcard yes;\n\
};\n\
"
"#\n\
# Zones in the \"_bind\" view are NOT counted is the count of zones.\n\
#\n\
view \"_bind\" chaos {\n\
recursion no;\n\
notify no;\n\
\n\
zone \"version.bind\" chaos {\n\
type master;\n\
database \"_builtin version\";\n\
};\n\
\n\
zone \"hostname.bind\" chaos {\n\
type master;\n\
database \"_builtin hostname\";\n\
};\n\
\n\
zone \"authors.bind\" chaos {\n\
type master;\n\
database \"_builtin authors\";\n\
};\n\
zone \"id.server\" chaos {\n\
type master;\n\
database \"_builtin id\";\n\
};\n\
};\n\
";
isc_buffer_t b;
}
int i;
for (i = 0;; i++) {
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
}
}
int i;
for (i = 0;; i++) {
return (ISC_R_NOTFOUND);
checknames = NULL;
/*
* Zone map entry is not a list.
*/
*obj = checknames;
return (ISC_R_SUCCESS);
}
return (ISC_R_SUCCESS);
}
}
}
}
}
int
cfg_listelt_t *e;
int i = 0;
i++;
return (i);
}
if (!cfg_obj_isstring(classobj)) {
return (ISC_R_SUCCESS);
}
if (result != ISC_R_SUCCESS)
"unknown class '%s'", r.base);
return (result);
}
dns_rdatatype_t *typep) {
if (!cfg_obj_isstring(typeobj)) {
return (ISC_R_SUCCESS);
}
if (result != ISC_R_SUCCESS)
"unknown type '%s'", r.base);
return (result);
}
const char *str;
else
INSIST(0);
return (ztype);
}
{
int count, i = 0;
if (cfg_obj_isuint32(portobj)) {
if (val > ISC_UINT16_MAX) {
"port '%u' out of range", val);
return (ISC_R_RANGE);
}
} else if (defport != 0)
else {
if (result != ISC_R_SUCCESS)
return (result);
}
return (ISC_R_NOMEMORY);
{
if (isc_sockaddr_getport(&addrs[i]) == 0)
}
return (ISC_R_SUCCESS);
}
void
{
}
static isc_result_t
if (result != ISC_R_SUCCESS)
return (result);
const char *listname;
return (ISC_R_SUCCESS);
}
}
return (ISC_R_NOTFOUND);
}
{
isc_uint32_t listcount = 0, l = 0, j;
struct {
if (cfg_obj_isuint32(portobj)) {
if (val > ISC_UINT16_MAX) {
"port '%u' out of range", val);
return (ISC_R_RANGE);
}
} else {
if (result != ISC_R_SUCCESS)
return (result);
}
for ( ;
{
const char *keystr;
isc_buffer_t b;
"masterselement");
if (!cfg_obj_issockaddr(addr)) {
/* Grow lists? */
if (listcount == l) {
void * new;
goto cleanup;
if (listcount != 0) {
}
}
/* Seen? */
for (j = 0; j < l; j++)
break;
if (j < l)
continue;
if (tresult == ISC_R_NOTFOUND) {
"masters \"%s\" not found", listname);
goto cleanup;
}
if (tresult != ISC_R_SUCCESS)
goto cleanup;
/* Grow stack? */
if (stackcount == pushed) {
void * new;
goto cleanup;
if (stackcount != 0) {
}
stackcount = newlen;
}
/*
* We want to resume processing this list on the
* next element.
*/
pushed++;
goto newlist;
}
if (i == addrcount) {
void * new;
goto cleanup;
if (addrcount != 0) {
}
goto cleanup;
if (keycount != 0) {
}
}
if (isc_sockaddr_getport(&addrs[i]) == 0)
if (!cfg_obj_isstring(key)) {
i++;
continue;
}
goto cleanup;
if (result != ISC_R_SUCCESS)
goto cleanup;
keys[i]);
if (result != ISC_R_SUCCESS)
goto cleanup;
i++;
}
if (pushed != 0) {
pushed--;
goto resume;
}
if (i < addrcount) {
void * new;
newsize = i * sizeof(isc_sockaddr_t);
if (i != 0) {
goto cleanup;
} else
addrcount = i;
newsize = i * sizeof(dns_name_t *);
if (i != 0) {
goto cleanup;
} else
keycount = i;
}
return (ISC_R_SUCCESS);
for (j = 0; j <= i; j++) {
continue;
if (dns_name_dynamic(keys[j]))
}
}
return (result);
}
void
{
unsigned int i;
for (i = 0; i < count; i++) {
continue;
if (dns_name_dynamic(keys[i]))
}
}
int i;
i = 0;
maps[i++] = ns_g_defaults;
"port '%u' out of range",
return (ISC_R_RANGE);
}
return (ISC_R_SUCCESS);
}
{
{
return (ISC_R_SUCCESS);
}
return (ISC_R_NOTFOUND);
}