aboutsummaryrefslogtreecommitdiffstats
path: root/lib/isccfg
diff options
context:
space:
mode:
authorDoug Barton <dougb@FreeBSD.org>2009-05-31 00:11:36 +0000
committerDoug Barton <dougb@FreeBSD.org>2009-05-31 00:11:36 +0000
commitb0e69f719c1db2c19fcfba96f0dac9a5a2277350 (patch)
tree72d567a9bc3fb8adcfcbaa9baedc122d53071209 /lib/isccfg
parentfe9c1406ede29d1f2b9969c75785beef87a4bf87 (diff)
downloadsrc-b0e69f719c1db2c19fcfba96f0dac9a5a2277350.tar.gz
src-b0e69f719c1db2c19fcfba96f0dac9a5a2277350.zip
Vendor import of BIND 9.6.1rc1
Notes
Notes: svn path=/vendor/bind9/dist/; revision=193141
Diffstat (limited to 'lib/isccfg')
-rw-r--r--lib/isccfg/Makefile.in6
-rw-r--r--lib/isccfg/aclconf.c289
-rw-r--r--lib/isccfg/api4
-rw-r--r--lib/isccfg/include/Makefile.in6
-rw-r--r--lib/isccfg/include/isccfg/Makefile.in6
-rw-r--r--lib/isccfg/include/isccfg/aclconf.h8
-rw-r--r--lib/isccfg/include/isccfg/cfg.h16
-rw-r--r--lib/isccfg/include/isccfg/grammar.h16
-rw-r--r--lib/isccfg/include/isccfg/log.h10
-rw-r--r--lib/isccfg/include/isccfg/namedconf.h8
-rw-r--r--lib/isccfg/include/isccfg/version.h8
-rw-r--r--lib/isccfg/log.c10
-rw-r--r--lib/isccfg/namedconf.c245
-rw-r--r--lib/isccfg/parser.c82
-rw-r--r--lib/isccfg/version.c6
15 files changed, 523 insertions, 197 deletions
diff --git a/lib/isccfg/Makefile.in b/lib/isccfg/Makefile.in
index 7d19123abb11..6dcacdd370ed 100644
--- a/lib/isccfg/Makefile.in
+++ b/lib/isccfg/Makefile.in
@@ -1,7 +1,7 @@
-# Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
# Copyright (C) 2001-2003 Internet Software Consortium.
#
-# Permission to use, copy, modify, and distribute this software for any
+# Permission to use, copy, modify, and/or 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.
#
@@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.12.18.4 2005/09/05 00:18:30 marka Exp $
+# $Id: Makefile.in,v 1.18 2007/06/19 23:47:22 tbox Exp $
srcdir = @srcdir@
VPATH = @srcdir@
diff --git a/lib/isccfg/aclconf.c b/lib/isccfg/aclconf.c
index d7b41ce7e3c1..ad3d58e2c148 100644
--- a/lib/isccfg/aclconf.c
+++ b/lib/isccfg/aclconf.c
@@ -1,8 +1,8 @@
/*
- * Copyright (C) 2004-2006 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1999-2002 Internet Software Consortium.
*
- * Permission to use, copy, modify, and distribute this software for any
+ * Permission to use, copy, modify, and/or 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.
*
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: aclconf.c,v 1.2.2.6 2006/03/02 00:37:22 marka Exp $ */
+/* $Id: aclconf.c,v 1.22.34.2 2009/01/18 23:47:41 tbox Exp $ */
#include <config.h>
@@ -27,10 +27,11 @@
#include <isccfg/aclconf.h>
#include <dns/acl.h>
+#include <dns/iptable.h>
#include <dns/fixedname.h>
#include <dns/log.h>
-#define LOOP_MAGIC ISC_MAGIC('L','O','O','P')
+#define LOOP_MAGIC ISC_MAGIC('L','O','O','P')
void
cfg_aclconfctx_init(cfg_aclconfctx_t *ctx) {
@@ -39,7 +40,8 @@ cfg_aclconfctx_init(cfg_aclconfctx_t *ctx) {
void
cfg_aclconfctx_destroy(cfg_aclconfctx_t *ctx) {
- dns_acl_t *dacl, *next;
+ dns_acl_t *dacl, *next;
+
for (dacl = ISC_LIST_HEAD(ctx->named_acl_cache);
dacl != NULL;
dacl = next)
@@ -57,7 +59,7 @@ get_acl_def(const cfg_obj_t *cctx, const char *name, const cfg_obj_t **ret) {
isc_result_t result;
const cfg_obj_t *acls = NULL;
const cfg_listelt_t *elt;
-
+
result = cfg_map_get(cctx, "acl", &acls);
if (result != ISC_R_SUCCESS)
return (result);
@@ -67,7 +69,9 @@ get_acl_def(const cfg_obj_t *cctx, const char *name, const cfg_obj_t **ret) {
const cfg_obj_t *acl = cfg_listelt_value(elt);
const char *aclname = cfg_obj_asstring(cfg_tuple_get(acl, "name"));
if (strcasecmp(aclname, name) == 0) {
- *ret = cfg_tuple_get(acl, "value");
+ if (ret != NULL) {
+ *ret = cfg_tuple_get(acl, "value");
+ }
return (ISC_R_SUCCESS);
}
}
@@ -77,7 +81,8 @@ get_acl_def(const cfg_obj_t *cctx, const char *name, const cfg_obj_t **ret) {
static isc_result_t
convert_named_acl(const cfg_obj_t *nameobj, const cfg_obj_t *cctx,
isc_log_t *lctx, cfg_aclconfctx_t *ctx,
- isc_mem_t *mctx, dns_acl_t **target)
+ isc_mem_t *mctx, unsigned int nest_level,
+ dns_acl_t **target)
{
isc_result_t result;
const cfg_obj_t *cacl = NULL;
@@ -115,7 +120,8 @@ convert_named_acl(const cfg_obj_t *nameobj, const cfg_obj_t *cctx,
DE_CONST(aclname, loop.name);
loop.magic = LOOP_MAGIC;
ISC_LIST_APPEND(ctx->named_acl_cache, &loop, nextincache);
- result = cfg_acl_fromconfig(cacl, cctx, lctx, ctx, mctx, &dacl);
+ result = cfg_acl_fromconfig(cacl, cctx, lctx, ctx, mctx,
+ nest_level, &dacl);
ISC_LIST_UNLINK(ctx->named_acl_cache, &loop, nextincache);
loop.magic = 0;
loop.name = NULL;
@@ -154,87 +160,246 @@ convert_keyname(const cfg_obj_t *keyobj, isc_log_t *lctx, isc_mem_t *mctx,
return (dns_name_dup(dns_fixedname_name(&fixname), mctx, dnsname));
}
+/*
+ * Recursively pre-parse an ACL definition to find the total number
+ * of non-IP-prefix elements (localhost, localnets, key) in all nested
+ * ACLs, so that the parent will have enough space allocated for the
+ * elements table after all the nested ACLs have been merged in to the
+ * parent.
+ */
+static int
+count_acl_elements(const cfg_obj_t *caml, const cfg_obj_t *cctx)
+{
+ const cfg_listelt_t *elt;
+ const cfg_obj_t *cacl = NULL;
+ isc_result_t result;
+ int n = 0;
+
+ for (elt = cfg_list_first(caml);
+ elt != NULL;
+ elt = cfg_list_next(elt)) {
+ const cfg_obj_t *ce = cfg_listelt_value(elt);
+
+ /* negated element; just get the value. */
+ if (cfg_obj_istuple(ce))
+ ce = cfg_tuple_get(ce, "value");
+
+ if (cfg_obj_istype(ce, &cfg_type_keyref)) {
+ n++;
+ } else if (cfg_obj_islist(ce)) {
+ n += count_acl_elements(ce, cctx);
+ } else if (cfg_obj_isstring(ce)) {
+ const char *name = cfg_obj_asstring(ce);
+ if (strcasecmp(name, "localhost") == 0 ||
+ strcasecmp(name, "localnets") == 0) {
+ n++;
+ } else if (strcasecmp(name, "any") != 0 &&
+ strcasecmp(name, "none") != 0) {
+ result = get_acl_def(cctx, name, &cacl);
+ if (result == ISC_R_SUCCESS)
+ n += count_acl_elements(cacl, cctx) + 1;
+ }
+ }
+ }
+
+ return n;
+}
+
isc_result_t
cfg_acl_fromconfig(const cfg_obj_t *caml,
const cfg_obj_t *cctx,
- isc_log_t *lctx,
+ isc_log_t *lctx,
cfg_aclconfctx_t *ctx,
isc_mem_t *mctx,
+ unsigned int nest_level,
dns_acl_t **target)
{
isc_result_t result;
- unsigned int count;
- dns_acl_t *dacl = NULL;
+ dns_acl_t *dacl = NULL, *inneracl = NULL;
dns_aclelement_t *de;
const cfg_listelt_t *elt;
+ dns_iptable_t *iptab;
+ int new_nest_level = 0;
- REQUIRE(target != NULL && *target == NULL);
+ if (nest_level != 0)
+ new_nest_level = nest_level - 1;
- count = 0;
- for (elt = cfg_list_first(caml);
- elt != NULL;
- elt = cfg_list_next(elt))
- count++;
+ REQUIRE(target != NULL);
+ REQUIRE(*target == NULL || DNS_ACL_VALID(*target));
- result = dns_acl_create(mctx, count, &dacl);
- if (result != ISC_R_SUCCESS)
- return (result);
+ if (*target != NULL) {
+ /*
+ * If target already points to an ACL, then we're being
+ * called recursively to configure a nested ACL. The
+ * nested ACL's contents should just be absorbed into its
+ * parent ACL.
+ */
+ dns_acl_attach(*target, &dacl);
+ dns_acl_detach(target);
+ } else {
+ /*
+ * Need to allocate a new ACL structure. Count the items
+ * in the ACL definition that will require space in the
+ * elements table. (Note that if nest_level is nonzero,
+ * *everything* goes in the elements table.)
+ */
+ int nelem;
+
+ if (nest_level == 0)
+ nelem = count_acl_elements(caml, cctx);
+ else
+ nelem = cfg_list_length(caml, ISC_FALSE);
+
+ result = dns_acl_create(mctx, nelem, &dacl);
+ if (result != ISC_R_SUCCESS)
+ return (result);
+ }
de = dacl->elements;
for (elt = cfg_list_first(caml);
elt != NULL;
- elt = cfg_list_next(elt))
- {
+ elt = cfg_list_next(elt)) {
const cfg_obj_t *ce = cfg_listelt_value(elt);
+ isc_boolean_t neg;
+
if (cfg_obj_istuple(ce)) {
/* This must be a negated element. */
ce = cfg_tuple_get(ce, "value");
- de->negative = ISC_TRUE;
- } else {
- de->negative = ISC_FALSE;
+ neg = ISC_TRUE;
+ dacl->has_negatives = ISC_TRUE;
+ } else
+ neg = ISC_FALSE;
+
+ /*
+ * If nest_level is nonzero, then every element is
+ * to be stored as a separate, nested ACL rather than
+ * merged into the main iptable.
+ */
+ iptab = dacl->iptable;
+
+ if (nest_level != 0) {
+ result = dns_acl_create(mctx,
+ cfg_list_length(ce, ISC_FALSE),
+ &de->nestedacl);
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
+ iptab = de->nestedacl->iptable;
}
if (cfg_obj_isnetprefix(ce)) {
/* Network prefix */
- de->type = dns_aclelementtype_ipprefix;
+ isc_netaddr_t addr;
+ unsigned int bitlen;
- cfg_obj_asnetprefix(ce,
- &de->u.ip_prefix.address,
- &de->u.ip_prefix.prefixlen);
- } else if (cfg_obj_istype(ce, &cfg_type_keyref)) {
- /* Key name */
- de->type = dns_aclelementtype_keyname;
- dns_name_init(&de->u.keyname, NULL);
- result = convert_keyname(ce, lctx, mctx,
- &de->u.keyname);
+ cfg_obj_asnetprefix(ce, &addr, &bitlen);
+
+ /*
+ * If nesting ACLs (nest_level != 0), we negate
+ * the nestedacl element, not the iptable entry.
+ */
+ result = dns_iptable_addprefix(iptab, &addr, bitlen,
+ ISC_TF(nest_level != 0 || !neg));
if (result != ISC_R_SUCCESS)
goto cleanup;
+
+ if (nest_level > 0) {
+ de->type = dns_aclelementtype_nestedacl;
+ de->negative = neg;
+ } else
+ continue;
} else if (cfg_obj_islist(ce)) {
- /* Nested ACL */
- de->type = dns_aclelementtype_nestedacl;
- result = cfg_acl_fromconfig(ce, cctx, lctx, ctx,
- mctx, &de->u.nestedacl);
+ /*
+ * If we're nesting ACLs, put the nested
+ * ACL onto the elements list; otherwise
+ * merge it into *this* ACL. We nest ACLs
+ * in two cases: 1) sortlist, 2) if the
+ * nested ACL contains negated members.
+ */
+ if (inneracl != NULL)
+ dns_acl_detach(&inneracl);
+ result = cfg_acl_fromconfig(ce, cctx, lctx,
+ ctx, mctx, new_nest_level,
+ &inneracl);
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
+nested_acl:
+ if (nest_level > 0 || inneracl->has_negatives) {
+ de->type = dns_aclelementtype_nestedacl;
+ de->negative = neg;
+ if (de->nestedacl != NULL)
+ dns_acl_detach(&de->nestedacl);
+ dns_acl_attach(inneracl,
+ &de->nestedacl);
+ dns_acl_detach(&inneracl);
+ /* Fall through. */
+ } else {
+ dns_acl_merge(dacl, inneracl,
+ ISC_TF(!neg));
+ de += inneracl->length; /* elements added */
+ dns_acl_detach(&inneracl);
+ continue;
+ }
+ } else if (cfg_obj_istype(ce, &cfg_type_keyref)) {
+ /* Key name. */
+ de->type = dns_aclelementtype_keyname;
+ de->negative = neg;
+ dns_name_init(&de->keyname, NULL);
+ result = convert_keyname(ce, lctx, mctx,
+ &de->keyname);
if (result != ISC_R_SUCCESS)
goto cleanup;
} else if (cfg_obj_isstring(ce)) {
- /* ACL name */
+ /* ACL name. */
const char *name = cfg_obj_asstring(ce);
- if (strcasecmp(name, "localhost") == 0) {
+ if (strcasecmp(name, "any") == 0) {
+ /* Iptable entry with zero bit length. */
+ result = dns_iptable_addprefix(iptab, NULL, 0,
+ ISC_TF(nest_level != 0 || !neg));
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
+
+ if (nest_level != 0) {
+ de->type = dns_aclelementtype_nestedacl;
+ de->negative = neg;
+ } else
+ continue;
+ } else if (strcasecmp(name, "none") == 0) {
+ /* none == !any */
+ /*
+ * We don't unconditional set
+ * dacl->has_negatives and
+ * de->negative to true so we can handle
+ * "!none;".
+ */
+ result = dns_iptable_addprefix(iptab, NULL, 0,
+ ISC_TF(nest_level != 0 || neg));
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
+
+ if (!neg)
+ dacl->has_negatives = !neg;
+
+ if (nest_level != 0) {
+ de->type = dns_aclelementtype_nestedacl;
+ de->negative = !neg;
+ } else
+ continue;
+ } else if (strcasecmp(name, "localhost") == 0) {
de->type = dns_aclelementtype_localhost;
+ de->negative = neg;
} else if (strcasecmp(name, "localnets") == 0) {
de->type = dns_aclelementtype_localnets;
- } else if (strcasecmp(name, "any") == 0) {
- de->type = dns_aclelementtype_any;
- } else if (strcasecmp(name, "none") == 0) {
- de->type = dns_aclelementtype_any;
- de->negative = ISC_TF(! de->negative);
+ de->negative = neg;
} else {
- de->type = dns_aclelementtype_nestedacl;
- result = convert_named_acl(ce, cctx, lctx,
- ctx, mctx,
- &de->u.nestedacl);
+ if (inneracl != NULL)
+ dns_acl_detach(&inneracl);
+ result = convert_named_acl(ce, cctx, lctx, ctx,
+ mctx, new_nest_level,
+ &inneracl);
if (result != ISC_R_SUCCESS)
goto cleanup;
+
+ goto nested_acl;
}
} else {
cfg_obj_log(ce, lctx, ISC_LOG_WARNING,
@@ -243,14 +408,30 @@ cfg_acl_fromconfig(const cfg_obj_t *caml,
result = ISC_R_FAILURE;
goto cleanup;
}
- de++;
+
+ /*
+ * This should only be reached for localhost, localnets
+ * and keyname elements, and nested ACLs if nest_level is
+ * nonzero (i.e., in sortlists).
+ */
+ if (de->nestedacl != NULL &&
+ de->type != dns_aclelementtype_nestedacl)
+ dns_acl_detach(&de->nestedacl);
+
+ dacl->node_count++;
+ de->node_num = dacl->node_count;
+
dacl->length++;
+ de++;
+ INSIST(dacl->length <= dacl->alloc);
}
- *target = dacl;
- return (ISC_R_SUCCESS);
+ dns_acl_attach(dacl, target);
+ result = ISC_R_SUCCESS;
cleanup:
+ if (inneracl != NULL)
+ dns_acl_detach(&inneracl);
dns_acl_detach(&dacl);
return (result);
}
diff --git a/lib/isccfg/api b/lib/isccfg/api
index 510e9a911bab..8459d4239fcc 100644
--- a/lib/isccfg/api
+++ b/lib/isccfg/api
@@ -1,3 +1,3 @@
-LIBINTERFACE = 30
-LIBREVISION = 5
+LIBINTERFACE = 50
+LIBREVISION = 0
LIBAGE = 0
diff --git a/lib/isccfg/include/Makefile.in b/lib/isccfg/include/Makefile.in
index 4eddd928e070..1f240030ab8f 100644
--- a/lib/isccfg/include/Makefile.in
+++ b/lib/isccfg/include/Makefile.in
@@ -1,7 +1,7 @@
-# Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC")
# Copyright (C) 2001 Internet Software Consortium.
#
-# Permission to use, copy, modify, and distribute this software for any
+# Permission to use, copy, modify, and/or 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.
#
@@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.5 2004/03/05 05:12:24 marka Exp $
+# $Id: Makefile.in,v 1.7 2007/06/19 23:47:22 tbox Exp $
srcdir = @srcdir@
VPATH = @srcdir@
diff --git a/lib/isccfg/include/isccfg/Makefile.in b/lib/isccfg/include/isccfg/Makefile.in
index d71d2c2bf7ed..a6fd4125fdd6 100644
--- a/lib/isccfg/include/isccfg/Makefile.in
+++ b/lib/isccfg/include/isccfg/Makefile.in
@@ -1,7 +1,7 @@
-# Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
# Copyright (C) 2001, 2002 Internet Software Consortium.
#
-# Permission to use, copy, modify, and distribute this software for any
+# Permission to use, copy, modify, and/or 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.
#
@@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.8.18.2 2005/01/12 01:54:57 marka Exp $
+# $Id: Makefile.in,v 1.12 2007/06/19 23:47:22 tbox Exp $
srcdir = @srcdir@
VPATH = @srcdir@
diff --git a/lib/isccfg/include/isccfg/aclconf.h b/lib/isccfg/include/isccfg/aclconf.h
index a13740cd5ae0..7ad4351f3435 100644
--- a/lib/isccfg/include/isccfg/aclconf.h
+++ b/lib/isccfg/include/isccfg/aclconf.h
@@ -1,8 +1,8 @@
/*
- * Copyright (C) 2004-2006 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1999-2001 Internet Software Consortium.
*
- * Permission to use, copy, modify, and distribute this software for any
+ * Permission to use, copy, modify, and/or 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.
*
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: aclconf.h,v 1.2.2.5 2006/03/02 00:37:22 marka Exp $ */
+/* $Id: aclconf.h,v 1.10 2007/10/12 04:17:18 each Exp $ */
#ifndef ISCCFG_ACLCONF_H
#define ISCCFG_ACLCONF_H 1
@@ -28,6 +28,7 @@
typedef struct cfg_aclconfctx {
ISC_LIST(dns_acl_t) named_acl_cache;
+ ISC_LIST(dns_iptable_t) named_iptable_cache;
} cfg_aclconfctx_t;
/***
@@ -54,6 +55,7 @@ cfg_acl_fromconfig(const cfg_obj_t *caml,
isc_log_t *lctx,
cfg_aclconfctx_t *ctx,
isc_mem_t *mctx,
+ unsigned int nest_level,
dns_acl_t **target);
/*
* Construct a new dns_acl_t from configuration data in 'caml' and
diff --git a/lib/isccfg/include/isccfg/cfg.h b/lib/isccfg/include/isccfg/cfg.h
index 6a30a1cd6784..d0ed94b8f655 100644
--- a/lib/isccfg/include/isccfg/cfg.h
+++ b/lib/isccfg/include/isccfg/cfg.h
@@ -1,8 +1,8 @@
/*
- * Copyright (C) 2004-2006 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000-2002 Internet Software Consortium.
*
- * Permission to use, copy, modify, and distribute this software for any
+ * Permission to use, copy, modify, and/or 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.
*
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: cfg.h,v 1.34.18.5 2006/03/02 00:37:22 marka Exp $ */
+/* $Id: cfg.h,v 1.44 2007/10/12 04:17:18 each Exp $ */
#ifndef ISCCFG_CFG_H
#define ISCCFG_CFG_H 1
@@ -24,7 +24,7 @@
***** Module Info
*****/
-/*! \file
+/*! \file isccfg/cfg.h
* \brief
* This is the new, table-driven, YACC-free configuration file parser.
*/
@@ -347,6 +347,14 @@ cfg_list_next(const cfg_listelt_t *elt);
* or NULL if there are no more elements.
*/
+unsigned int
+cfg_list_length(const cfg_obj_t *obj, isc_boolean_t recurse);
+/*%<
+ * Returns the length of a list of configure objects. If obj is
+ * not a list, returns 0. If recurse is true, add in the length of
+ * all contained lists.
+ */
+
const cfg_obj_t *
cfg_listelt_value(const cfg_listelt_t *elt);
/*%<
diff --git a/lib/isccfg/include/isccfg/grammar.h b/lib/isccfg/include/isccfg/grammar.h
index fa6614698fec..f194d4cc571b 100644
--- a/lib/isccfg/include/isccfg/grammar.h
+++ b/lib/isccfg/include/isccfg/grammar.h
@@ -1,8 +1,8 @@
/*
- * Copyright (C) 2004-2006 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2008 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2002, 2003 Internet Software Consortium.
*
- * Permission to use, copy, modify, and distribute this software for any
+ * Permission to use, copy, modify, and/or 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.
*
@@ -15,12 +15,12 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: grammar.h,v 1.4.18.8 2006/02/28 03:10:49 marka Exp $ */
+/* $Id: grammar.h,v 1.17 2008/09/25 04:02:39 tbox Exp $ */
#ifndef ISCCFG_GRAMMAR_H
#define ISCCFG_GRAMMAR_H 1
-/*! \file */
+/*! \file isccfg/grammar.h */
#include <isc/lex.h>
#include <isc/netaddr.h>
@@ -51,6 +51,8 @@
* "directory" option.
*/
#define CFG_CLAUSEFLAG_CALLBACK 0x00000020
+/*% A option that is only used in testing. */
+#define CFG_CLAUSEFLAG_TESTONLY 0x00000040
typedef struct cfg_clausedef cfg_clausedef_t;
typedef struct cfg_tuplefielddef cfg_tuplefielddef_t;
@@ -184,8 +186,8 @@ struct cfg_parser {
/*%
* The stack of currently active files, represented
* as a configuration list of configuration strings.
- * The head is the top-level file, subsequent elements
- * (if any) are the nested include files, and the
+ * The head is the top-level file, subsequent elements
+ * (if any) are the nested include files, and the
* last element is the file currently being parsed.
*/
cfg_obj_t * open_files;
@@ -433,7 +435,7 @@ cfg_doc_terminal(cfg_printer_t *pctx, const cfg_type_t *type);
void
cfg_parser_error(cfg_parser_t *pctx, unsigned int flags,
const char *fmt, ...) ISC_FORMAT_PRINTF(3, 4);
-/*!
+/*!
* Pass one of these flags to cfg_parser_error() to include the
* token text in log message.
*/
diff --git a/lib/isccfg/include/isccfg/log.h b/lib/isccfg/include/isccfg/log.h
index f66c37ff7d05..9750a5215f80 100644
--- a/lib/isccfg/include/isccfg/log.h
+++ b/lib/isccfg/include/isccfg/log.h
@@ -1,8 +1,8 @@
/*
- * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2007, 2009 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2001 Internet Software Consortium.
*
- * Permission to use, copy, modify, and distribute this software for any
+ * Permission to use, copy, modify, and/or 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.
*
@@ -15,12 +15,12 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: log.h,v 1.6.18.2 2005/04/29 00:17:16 marka Exp $ */
+/* $Id: log.h,v 1.12.332.2 2009/01/18 23:47:41 tbox Exp $ */
#ifndef ISCCFG_LOG_H
#define ISCCFG_LOG_H 1
-/*! \file */
+/*! \file isccfg/log.h */
#include <isc/lang.h>
#include <isc/log.h>
@@ -46,7 +46,7 @@ cfg_log_init(isc_log_t *lctx);
*\li cfg_log_init() is called only once.
*
* Ensures:
- * \li The catgories and modules defined above are available for
+ * \li The categories and modules defined above are available for
* use by isc_log_usechannnel() and isc_log_write().
*/
diff --git a/lib/isccfg/include/isccfg/namedconf.h b/lib/isccfg/include/isccfg/namedconf.h
index 6125b26d54c2..9689a2ae7bdd 100644
--- a/lib/isccfg/include/isccfg/namedconf.h
+++ b/lib/isccfg/include/isccfg/namedconf.h
@@ -1,8 +1,8 @@
/*
- * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2002 Internet Software Consortium.
*
- * Permission to use, copy, modify, and distribute this software for any
+ * Permission to use, copy, modify, and/or 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.
*
@@ -15,12 +15,12 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: namedconf.h,v 1.3.18.2 2005/04/29 00:17:16 marka Exp $ */
+/* $Id: namedconf.h,v 1.9 2007/06/19 23:47:22 tbox Exp $ */
#ifndef ISCCFG_NAMEDCONF_H
#define ISCCFG_NAMEDCONF_H 1
-/*! \file
+/*! \file isccfg/namedconf.h
* \brief
* This module defines the named.conf, rndc.conf, and rndc.key grammars.
*/
diff --git a/lib/isccfg/include/isccfg/version.h b/lib/isccfg/include/isccfg/version.h
index 38bb14b91f51..8aed111c8d40 100644
--- a/lib/isccfg/include/isccfg/version.h
+++ b/lib/isccfg/include/isccfg/version.h
@@ -1,8 +1,8 @@
/*
- * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2001 Internet Software Consortium.
*
- * Permission to use, copy, modify, and distribute this software for any
+ * Permission to use, copy, modify, and/or 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.
*
@@ -15,9 +15,9 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: version.h,v 1.3.18.2 2005/04/29 00:17:16 marka Exp $ */
+/* $Id: version.h,v 1.9 2007/06/19 23:47:22 tbox Exp $ */
-/*! \file */
+/*! \file isccfg/version.h */
#include <isc/platform.h>
diff --git a/lib/isccfg/log.c b/lib/isccfg/log.c
index 5d5ccb5a402f..8747fc0b2344 100644
--- a/lib/isccfg/log.c
+++ b/lib/isccfg/log.c
@@ -1,8 +1,8 @@
/*
- * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2001 Internet Software Consortium.
*
- * Permission to use, copy, modify, and distribute this software for any
+ * Permission to use, copy, modify, and/or 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.
*
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: log.c,v 1.5.18.2 2005/04/29 00:17:15 marka Exp $ */
+/* $Id: log.c,v 1.11 2007/06/19 23:47:22 tbox Exp $ */
/*! \file */
@@ -27,7 +27,7 @@
/*%
* When adding a new category, be sure to add the appropriate
- * #define to <isccfg/log.h>.
+ * \#define to <isccfg/log.h>.
*/
LIBISCCFG_EXTERNAL_DATA isc_logcategory_t cfg_categories[] = {
{ "config", 0 },
@@ -36,7 +36,7 @@ LIBISCCFG_EXTERNAL_DATA isc_logcategory_t cfg_categories[] = {
/*%
* When adding a new module, be sure to add the appropriate
- * #define to <isccfg/log.h>.
+ * \#define to <isccfg/log.h>.
*/
LIBISCCFG_EXTERNAL_DATA isc_logmodule_t cfg_modules[] = {
{ "isccfg/parser", 0 },
diff --git a/lib/isccfg/namedconf.c b/lib/isccfg/namedconf.c
index a13d0a5ad7cd..06104894642f 100644
--- a/lib/isccfg/namedconf.c
+++ b/lib/isccfg/namedconf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004-2006, 2008 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2008 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2002, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: namedconf.c,v 1.30.18.43 2008/09/04 08:03:08 marka Exp $ */
+/* $Id: namedconf.c,v 1.92 2008/09/27 23:35:31 jinmei Exp $ */
/*! \file */
@@ -88,9 +88,9 @@ static cfg_type_t cfg_type_masterselement;
static cfg_type_t cfg_type_nameportiplist;
static cfg_type_t cfg_type_negated;
static cfg_type_t cfg_type_notifytype;
+static cfg_type_t cfg_type_optional_allow;
static cfg_type_t cfg_type_optional_class;
static cfg_type_t cfg_type_optional_facility;
-static cfg_type_t cfg_type_optional_facility;
static cfg_type_t cfg_type_optional_keyref;
static cfg_type_t cfg_type_optional_port;
static cfg_type_t cfg_type_options;
@@ -104,6 +104,7 @@ static cfg_type_t cfg_type_size;
static cfg_type_t cfg_type_sizenodefault;
static cfg_type_t cfg_type_sockaddr4wild;
static cfg_type_t cfg_type_sockaddr6wild;
+static cfg_type_t cfg_type_statschannels;
static cfg_type_t cfg_type_view;
static cfg_type_t cfg_type_viewopts;
static cfg_type_t cfg_type_zone;
@@ -258,7 +259,9 @@ static cfg_type_t cfg_type_mode = {
};
static const char *matchtype_enums[] = {
- "name", "subdomain", "wildcard", "self", "selfsub", "selfwild", NULL };
+ "name", "subdomain", "wildcard", "self", "selfsub", "selfwild",
+ "krb5-self", "ms-self", "krb5-subdomain", "ms-subdomain",
+ "tcp-self", "6to4-self", NULL };
static cfg_type_t cfg_type_matchtype = {
"matchtype", cfg_parse_enum, cfg_print_ustring, cfg_doc_enum, &cfg_rep_string,
&matchtype_enums
@@ -633,6 +636,8 @@ namedconf_clauses[] = {
{ "logging", &cfg_type_logging, 0 },
{ "view", &cfg_type_view, CFG_CLAUSEFLAG_MULTI },
{ "lwres", &cfg_type_lwres, CFG_CLAUSEFLAG_MULTI },
+ { "statistics-channels", &cfg_type_statschannels,
+ CFG_CLAUSEFLAG_MULTI },
{ NULL, NULL, 0 }
};
@@ -678,6 +683,7 @@ options_clauses[] = {
{ "listen-on-v6", &cfg_type_listenon, CFG_CLAUSEFLAG_MULTI },
{ "match-mapped-addresses", &cfg_type_boolean, 0 },
{ "memstatistics-file", &cfg_type_qstring, 0 },
+ { "memstatistics", &cfg_type_boolean, 0 },
{ "multiple-cnames", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE },
{ "named-xfer", &cfg_type_qstring, CFG_CLAUSEFLAG_OBSOLETE },
{ "pid-file", &cfg_type_qstringornone, 0 },
@@ -781,61 +787,68 @@ static cfg_type_t cfg_type_lookaside = {
static cfg_clausedef_t
view_clauses[] = {
+ { "acache-cleaning-interval", &cfg_type_uint32, 0 },
+ { "acache-enable", &cfg_type_boolean, 0 },
+ { "additional-from-auth", &cfg_type_boolean, 0 },
+ { "additional-from-cache", &cfg_type_boolean, 0 },
{ "allow-query-cache", &cfg_type_bracketed_aml, 0 },
+ { "allow-query-cache-on", &cfg_type_bracketed_aml, 0 },
{ "allow-recursion", &cfg_type_bracketed_aml, 0 },
+ { "allow-recursion-on", &cfg_type_bracketed_aml, 0 },
{ "allow-v6-synthesis", &cfg_type_bracketed_aml,
CFG_CLAUSEFLAG_OBSOLETE },
- { "sortlist", &cfg_type_bracketed_aml, 0 },
- { "topology", &cfg_type_bracketed_aml, CFG_CLAUSEFLAG_NOTIMP },
{ "auth-nxdomain", &cfg_type_boolean, CFG_CLAUSEFLAG_NEWDEFAULT },
- { "minimal-responses", &cfg_type_boolean, 0 },
- { "recursion", &cfg_type_boolean, 0 },
- { "rrset-order", &cfg_type_rrsetorder, 0 },
- { "provide-ixfr", &cfg_type_boolean, 0 },
- { "request-ixfr", &cfg_type_boolean, 0 },
- { "fetch-glue", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE },
- { "rfc2308-type1", &cfg_type_boolean, CFG_CLAUSEFLAG_NYI },
- { "additional-from-auth", &cfg_type_boolean, 0 },
- { "additional-from-cache", &cfg_type_boolean, 0 },
- /*
- * Note that the query-source option syntax is different
- * from the other -source options.
- */
- { "query-source", &cfg_type_querysource4, 0 },
- { "query-source-v6", &cfg_type_querysource6, 0 },
- { "cleaning-interval", &cfg_type_uint32, 0 },
- { "min-roots", &cfg_type_uint32, CFG_CLAUSEFLAG_NOTIMP },
- { "lame-ttl", &cfg_type_uint32, 0 },
- { "max-ncache-ttl", &cfg_type_uint32, 0 },
- { "max-cache-ttl", &cfg_type_uint32, 0 },
- { "transfer-format", &cfg_type_transferformat, 0 },
- { "max-cache-size", &cfg_type_sizenodefault, 0 },
- { "check-names", &cfg_type_checknames, CFG_CLAUSEFLAG_MULTI },
{ "cache-file", &cfg_type_qstring, 0 },
- { "suppress-initial-notify", &cfg_type_boolean, CFG_CLAUSEFLAG_NYI },
- { "preferred-glue", &cfg_type_astring, 0 },
- { "dual-stack-servers", &cfg_type_nameportiplist, 0 },
- { "edns-udp-size", &cfg_type_uint32, 0 },
- { "max-udp-size", &cfg_type_uint32, 0 },
- { "root-delegation-only", &cfg_type_optional_exclude, 0 },
+ { "check-names", &cfg_type_checknames, CFG_CLAUSEFLAG_MULTI },
+ { "cleaning-interval", &cfg_type_uint32, 0 },
+ { "clients-per-query", &cfg_type_uint32, 0 },
{ "disable-algorithms", &cfg_type_disablealgorithm,
CFG_CLAUSEFLAG_MULTI },
+ { "disable-empty-zone", &cfg_type_astring, CFG_CLAUSEFLAG_MULTI },
+ { "dnssec-accept-expired", &cfg_type_boolean, 0 },
{ "dnssec-enable", &cfg_type_boolean, 0 },
- { "dnssec-validation", &cfg_type_boolean, 0 },
{ "dnssec-lookaside", &cfg_type_lookaside, CFG_CLAUSEFLAG_MULTI },
{ "dnssec-must-be-secure", &cfg_type_mustbesecure,
- CFG_CLAUSEFLAG_MULTI },
- { "dnssec-accept-expired", &cfg_type_boolean, 0 },
+ CFG_CLAUSEFLAG_MULTI },
+ { "dnssec-validation", &cfg_type_boolean, 0 },
+ { "dual-stack-servers", &cfg_type_nameportiplist, 0 },
+ { "edns-udp-size", &cfg_type_uint32, 0 },
+ { "empty-contact", &cfg_type_astring, 0 },
+ { "empty-server", &cfg_type_astring, 0 },
+ { "empty-zones-enable", &cfg_type_boolean, 0 },
+ { "fetch-glue", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE },
{ "ixfr-from-differences", &cfg_type_ixfrdifftype, 0 },
- { "acache-enable", &cfg_type_boolean, 0 },
- { "acache-cleaning-interval", &cfg_type_uint32, 0 },
+ { "lame-ttl", &cfg_type_uint32, 0 },
{ "max-acache-size", &cfg_type_sizenodefault, 0 },
- { "clients-per-query", &cfg_type_uint32, 0 },
+ { "max-cache-size", &cfg_type_sizenodefault, 0 },
+ { "max-cache-ttl", &cfg_type_uint32, 0 },
{ "max-clients-per-query", &cfg_type_uint32, 0 },
- { "empty-server", &cfg_type_astring, 0 },
- { "empty-contact", &cfg_type_astring, 0 },
- { "empty-zones-enable", &cfg_type_boolean, 0 },
- { "disable-empty-zone", &cfg_type_astring, CFG_CLAUSEFLAG_MULTI },
+ { "max-ncache-ttl", &cfg_type_uint32, 0 },
+ { "max-udp-size", &cfg_type_uint32, 0 },
+ { "min-roots", &cfg_type_uint32, CFG_CLAUSEFLAG_NOTIMP },
+ { "minimal-responses", &cfg_type_boolean, 0 },
+ { "preferred-glue", &cfg_type_astring, 0 },
+ { "provide-ixfr", &cfg_type_boolean, 0 },
+ /*
+ * Note that the query-source option syntax is different
+ * from the other -source options.
+ */
+ { "query-source", &cfg_type_querysource4, 0 },
+ { "query-source-v6", &cfg_type_querysource6, 0 },
+ { "queryport-pool-ports", &cfg_type_uint32, CFG_CLAUSEFLAG_OBSOLETE },
+ { "queryport-pool-updateinterval", &cfg_type_uint32,
+ CFG_CLAUSEFLAG_OBSOLETE },
+ { "recursion", &cfg_type_boolean, 0 },
+ { "request-ixfr", &cfg_type_boolean, 0 },
+ { "request-nsid", &cfg_type_boolean, 0 },
+ { "rfc2308-type1", &cfg_type_boolean, CFG_CLAUSEFLAG_NYI },
+ { "root-delegation-only", &cfg_type_optional_exclude, 0 },
+ { "rrset-order", &cfg_type_rrsetorder, 0 },
+ { "sortlist", &cfg_type_bracketed_aml, 0 },
+ { "suppress-initial-notify", &cfg_type_boolean, CFG_CLAUSEFLAG_NYI },
+ { "topology", &cfg_type_bracketed_aml, CFG_CLAUSEFLAG_NOTIMP },
+ { "transfer-format", &cfg_type_transferformat, 0 },
+ { "use-queryport-pool", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE },
{ "zero-no-soa-ttl-cache", &cfg_type_boolean, 0 },
{ NULL, NULL, 0 }
};
@@ -852,53 +865,101 @@ view_only_clauses[] = {
};
/*%
+ * Sig-validity-interval.
+ */
+static isc_result_t
+parse_optional_uint32(cfg_parser_t *pctx, const cfg_type_t *type,
+ cfg_obj_t **ret)
+{
+ isc_result_t result;
+ UNUSED(type);
+
+ CHECK(cfg_peektoken(pctx, ISC_LEXOPT_NUMBER | ISC_LEXOPT_CNUMBER));
+ if (pctx->token.type == isc_tokentype_number) {
+ CHECK(cfg_parse_obj(pctx, &cfg_type_uint32, ret));
+ } else {
+ CHECK(cfg_parse_obj(pctx, &cfg_type_void, ret));
+ }
+ cleanup:
+ return (result);
+}
+
+static void
+doc_optional_uint32(cfg_printer_t *pctx, const cfg_type_t *type) {
+ UNUSED(type);
+ cfg_print_chars(pctx, "[ <integer> ]", 13);
+}
+
+static cfg_type_t cfg_type_optional_uint32 = {
+ "optional_uint32", parse_optional_uint32, NULL, doc_optional_uint32,
+ NULL, NULL };
+
+static cfg_tuplefielddef_t validityinterval_fields[] = {
+ { "validity", &cfg_type_uint32, 0 },
+ { "re-sign", &cfg_type_optional_uint32, 0 },
+ { NULL, NULL, 0 }
+};
+
+static cfg_type_t cfg_type_validityinterval = {
+ "validityinterval", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple,
+ &cfg_rep_tuple, validityinterval_fields
+};
+
+/*%
* Clauses that can be found in a 'zone' statement,
* with defaults in the 'view' or 'options' statement.
*/
static cfg_clausedef_t
zone_clauses[] = {
+ { "allow-notify", &cfg_type_bracketed_aml, 0 },
{ "allow-query", &cfg_type_bracketed_aml, 0 },
+ { "allow-query-on", &cfg_type_bracketed_aml, 0 },
{ "allow-transfer", &cfg_type_bracketed_aml, 0 },
{ "allow-update", &cfg_type_bracketed_aml, 0 },
{ "allow-update-forwarding", &cfg_type_bracketed_aml, 0 },
- { "allow-notify", &cfg_type_bracketed_aml, 0 },
- { "masterfile-format", &cfg_type_masterformat, 0 },
- { "notify", &cfg_type_notifytype, 0 },
- { "notify-source", &cfg_type_sockaddr4wild, 0 },
- { "notify-source-v6", &cfg_type_sockaddr6wild, 0 },
{ "also-notify", &cfg_type_portiplist, 0 },
- { "notify-delay", &cfg_type_uint32, 0 },
+ { "alt-transfer-source", &cfg_type_sockaddr4wild, 0 },
+ { "alt-transfer-source-v6", &cfg_type_sockaddr6wild, 0 },
+ { "check-integrity", &cfg_type_boolean, 0 },
+ { "check-mx", &cfg_type_checkmode, 0 },
+ { "check-mx-cname", &cfg_type_checkmode, 0 },
+ { "check-sibling", &cfg_type_boolean, 0 },
+ { "check-srv-cname", &cfg_type_checkmode, 0 },
+ { "check-wildcard", &cfg_type_boolean, 0 },
{ "dialup", &cfg_type_dialuptype, 0 },
{ "forward", &cfg_type_forwardtype, 0 },
{ "forwarders", &cfg_type_portiplist, 0 },
+ { "key-directory", &cfg_type_qstring, 0 },
{ "maintain-ixfr-base", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE },
+ { "masterfile-format", &cfg_type_masterformat, 0 },
{ "max-ixfr-log-size", &cfg_type_size, CFG_CLAUSEFLAG_OBSOLETE },
{ "max-journal-size", &cfg_type_sizenodefault, 0 },
- { "max-transfer-time-in", &cfg_type_uint32, 0 },
- { "max-transfer-time-out", &cfg_type_uint32, 0 },
+ { "max-refresh-time", &cfg_type_uint32, 0 },
+ { "max-retry-time", &cfg_type_uint32, 0 },
{ "max-transfer-idle-in", &cfg_type_uint32, 0 },
{ "max-transfer-idle-out", &cfg_type_uint32, 0 },
- { "max-retry-time", &cfg_type_uint32, 0 },
- { "min-retry-time", &cfg_type_uint32, 0 },
- { "max-refresh-time", &cfg_type_uint32, 0 },
+ { "max-transfer-time-in", &cfg_type_uint32, 0 },
+ { "max-transfer-time-out", &cfg_type_uint32, 0 },
{ "min-refresh-time", &cfg_type_uint32, 0 },
+ { "min-retry-time", &cfg_type_uint32, 0 },
{ "multi-master", &cfg_type_boolean, 0 },
- { "sig-validity-interval", &cfg_type_uint32, 0 },
+ { "notify", &cfg_type_notifytype, 0 },
+ { "notify-delay", &cfg_type_uint32, 0 },
+ { "notify-source", &cfg_type_sockaddr4wild, 0 },
+ { "notify-source-v6", &cfg_type_sockaddr6wild, 0 },
+ { "notify-to-soa", &cfg_type_boolean, 0 },
+ { "nsec3-test-zone", &cfg_type_boolean, CFG_CLAUSEFLAG_TESTONLY },
+ { "sig-signing-nodes", &cfg_type_uint32, 0 },
+ { "sig-signing-signatures", &cfg_type_uint32, 0 },
+ { "sig-signing-type", &cfg_type_uint32, 0 },
+ { "sig-validity-interval", &cfg_type_validityinterval, 0 },
{ "transfer-source", &cfg_type_sockaddr4wild, 0 },
{ "transfer-source-v6", &cfg_type_sockaddr6wild, 0 },
- { "alt-transfer-source", &cfg_type_sockaddr4wild, 0 },
- { "alt-transfer-source-v6", &cfg_type_sockaddr6wild, 0 },
+ { "try-tcp-refresh", &cfg_type_boolean, 0 },
+ { "update-check-ksk", &cfg_type_boolean, 0 },
{ "use-alt-transfer-source", &cfg_type_boolean, 0 },
- { "zone-statistics", &cfg_type_boolean, 0 },
- { "key-directory", &cfg_type_qstring, 0 },
- { "check-wildcard", &cfg_type_boolean, 0 },
- { "check-integrity", &cfg_type_boolean, 0 },
- { "check-mx", &cfg_type_checkmode, 0 },
- { "check-mx-cname", &cfg_type_checkmode, 0 },
- { "check-srv-cname", &cfg_type_checkmode, 0 },
- { "check-sibling", &cfg_type_boolean, 0 },
{ "zero-no-soa-ttl", &cfg_type_boolean, 0 },
- { "update-check-ksk", &cfg_type_boolean, 0 },
+ { "zone-statistics", &cfg_type_boolean, 0 },
{ NULL, NULL, 0 }
};
@@ -1429,6 +1490,53 @@ static cfg_type_t cfg_type_controls = {
};
/*%
+ * A "statistics-channels" statement is represented as a map with the
+ * multivalued "inet" clauses.
+ */
+static void
+doc_optional_bracketed_list(cfg_printer_t *pctx, const cfg_type_t *type) {
+ const keyword_type_t *kw = type->of;
+ cfg_print_chars(pctx, "[ ", 2);
+ cfg_print_cstr(pctx, kw->name);
+ cfg_print_chars(pctx, " ", 1);
+ cfg_doc_obj(pctx, kw->type);
+ cfg_print_chars(pctx, " ]", 2);
+}
+
+static cfg_type_t cfg_type_optional_allow = {
+ "optional_allow", parse_optional_keyvalue, print_keyvalue,
+ doc_optional_bracketed_list, &cfg_rep_list, &controls_allow_kw
+};
+
+static cfg_tuplefielddef_t statserver_fields[] = {
+ { "address", &cfg_type_controls_sockaddr, 0 }, /* reuse controls def */
+ { "allow", &cfg_type_optional_allow, 0 },
+ { NULL, NULL, 0 }
+};
+
+static cfg_type_t cfg_type_statschannel = {
+ "statschannel", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple,
+ &cfg_rep_tuple, statserver_fields
+};
+
+static cfg_clausedef_t
+statservers_clauses[] = {
+ { "inet", &cfg_type_statschannel, CFG_CLAUSEFLAG_MULTI },
+ { NULL, NULL, 0 }
+};
+
+static cfg_clausedef_t *
+statservers_clausesets[] = {
+ statservers_clauses,
+ NULL
+};
+
+static cfg_type_t cfg_type_statschannels = {
+ "statistics-channels", cfg_parse_map, cfg_print_map, cfg_doc_map,
+ &cfg_rep_map, &statservers_clausesets
+};
+
+/*%
* An optional class, as used in view and zone statements.
*/
static isc_result_t
@@ -1526,6 +1634,7 @@ print_querysource(cfg_printer_t *pctx, const cfg_obj_t *obj) {
static unsigned int sockaddr4wild_flags = CFG_ADDR_WILDOK | CFG_ADDR_V4OK;
static unsigned int sockaddr6wild_flags = CFG_ADDR_WILDOK | CFG_ADDR_V6OK;
+
static cfg_type_t cfg_type_querysource4 = {
"querysource4", parse_querysource, NULL, cfg_doc_terminal,
NULL, &sockaddr4wild_flags
diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c
index 19a51a68c030..ee19cf545f5b 100644
--- a/lib/isccfg/parser.c
+++ b/lib/isccfg/parser.c
@@ -1,8 +1,8 @@
/*
- * Copyright (C) 2004-2006 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2008 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000-2003 Internet Software Consortium.
*
- * Permission to use, copy, modify, and distribute this software for any
+ * Permission to use, copy, modify, and/or 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.
*
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: parser.c,v 1.112.18.11 2006/02/28 03:10:49 marka Exp $ */
+/* $Id: parser.c,v 1.129 2008/09/25 04:02:39 tbox Exp $ */
/*! \file */
@@ -50,7 +50,7 @@
/* Check a return value. */
#define CHECK(op) \
- do { result = (op); \
+ do { result = (op); \
if (result != ISC_R_SUCCESS) goto cleanup; \
} while (0)
@@ -192,7 +192,7 @@ cfg_print(const cfg_obj_t *obj,
/* Tuples. */
-
+
isc_result_t
cfg_create_tuple(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
isc_result_t result;
@@ -303,7 +303,7 @@ cfg_tuple_get(const cfg_obj_t *tupleobj, const char* name) {
unsigned int i;
const cfg_tuplefielddef_t *fields;
const cfg_tuplefielddef_t *f;
-
+
REQUIRE(tupleobj != NULL && tupleobj->type->rep == &cfg_rep_tuple);
fields = tupleobj->type->of;
@@ -317,7 +317,7 @@ cfg_tuple_get(const cfg_obj_t *tupleobj, const char* name) {
isc_result_t
cfg_parse_special(cfg_parser_t *pctx, int special) {
- isc_result_t result;
+ isc_result_t result;
CHECK(cfg_gettoken(pctx, 0));
if (pctx->token.type == isc_tokentype_special &&
pctx->token.value.as_char == special)
@@ -338,7 +338,7 @@ cfg_parse_special(cfg_parser_t *pctx, int special) {
*/
static isc_result_t
parse_semicolon(cfg_parser_t *pctx) {
- isc_result_t result;
+ isc_result_t result;
CHECK(cfg_gettoken(pctx, 0));
if (pctx->token.type == isc_tokentype_special &&
pctx->token.value.as_char == ';')
@@ -355,7 +355,7 @@ parse_semicolon(cfg_parser_t *pctx) {
*/
static isc_result_t
parse_eof(cfg_parser_t *pctx) {
- isc_result_t result;
+ isc_result_t result;
CHECK(cfg_gettoken(pctx, 0));
if (pctx->token.type == isc_tokentype_eof)
@@ -519,7 +519,7 @@ cfg_parse_buffer(cfg_parser_t *pctx, isc_buffer_t *buffer,
{
isc_result_t result;
REQUIRE(buffer != NULL);
- CHECK(isc_lex_openbuffer(pctx->lexer, buffer));
+ CHECK(isc_lex_openbuffer(pctx->lexer, buffer));
CHECK(parse2(pctx, type, ret));
cleanup:
return (result);
@@ -577,7 +577,7 @@ cfg_type_t cfg_type_void = {
*/
isc_result_t
cfg_parse_uint32(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
- isc_result_t result;
+ isc_result_t result;
cfg_obj_t *obj = NULL;
UNUSED(type);
@@ -690,7 +690,7 @@ create_string(cfg_parser_t *pctx, const char *contents, const cfg_type_t *type,
isc_result_t
cfg_parse_qstring(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
- isc_result_t result;
+ isc_result_t result;
UNUSED(type);
CHECK(cfg_gettoken(pctx, CFG_LEXOPT_QSTRING));
@@ -708,7 +708,7 @@ cfg_parse_qstring(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
static isc_result_t
parse_ustring(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
- isc_result_t result;
+ isc_result_t result;
UNUSED(type);
CHECK(cfg_gettoken(pctx, 0));
@@ -728,7 +728,7 @@ isc_result_t
cfg_parse_astring(cfg_parser_t *pctx, const cfg_type_t *type,
cfg_obj_t **ret)
{
- isc_result_t result;
+ isc_result_t result;
UNUSED(type);
CHECK(cfg_getstringtoken(pctx));
@@ -761,14 +761,14 @@ check_enum(cfg_parser_t *pctx, cfg_obj_t *obj, const char *const *enums) {
isc_result_t
cfg_parse_enum(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
- isc_result_t result;
+ isc_result_t result;
cfg_obj_t *obj = NULL;
CHECK(parse_ustring(pctx, NULL, &obj));
CHECK(check_enum(pctx, obj, type->of));
*ret = obj;
return (ISC_R_SUCCESS);
cleanup:
- CLEANUP_OBJ(obj);
+ CLEANUP_OBJ(obj);
return (result);
}
@@ -851,7 +851,7 @@ cfg_obj_asboolean(const cfg_obj_t *obj) {
static isc_result_t
parse_boolean(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret)
{
- isc_result_t result;
+ isc_result_t result;
isc_boolean_t value;
cfg_obj_t *obj = NULL;
UNUSED(type);
@@ -1109,6 +1109,29 @@ cfg_list_next(const cfg_listelt_t *elt) {
return (ISC_LIST_NEXT(elt, link));
}
+/*
+ * Return the length of a list object. If obj is NULL or is not
+ * a list, return 0.
+ */
+unsigned int
+cfg_list_length(const cfg_obj_t *obj, isc_boolean_t recurse) {
+ const cfg_listelt_t *elt;
+ unsigned int count = 0;
+
+ if (obj == NULL || !cfg_obj_islist(obj))
+ return (0U);
+ for (elt = cfg_list_first(obj);
+ elt != NULL;
+ elt = cfg_list_next(elt)) {
+ if (recurse && cfg_obj_islist(elt->obj)) {
+ count += cfg_list_length(elt->obj, recurse);
+ } else {
+ count++;
+ }
+ }
+ return (count);
+}
+
const cfg_obj_t *
cfg_listelt_value(const cfg_listelt_t *elt) {
REQUIRE(elt != NULL);
@@ -1304,7 +1327,7 @@ parse_symtab_elt(cfg_parser_t *pctx, const char *name,
if (callback && pctx->callback != NULL)
CHECK(pctx->callback(name, obj, pctx->callbackarg));
-
+
symval.as_pointer = obj;
CHECK(isc_symtab_define(symtab, name,
1, symval,
@@ -1351,7 +1374,7 @@ parse_any_named_map(cfg_parser_t *pctx, cfg_type_t *nametype, const cfg_type_t *
}
/*
- * Parse a map identified by a string name. E.g., "name { foo 1; }".
+ * Parse a map identified by a string name. E.g., "name { foo 1; }".
* Used for the "key" and "channel" statements.
*/
isc_result_t
@@ -1431,7 +1454,7 @@ void
cfg_doc_mapbody(cfg_printer_t *pctx, const cfg_type_t *type) {
const cfg_clausedef_t * const *clauseset;
const cfg_clausedef_t *clause;
-
+
for (clauseset = type->of; *clauseset != NULL; clauseset++) {
for (clause = *clauseset;
clause->name != NULL;
@@ -1454,6 +1477,7 @@ static struct flagtext {
{ CFG_CLAUSEFLAG_NYI, "not yet implemented" },
{ CFG_CLAUSEFLAG_OBSOLETE, "obsolete" },
{ CFG_CLAUSEFLAG_NEWDEFAULT, "default changed" },
+ { CFG_CLAUSEFLAG_TESTONLY, "test only" },
{ 0, NULL }
};
@@ -1488,7 +1512,7 @@ void
cfg_doc_map(cfg_printer_t *pctx, const cfg_type_t *type) {
const cfg_clausedef_t * const *clauseset;
const cfg_clausedef_t *clause;
-
+
if (type->parse == cfg_parse_named_map) {
cfg_doc_obj(pctx, &cfg_type_astring);
cfg_print_chars(pctx, " ", 1);
@@ -1499,9 +1523,9 @@ cfg_doc_map(cfg_printer_t *pctx, const cfg_type_t *type) {
cfg_doc_obj(pctx, &cfg_type_netprefix);
cfg_print_chars(pctx, " ", 1);
}
-
+
print_open(pctx);
-
+
for (clauseset = type->of; *clauseset != NULL; clauseset++) {
for (clause = *clauseset;
clause->name != NULL;
@@ -1530,13 +1554,13 @@ cfg_map_get(const cfg_obj_t *mapobj, const char* name, const cfg_obj_t **obj) {
isc_result_t result;
isc_symvalue_t val;
const cfg_map_t *map;
-
+
REQUIRE(mapobj != NULL && mapobj->type->rep == &cfg_rep_map);
REQUIRE(name != NULL);
REQUIRE(obj != NULL && *obj == NULL);
map = &mapobj->value.map;
-
+
result = isc_symtab_lookup(map->symtab, name, MAP_SYM, &val);
if (result != ISC_R_SUCCESS)
return (result);
@@ -1555,7 +1579,7 @@ cfg_map_getname(const cfg_obj_t *mapobj) {
static isc_result_t
parse_token(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
cfg_obj_t *obj = NULL;
- isc_result_t result;
+ isc_result_t result;
isc_region_t r;
UNUSED(type);
@@ -1646,7 +1670,7 @@ cfg_type_t cfg_type_unsupported = {
*
* If CFG_ADDR_WILDOK is set in flags, "*" can be used as a wildcard
* and at least one of CFG_ADDR_V4OK and CFG_ADDR_V6OK must also be set. The
- * "*" is interpreted as the IPv4 wildcard address if CFG_ADDR_V4OK is
+ * "*" is interpreted as the IPv4 wildcard address if CFG_ADDR_V4OK is
* set (including the case where CFG_ADDR_V4OK and CFG_ADDR_V6OK are both set),
* and the IPv6 wildcard address otherwise.
*/
@@ -1844,7 +1868,7 @@ cfg_doc_netaddr(cfg_printer_t *pctx, const cfg_type_t *type) {
if (n != 0)
cfg_print_chars(pctx, " | ", 3);
cfg_print_cstr(pctx, "<ipv6_address>");
- n++;
+ n++;
}
if (*flagp & CFG_ADDR_WILDOK) {
if (n != 0)
@@ -2031,7 +2055,7 @@ cfg_doc_sockaddr(cfg_printer_t *pctx, const cfg_type_t *type) {
if (n != 0)
cfg_print_chars(pctx, " | ", 3);
cfg_print_cstr(pctx, "<ipv6_address>");
- n++;
+ n++;
}
if (*flagp & CFG_ADDR_WILDOK) {
if (n != 0)
diff --git a/lib/isccfg/version.c b/lib/isccfg/version.c
index 0b7287bac449..25b98c69417e 100644
--- a/lib/isccfg/version.c
+++ b/lib/isccfg/version.c
@@ -1,8 +1,8 @@
/*
- * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1998-2001 Internet Software Consortium.
*
- * Permission to use, copy, modify, and distribute this software for any
+ * Permission to use, copy, modify, and/or 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.
*
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: version.c,v 1.3.18.2 2005/04/29 00:17:15 marka Exp $ */
+/* $Id: version.c,v 1.7 2007/06/19 23:47:22 tbox Exp $ */
/*! \file */