summaryrefslogtreecommitdiffstats
path: root/lib/isccfg
diff options
context:
space:
mode:
authordougb <dougb@FreeBSD.org>2011-09-01 05:24:42 +0000
committerdougb <dougb@FreeBSD.org>2011-09-01 05:24:42 +0000
commitada65d99fb1417107a796d4d82e039f1d9a956a0 (patch)
treef929ac955ed5ffe7020bc29e63139cb1c4d71c57 /lib/isccfg
parent25b6a0332b63209d2c179bbe5581562e79f3d168 (diff)
downloadFreeBSD-src-ada65d99fb1417107a796d4d82e039f1d9a956a0.zip
FreeBSD-src-ada65d99fb1417107a796d4d82e039f1d9a956a0.tar.gz
Vendor import of BIND 9.8.1
Diffstat (limited to 'lib/isccfg')
-rw-r--r--lib/isccfg/Makefile.in4
-rw-r--r--lib/isccfg/aclconf.c83
-rw-r--r--lib/isccfg/api6
-rw-r--r--lib/isccfg/include/isccfg/aclconf.h22
-rw-r--r--lib/isccfg/namedconf.c30
-rw-r--r--lib/isccfg/parser.c13
6 files changed, 107 insertions, 51 deletions
diff --git a/lib/isccfg/Makefile.in b/lib/isccfg/Makefile.in
index 37b0a26..73d8499 100644
--- a/lib/isccfg/Makefile.in
+++ b/lib/isccfg/Makefile.in
@@ -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.21.244.1.2.1 2011-06-02 23:47:37 tbox Exp $
+# $Id: Makefile.in,v 1.21.244.3 2011-03-10 04:29:18 each Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@@ -27,7 +27,7 @@ top_srcdir = @top_srcdir@
CINCLUDES = -I. ${DNS_INCLUDES} ${ISC_INCLUDES} ${ISCCFG_INCLUDES}
-CDEFINES = @USE_DLZ@
+CDEFINES =
CWARNINGS =
ISCLIBS = ../../lib/isc/libisc.@A@
diff --git a/lib/isccfg/aclconf.c b/lib/isccfg/aclconf.c
index 44d436a4..34a54a3 100644
--- a/lib/isccfg/aclconf.c
+++ b/lib/isccfg/aclconf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2011 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1999-2002 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: aclconf.c,v 1.29 2010-08-13 23:47:03 tbox Exp $ */
+/* $Id: aclconf.c,v 1.29.72.2 2011-06-17 23:47:11 tbox Exp $ */
#include <config.h>
@@ -33,39 +33,70 @@
#define LOOP_MAGIC ISC_MAGIC('L','O','O','P')
-void
-cfg_aclconfctx_init(cfg_aclconfctx_t *ctx) {
- ISC_LIST_INIT(ctx->named_acl_cache);
+isc_result_t
+cfg_aclconfctx_create(isc_mem_t *mctx, cfg_aclconfctx_t **ret) {
+ isc_result_t result;
+ cfg_aclconfctx_t *actx;
+
+ REQUIRE(mctx != NULL);
+ REQUIRE(ret != NULL && *ret == NULL);
+
+ actx = isc_mem_get(mctx, sizeof(*actx));
+ if (actx == NULL)
+ return (ISC_R_NOMEMORY);
+
+ result = isc_refcount_init(&actx->references, 1);
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
+
+ actx->mctx = NULL;
+ isc_mem_attach(mctx, &actx->mctx);
+ ISC_LIST_INIT(actx->named_acl_cache);
+
+ *ret = actx;
+ return (ISC_R_SUCCESS);
+
+ cleanup:
+ isc_mem_put(mctx, actx, sizeof(*actx));
+ return (result);
}
void
-cfg_aclconfctx_clear(cfg_aclconfctx_t *ctx) {
- dns_acl_t *dacl, *next;
+cfg_aclconfctx_attach(cfg_aclconfctx_t *src, cfg_aclconfctx_t **dest) {
+ REQUIRE(src != NULL);
+ REQUIRE(dest != NULL && *dest == NULL);
- for (dacl = ISC_LIST_HEAD(ctx->named_acl_cache);
- dacl != NULL;
- dacl = next)
- {
- next = ISC_LIST_NEXT(dacl, nextincache);
- dns_acl_detach(&dacl);
- }
+ isc_refcount_increment(&src->references, NULL);
+ *dest = src;
}
void
-cfg_aclconfctx_clone(cfg_aclconfctx_t *src, cfg_aclconfctx_t *dest) {
+cfg_aclconfctx_detach(cfg_aclconfctx_t **actxp) {
+ cfg_aclconfctx_t *actx;
dns_acl_t *dacl, *next;
- REQUIRE(src != NULL && dest != NULL);
-
- cfg_aclconfctx_init(dest);
- for (dacl = ISC_LIST_HEAD(src->named_acl_cache);
- dacl != NULL;
- dacl = next)
- {
- dns_acl_t *copy;
- next = ISC_LIST_NEXT(dacl, nextincache);
- dns_acl_attach(dacl, &copy);
- ISC_LIST_APPEND(dest->named_acl_cache, copy, nextincache);
+ isc_mem_t *mctx;
+ unsigned int refs;
+
+ REQUIRE(actxp != NULL && *actxp != NULL);
+
+ actx = *actxp;
+ mctx = actx->mctx;
+
+ isc_refcount_decrement(&actx->references, &refs);
+ if (refs == 0) {
+ for (dacl = ISC_LIST_HEAD(actx->named_acl_cache);
+ dacl != NULL;
+ dacl = next)
+ {
+ next = ISC_LIST_NEXT(dacl, nextincache);
+ ISC_LIST_UNLINK(actx->named_acl_cache, dacl,
+ nextincache);
+ dns_acl_detach(&dacl);
+ }
+ isc_mem_putanddetach(&actx->mctx, actx, sizeof(*actx));
}
+
+ *actxp = NULL;
}
/*
diff --git a/lib/isccfg/api b/lib/isccfg/api
index 7821c32..750ed97 100644
--- a/lib/isccfg/api
+++ b/lib/isccfg/api
@@ -1,3 +1,3 @@
-LIBINTERFACE = 81
-LIBREVISION = 1
-LIBAGE = 1
+LIBINTERFACE = 82
+LIBREVISION = 0
+LIBAGE = 0
diff --git a/lib/isccfg/include/isccfg/aclconf.h b/lib/isccfg/include/isccfg/aclconf.h
index 49aef03..2b5ff23 100644
--- a/lib/isccfg/include/isccfg/aclconf.h
+++ b/lib/isccfg/include/isccfg/aclconf.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004-2007, 2010 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2007, 2010, 2011 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1999-2001 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: aclconf.h,v 1.12 2010-08-13 23:47:04 tbox Exp $ */
+/* $Id: aclconf.h,v 1.12.72.2 2011-06-17 23:47:12 tbox Exp $ */
#ifndef ISCCFG_ACLCONF_H
#define ISCCFG_ACLCONF_H 1
@@ -28,7 +28,8 @@
typedef struct cfg_aclconfctx {
ISC_LIST(dns_acl_t) named_acl_cache;
- ISC_LIST(dns_iptable_t) named_iptable_cache;
+ isc_mem_t *mctx;
+ isc_refcount_t references;
} cfg_aclconfctx_t;
/***
@@ -37,22 +38,23 @@ typedef struct cfg_aclconfctx {
ISC_LANG_BEGINDECLS
-void
-cfg_aclconfctx_init(cfg_aclconfctx_t *ctx);
+isc_result_t
+cfg_aclconfctx_create(isc_mem_t *mctx, cfg_aclconfctx_t **ret);
/*
- * Initialize an ACL configuration context.
+ * Creates and initializes an ACL configuration context.
*/
void
-cfg_aclconfctx_clone(cfg_aclconfctx_t *src, cfg_aclconfctx_t *dest);
+cfg_aclconfctx_detach(cfg_aclconfctx_t **actxp);
/*
- * Copy the contents of one ACL configuration context into another.
+ * Removes a reference to an ACL configuration context; when references
+ * reaches zero, clears the contents and deallocate the structure.
*/
void
-cfg_aclconfctx_clear(cfg_aclconfctx_t *ctx);
+cfg_aclconfctx_attach(cfg_aclconfctx_t *src, cfg_aclconfctx_t **dest);
/*
- * Clear the contents of an ACL configuration context.
+ * Attaches a pointer to an existing ACL configuration context.
*/
isc_result_t
diff --git a/lib/isccfg/namedconf.c b/lib/isccfg/namedconf.c
index f80d34b..46afd16 100644
--- a/lib/isccfg/namedconf.c
+++ b/lib/isccfg/namedconf.c
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: namedconf.c,v 1.131.8.1 2011-02-03 05:50:08 marka Exp $ */
+/* $Id: namedconf.c,v 1.131.8.4 2011-05-23 20:56:11 each Exp $ */
/*! \file */
@@ -542,8 +542,7 @@ static cfg_type_t cfg_type_bracketed_sockaddrlist = {
&cfg_rep_list, &cfg_type_sockaddr
};
-static const char *autodnssec_enums[] = { "allow", "maintain", "create",
- "off", NULL };
+static const char *autodnssec_enums[] = { "allow", "maintain", "off", NULL };
static cfg_type_t cfg_type_autodnssec = {
"autodnssec", cfg_parse_enum, cfg_print_ustring, cfg_doc_enum,
&cfg_rep_string, &autodnssec_enums
@@ -1131,6 +1130,24 @@ static cfg_type_t cfg_type_rpz = {
* dnssec-lookaside
*/
+static void
+print_lookaside(cfg_printer_t *pctx, const cfg_obj_t *obj)
+{
+ const cfg_obj_t *domain = obj->value.tuple[0];
+
+ if (domain->value.string.length == 4 &&
+ strncmp(domain->value.string.base, "auto", 4) == 0)
+ cfg_print_cstr(pctx, "auto");
+ else
+ cfg_print_tuple(pctx, obj);
+}
+
+static void
+doc_lookaside(cfg_printer_t *pctx, const cfg_type_t *type) {
+ UNUSED(type);
+ cfg_print_cstr(pctx, "( <string> trust-anchor <string> | auto )");
+}
+
static keyword_type_t trustanchor_kw = { "trust-anchor", &cfg_type_astring };
static cfg_type_t cfg_type_optional_trustanchor = {
@@ -1145,7 +1162,7 @@ static cfg_tuplefielddef_t lookaside_fields[] = {
};
static cfg_type_t cfg_type_lookaside = {
- "lookaside", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple,
+ "lookaside", cfg_parse_tuple, print_lookaside, doc_lookaside,
&cfg_rep_tuple, lookaside_fields
};
@@ -2235,7 +2252,8 @@ static cfg_type_t cfg_type_controls_sockaddr = {
* statement, which takes a single key with or without braces and semicolon.
*/
static isc_result_t
-parse_server_key_kludge(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret)
+parse_server_key_kludge(cfg_parser_t *pctx, const cfg_type_t *type,
+ cfg_obj_t **ret)
{
isc_result_t result;
isc_boolean_t braces = ISC_FALSE;
@@ -2245,7 +2263,7 @@ parse_server_key_kludge(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **
CHECK(cfg_peektoken(pctx, 0));
if (pctx->token.type == isc_tokentype_special &&
pctx->token.value.as_char == '{') {
- result = cfg_gettoken(pctx, 0);
+ CHECK(cfg_gettoken(pctx, 0));
braces = ISC_TRUE;
}
diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c
index 87ad391..f561ab8 100644
--- a/lib/isccfg/parser.c
+++ b/lib/isccfg/parser.c
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: parser.c,v 1.139 2011-01-04 23:47:14 tbox Exp $ */
+/* $Id: parser.c,v 1.139.14.2 2011-03-11 06:47:09 marka Exp $ */
/*! \file */
@@ -1904,6 +1904,7 @@ cfg_doc_netaddr(cfg_printer_t *pctx, const cfg_type_t *type) {
cfg_print_chars(pctx, " | ", 3);
cfg_print_chars(pctx, "*", 1);
n++;
+ POST(n);
}
if (*flagp != CFG_ADDR_V4OK && *flagp != CFG_ADDR_V6OK)
cfg_print_chars(pctx, " )", 2);
@@ -1943,7 +1944,7 @@ cfg_parse_netprefix(cfg_parser_t *pctx, const cfg_type_t *type,
cfg_obj_t *obj = NULL;
isc_result_t result;
isc_netaddr_t netaddr;
- unsigned int addrlen, prefixlen;
+ unsigned int addrlen = 0, prefixlen;
UNUSED(type);
CHECK(cfg_parse_rawaddr(pctx, CFG_ADDR_V4OK | CFG_ADDR_V4PREFIXOK |
@@ -1956,7 +1957,6 @@ cfg_parse_netprefix(cfg_parser_t *pctx, const cfg_type_t *type,
addrlen = 128;
break;
default:
- addrlen = 0;
INSIST(0);
break;
}
@@ -2006,8 +2006,12 @@ cfg_obj_isnetprefix(const cfg_obj_t *obj) {
void
cfg_obj_asnetprefix(const cfg_obj_t *obj, isc_netaddr_t *netaddr,
- unsigned int *prefixlen) {
+ unsigned int *prefixlen)
+{
REQUIRE(obj != NULL && obj->type->rep == &cfg_rep_netprefix);
+ REQUIRE(netaddr != NULL);
+ REQUIRE(prefixlen != NULL);
+
*netaddr = obj->value.netprefix.address;
*prefixlen = obj->value.netprefix.prefixlen;
}
@@ -2091,6 +2095,7 @@ cfg_doc_sockaddr(cfg_printer_t *pctx, const cfg_type_t *type) {
cfg_print_chars(pctx, " | ", 3);
cfg_print_chars(pctx, "*", 1);
n++;
+ POST(n);
}
cfg_print_chars(pctx, " ) ", 3);
if (*flagp & CFG_ADDR_WILDOK) {
OpenPOWER on IntegriCloud