Adam Tkac d6323c
diff -up bind-9.9.2/bin/named/main.c.dyndb bind-9.9.2/bin/named/main.c
Adam Tkac d6323c
--- bind-9.9.2/bin/named/main.c.dyndb	2012-09-27 02:35:19.000000000 +0200
Adam Tkac d6323c
+++ bind-9.9.2/bin/named/main.c	2012-10-11 13:13:10.626497598 +0200
Adam Tkac e99cc3
@@ -45,6 +45,7 @@
Martin Nagy b1c08c
 #include <isccc/result.h>
Martin Nagy b1c08c
 
Martin Nagy b1c08c
 #include <dns/dispatch.h>
Martin Nagy b1c08c
+#include <dns/dynamic_db.h>
Martin Nagy b1c08c
 #include <dns/name.h>
Martin Nagy b1c08c
 #include <dns/result.h>
Martin Nagy b1c08c
 #include <dns/view.h>
Adam Tkac d6323c
diff -up bind-9.9.2/bin/named/server.c.dyndb bind-9.9.2/bin/named/server.c
Adam Tkac d6323c
--- bind-9.9.2/bin/named/server.c.dyndb	2012-09-27 02:35:19.000000000 +0200
Adam Tkac d6323c
+++ bind-9.9.2/bin/named/server.c	2012-10-11 13:13:10.630497590 +0200
Adam Tkac 961e87
@@ -63,6 +63,7 @@
Adam Tkac 86c080
 #include <dns/db.h>
Adam Tkac 86c080
 #include <dns/dispatch.h>
Martin Nagy b1c08c
 #include <dns/dlz.h>
Martin Nagy b1c08c
+#include <dns/dynamic_db.h>
Adam Tkac 5bc2b4
 #include <dns/dns64.h>
Martin Nagy b1c08c
 #include <dns/forward.h>
Martin Nagy b1c08c
 #include <dns/journal.h>
Adam Tkac 6cd938
@@ -1161,6 +1162,72 @@ configure_peer(const cfg_obj_t *cpeer, i
Martin Nagy b1c08c
 }
Martin Nagy b1c08c
 
Martin Nagy b1c08c
 static isc_result_t
Martin Nagy b1c08c
+configure_dynamic_db(const cfg_obj_t *dynamic_db, isc_mem_t *mctx,
Martin Nagy 32aa83
+		     const dns_dyndb_arguments_t *dyndb_args)
Martin Nagy b1c08c
+{
Martin Nagy b1c08c
+	isc_result_t result;
Martin Nagy b1c08c
+	const cfg_obj_t *obj;
Martin Nagy b1c08c
+	const cfg_obj_t *options;
Martin Nagy b1c08c
+	const cfg_listelt_t *element;
Martin Nagy b1c08c
+	const char *name;
Martin Nagy b1c08c
+	const char *libname;
Martin Nagy b1c08c
+	const char **argv = NULL;
Martin Nagy b1c08c
+	unsigned int i;
Martin Nagy b1c08c
+	unsigned int len;
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	/* Get the name of the database. */
Martin Nagy b1c08c
+	obj = cfg_tuple_get(dynamic_db, "name");
Martin Nagy b1c08c
+	name = cfg_obj_asstring(obj);
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	/* Get options. */
Martin Nagy b1c08c
+	options = cfg_tuple_get(dynamic_db, "options");
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	/* Get library name. */
Martin Nagy b1c08c
+	obj = NULL;
Martin Nagy b1c08c
+	CHECK(cfg_map_get(options, "library", &obj));
Martin Nagy b1c08c
+	libname = cfg_obj_asstring(obj);
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	/* Create a list of arguments. */
Martin Nagy b1c08c
+	obj = NULL;
Martin Nagy 205f42
+	result = cfg_map_get(options, "arg", &obj);
Martin Nagy 205f42
+	if (result == ISC_R_NOTFOUND)
Martin Nagy 205f42
+		len = 0;
Martin Nagy 205f42
+	else if (result == ISC_R_SUCCESS)
Martin Nagy 205f42
+		len = cfg_list_length(obj, isc_boolean_false);
Martin Nagy 205f42
+	else
Martin Nagy 205f42
+		goto cleanup;
Martin Nagy 205f42
+
Martin Nagy 205f42
+	/* Account for the last terminating NULL. */
Martin Nagy 205f42
+	len++;
Martin Nagy 205f42
+
Martin Nagy 205f42
+	argv = isc_mem_allocate(mctx, len * sizeof(const char *));
Martin Nagy 205f42
+	if (argv == NULL) {
Martin Nagy 205f42
+		result = ISC_R_NOMEMORY;
Martin Nagy 205f42
+		goto cleanup;
Martin Nagy b1c08c
+	}
Martin Nagy b1c08c
+	for (element = cfg_list_first(obj), i = 0;
Martin Nagy b1c08c
+	     element != NULL;
Martin Nagy b1c08c
+	     element = cfg_list_next(element), i++)
Martin Nagy b1c08c
+	{
Martin Nagy b1c08c
+		REQUIRE(i < len);
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+		obj = cfg_listelt_value(element);
Martin Nagy b1c08c
+		argv[i] = cfg_obj_asstring(obj);
Martin Nagy b1c08c
+	}
Martin Nagy b1c08c
+	REQUIRE(i < len);
Martin Nagy b1c08c
+	argv[i] = NULL;
Martin Nagy b1c08c
+
Martin Nagy 32aa83
+	CHECK(dns_dynamic_db_load(libname, name, mctx, argv, dyndb_args));
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+cleanup:
Martin Nagy b1c08c
+	if (argv != NULL)
Martin Nagy b1c08c
+		isc_mem_free(mctx, argv);
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	return result;
Martin Nagy b1c08c
+}
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+static isc_result_t
Martin Nagy b1c08c
 disable_algorithms(const cfg_obj_t *disabled, dns_resolver_t *resolver) {
Martin Nagy b1c08c
 	isc_result_t result;
Martin Nagy b1c08c
 	const cfg_obj_t *algorithms;
Adam Tkac d6323c
@@ -1586,6 +1653,7 @@ configure_view(dns_view_t *view, cfg_obj
Adam Tkac 86c080
 	const cfg_obj_t *dlz;
Martin Nagy b1c08c
 	unsigned int dlzargc;
Martin Nagy b1c08c
 	char **dlzargv;
Martin Nagy b1c08c
+	const cfg_obj_t *dynamic_db_list;
Martin Nagy b1c08c
 	const cfg_obj_t *disabled;
Martin Nagy b1c08c
 	const cfg_obj_t *obj;
Martin Nagy b1c08c
 	const cfg_listelt_t *element;
Adam Tkac d6323c
@@ -1816,6 +1884,8 @@ configure_view(dns_view_t *view, cfg_obj
Adam Tkac 86c080
 		}
Adam Tkac 86c080
 	}
Martin Nagy b1c08c
 
Adam Tkac 86c080
+
Adam Tkac 86c080
+
Adam Tkac 6cd938
 	/*
Adam Tkac 6cd938
 	 * Obtain configuration parameters that affect the decision of whether
Adam Tkac 6cd938
 	 * we can reuse/share an existing cache.
Adam Tkac d6323c
@@ -2721,6 +2791,37 @@ configure_view(dns_view_t *view, cfg_obj
Adam Tkac 6cd938
 		dns_view_setrootdelonly(view, ISC_FALSE);
Adam Tkac 6cd938
 
Adam Tkac 6cd938
 	/*
Martin Nagy b1c08c
+	 * Configure dynamic databases.
Martin Nagy b1c08c
+	 */
Martin Nagy b1c08c
+	dynamic_db_list = NULL;
Martin Nagy b1c08c
+	if (voptions != NULL)
Martin Nagy b1c08c
+		(void)cfg_map_get(voptions, "dynamic-db", &dynamic_db_list);
Martin Nagy b1c08c
+	else
Martin Nagy b1c08c
+		(void)cfg_map_get(config, "dynamic-db", &dynamic_db_list);
Martin Nagy 32aa83
+	element = cfg_list_first(dynamic_db_list);
Martin Nagy 32aa83
+	if (element != NULL) {
Martin Nagy 32aa83
+		dns_dyndb_arguments_t *args;
Martin Nagy 32aa83
+
Martin Nagy 32aa83
+		args = dns_dyndb_arguments_create(mctx);
Martin Nagy 32aa83
+		if (args == NULL) {
Martin Nagy 32aa83
+			result = ISC_R_NOMEMORY;
Martin Nagy 32aa83
+			goto cleanup;
Martin Nagy 32aa83
+		}
Martin Nagy 32aa83
+		dns_dyndb_set_view(args, view);
Martin Nagy 32aa83
+		dns_dyndb_set_zonemgr(args, ns_g_server->zonemgr);
Martin Nagy 32aa83
+		dns_dyndb_set_task(args, ns_g_server->task);
Martin Nagy 32aa83
+		dns_dyndb_set_timermgr(args, ns_g_timermgr);
Martin Nagy 32aa83
+		while (element != NULL) {
Martin Nagy 32aa83
+			obj = cfg_listelt_value(element);
Martin Nagy 32aa83
+			CHECK(configure_dynamic_db(obj, mctx, args));
Adam Tkac 86c080
+		
Martin Nagy 32aa83
+			element = cfg_list_next(element);
Martin Nagy 32aa83
+		}
Martin Nagy 32aa83
+
Martin Nagy 32aa83
+		dns_dyndb_arguments_destroy(mctx, args);
Martin Nagy b1c08c
+	}
Martin Nagy b1c08c
+
Adam Tkac 6cd938
+	/*
Adam Tkac 6cd938
 	 * Setup automatic empty zones.  If recursion is off then
Adam Tkac 6cd938
 	 * they are disabled by default.
Adam Tkac 6cd938
 	 */
Adam Tkac d6323c
@@ -4388,6 +4489,7 @@ load_configuration(const char *filename,
Adam Tkac 86c080
 		cfg_aclconfctx_detach(&ns_g_aclconfctx);
Adam Tkac 86c080
 	CHECK(cfg_aclconfctx_create(ns_g_mctx, &ns_g_aclconfctx));
Martin Nagy 01aab7
 
Martin Nagy 01aab7
+	dns_dynamic_db_cleanup(ISC_FALSE);
Martin Nagy 01aab7
 	/*
Martin Nagy 01aab7
 	 * Parse the global default pseudo-config file.
Martin Nagy 01aab7
 	 */
Adam Tkac d6323c
@@ -5493,6 +5595,8 @@ shutdown_server(isc_task_t *task, isc_ev
Adam Tkac 6cd938
 			dns_view_detach(&view);
Adam Tkac 6cd938
 	}
Adam Tkac 6cd938
 
Adam Tkac 6cd938
+	dns_dynamic_db_cleanup(ISC_TRUE);
Adam Tkac 6cd938
+
Adam Tkac 6cd938
 	while ((nsc = ISC_LIST_HEAD(server->cachelist)) != NULL) {
Adam Tkac 6cd938
 		ISC_LIST_UNLINK(server->cachelist, nsc, link);
Adam Tkac 6cd938
 		dns_cache_detach(&nsc->cache);
Adam Tkac d6323c
diff -up bind-9.9.2/lib/dns/dynamic_db.c.dyndb bind-9.9.2/lib/dns/dynamic_db.c
Adam Tkac d6323c
--- bind-9.9.2/lib/dns/dynamic_db.c.dyndb	2012-10-11 13:13:10.630497590 +0200
Adam Tkac d6323c
+++ bind-9.9.2/lib/dns/dynamic_db.c	2012-10-11 13:13:10.630497590 +0200
Adam Tkac 95c9b3
@@ -0,0 +1,366 @@
Martin Nagy b1c08c
+/*
Adam Tkac 95c9b3
+ * Copyright (C) 2008-2011  Red Hat, Inc.
Martin Nagy b1c08c
+ *
Martin Nagy b1c08c
+ * Permission to use, copy, modify, and/or distribute this software for any
Martin Nagy b1c08c
+ * purpose with or without fee is hereby granted, provided that the above
Martin Nagy b1c08c
+ * copyright notice and this permission notice appear in all copies.
Martin Nagy b1c08c
+ *
Martin Nagy 32aa83
+ * THE SOFTWARE IS PROVIDED "AS IS" AND Red Hat DISCLAIMS ALL WARRANTIES WITH
Martin Nagy b1c08c
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
Martin Nagy 32aa83
+ * AND FITNESS.  IN NO EVENT SHALL Red Hat BE LIABLE FOR ANY SPECIAL, DIRECT,
Martin Nagy b1c08c
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
Martin Nagy b1c08c
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
Martin Nagy b1c08c
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
Martin Nagy b1c08c
+ * PERFORMANCE OF THIS SOFTWARE.
Martin Nagy b1c08c
+ */
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+#include <config.h>
Martin Nagy b1c08c
+
Martin Nagy ec6004
+#include <isc/buffer.h>
Martin Nagy b1c08c
+#include <isc/mem.h>
Martin Nagy b1c08c
+#include <isc/mutex.h>
Martin Nagy b1c08c
+#include <isc/once.h>
Martin Nagy b1c08c
+#include <isc/result.h>
Martin Nagy ec6004
+#include <isc/region.h>
Martin Nagy 32aa83
+#include <isc/task.h>
Martin Nagy b1c08c
+#include <isc/types.h>
Martin Nagy b1c08c
+#include <isc/util.h>
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+#include <dns/dynamic_db.h>
Martin Nagy b1c08c
+#include <dns/log.h>
Martin Nagy b1c08c
+#include <dns/types.h>
Martin Nagy 32aa83
+#include <dns/view.h>
Martin Nagy 32aa83
+#include <dns/zone.h>
Martin Nagy b1c08c
+
Martin Nagy 32aa83
+#include <string.h>
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+#if HAVE_DLFCN_H
Martin Nagy b1c08c
+#include <dlfcn.h>
Martin Nagy b1c08c
+#endif
Martin Nagy b1c08c
+
Martin Nagy ec6004
+#ifndef DYNDB_LIBDIR
Martin Nagy ec6004
+#define DYNDB_LIBDIR ""
Martin Nagy ec6004
+#endif
Martin Nagy ec6004
+
Martin Nagy b1c08c
+#define CHECK(op)						\
Martin Nagy b1c08c
+	do { result = (op);					\
Martin Nagy b1c08c
+		if (result != ISC_R_SUCCESS) goto cleanup;	\
Martin Nagy b1c08c
+	} while (0)
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+typedef isc_result_t (*register_func_t)(isc_mem_t *mctx, const char *name,
Adam Tkac 95c9b3
+		const char * const *argv,
Adam Tkac 95c9b3
+		const dns_dyndb_arguments_t *dyndb_args);
Martin Nagy b1c08c
+typedef void (*destroy_func_t)(void);
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+typedef struct dyndb_implementation dyndb_implementation_t;
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+struct dyndb_implementation {
Martin Nagy b1c08c
+	isc_mem_t			*mctx;
Martin Nagy b1c08c
+	void				*handle;
Martin Nagy b1c08c
+	register_func_t			register_function;
Martin Nagy b1c08c
+	destroy_func_t			destroy_function;
Martin Nagy b1c08c
+	LINK(dyndb_implementation_t)	link;
Martin Nagy b1c08c
+};
Martin Nagy b1c08c
+
Martin Nagy 32aa83
+struct dns_dyndb_arguments {
Martin Nagy 32aa83
+	dns_view_t	*view;
Martin Nagy 32aa83
+	dns_zonemgr_t	*zmgr;
Martin Nagy 32aa83
+	isc_task_t	*task;
Martin Nagy 32aa83
+	isc_timermgr_t	*timermgr;
Martin Nagy 32aa83
+};
Martin Nagy 32aa83
+
Martin Nagy b1c08c
+/* List of implementations. Locked by dyndb_lock. */
Martin Nagy b1c08c
+static LIST(dyndb_implementation_t) dyndb_implementations;
Martin Nagy b1c08c
+/* Locks dyndb_implementations. */
Martin Nagy b1c08c
+static isc_mutex_t dyndb_lock;
Martin Nagy b1c08c
+static isc_once_t once = ISC_ONCE_INIT;
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+static void
Martin Nagy b1c08c
+dyndb_initialize(void) {
Martin Nagy b1c08c
+	RUNTIME_CHECK(isc_mutex_init(&dyndb_lock) == ISC_R_SUCCESS);
Martin Nagy b1c08c
+	INIT_LIST(dyndb_implementations);
Martin Nagy b1c08c
+}
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+#if HAVE_DLFCN_H
Martin Nagy b1c08c
+static isc_result_t
Martin Nagy b1c08c
+load_symbol(void *handle, const char *symbol_name, void **symbolp)
Martin Nagy b1c08c
+{
Martin Nagy b1c08c
+	const char *errmsg;
Martin Nagy b1c08c
+	void *symbol;
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	REQUIRE(handle != NULL);
Martin Nagy b1c08c
+	REQUIRE(symbolp != NULL && *symbolp == NULL);
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	symbol = dlsym(handle, symbol_name);
Martin Nagy b1c08c
+	if (symbol == NULL) {
Martin Nagy b1c08c
+		errmsg = dlerror();
Martin Nagy b1c08c
+		if (errmsg == NULL)
Martin Nagy b1c08c
+			errmsg = "returned function pointer is NULL";
Martin Nagy b1c08c
+		isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
Martin Nagy b1c08c
+			      DNS_LOGMODULE_DYNDB, ISC_LOG_ERROR,
Martin Nagy b1c08c
+			      "failed to lookup symbol %s: %s",
Martin Nagy b1c08c
+			      symbol_name, errmsg);
Martin Nagy b1c08c
+		return ISC_R_FAILURE;
Martin Nagy b1c08c
+	}
Martin Nagy b1c08c
+	dlerror();
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	*symbolp = symbol;
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	return ISC_R_SUCCESS;
Martin Nagy b1c08c
+}
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+static isc_result_t
Martin Nagy b1c08c
+load_library(isc_mem_t *mctx, const char *filename, dyndb_implementation_t **impp)
Martin Nagy b1c08c
+{
Martin Nagy b1c08c
+	isc_result_t result;
Martin Nagy ec6004
+	size_t module_size;
Martin Nagy ec6004
+	isc_buffer_t *module_buf = NULL;
Martin Nagy ec6004
+	isc_region_t module_region;
Adam Tkac 95c9b3
+	void *handle = NULL;
Martin Nagy b1c08c
+	dyndb_implementation_t *imp;
Martin Nagy b1c08c
+	register_func_t register_function = NULL;
Martin Nagy b1c08c
+	destroy_func_t destroy_function = NULL;
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	REQUIRE(impp != NULL && *impp == NULL);
Martin Nagy b1c08c
+
Martin Nagy ec6004
+	/* Build up the full path. */
Martin Nagy ec6004
+	module_size = strlen(DYNDB_LIBDIR) + strlen(filename) + 1;
Martin Nagy ec6004
+	CHECK(isc_buffer_allocate(mctx, &module_buf, module_size));
Martin Nagy ec6004
+	isc_buffer_putstr(module_buf, DYNDB_LIBDIR);
Martin Nagy ec6004
+	isc_buffer_putstr(module_buf, filename);
Martin Nagy ec6004
+	isc_buffer_putuint8(module_buf, 0);
Martin Nagy ec6004
+	isc_buffer_region(module_buf, &module_region);
Martin Nagy ec6004
+
Martin Nagy ec6004
+	handle = dlopen((char *)module_region.base, RTLD_LAZY);
Martin Nagy b1c08c
+	if (handle == NULL) {
Martin Nagy b1c08c
+		isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
Martin Nagy b1c08c
+			      DNS_LOGMODULE_DYNDB, ISC_LOG_ERROR,
Martin Nagy b1c08c
+			      "failed to dynamically load driver '%s': %s",
Martin Nagy b1c08c
+			      filename, dlerror());
Martin Nagy b1c08c
+		result = ISC_R_FAILURE;
Martin Nagy b1c08c
+		goto cleanup;
Martin Nagy b1c08c
+	}
Martin Nagy b1c08c
+	dlerror();
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	CHECK(load_symbol(handle, "dynamic_driver_init",
Martin Nagy b1c08c
+			  (void **)&register_function));
Martin Nagy b1c08c
+	CHECK(load_symbol(handle, "dynamic_driver_destroy",
Martin Nagy b1c08c
+			  (void **)&destroy_function));
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	imp = isc_mem_get(mctx, sizeof(dyndb_implementation_t));
Martin Nagy b1c08c
+	if (imp == NULL) {
Martin Nagy b1c08c
+		result = ISC_R_NOMEMORY;
Martin Nagy b1c08c
+		goto cleanup;
Martin Nagy b1c08c
+	}
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	imp->mctx = NULL;
Martin Nagy b1c08c
+	isc_mem_attach(mctx, &imp->mctx);
Martin Nagy b1c08c
+	imp->handle = handle;
Martin Nagy b1c08c
+	imp->register_function = register_function;
Martin Nagy b1c08c
+	imp->destroy_function = destroy_function;
Martin Nagy b1c08c
+	INIT_LINK(imp, link);
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	*impp = imp;
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+cleanup:
Martin Nagy ec6004
+	if (result != ISC_R_SUCCESS && handle != NULL)
Martin Nagy b1c08c
+		dlclose(handle);
Martin Nagy ec6004
+	if (module_buf != NULL)
Martin Nagy ec6004
+		isc_buffer_free(&module_buf);
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	return result;
Martin Nagy b1c08c
+}
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+static void
Martin Nagy b1c08c
+unload_library(dyndb_implementation_t **impp)
Martin Nagy b1c08c
+{
Martin Nagy b1c08c
+	dyndb_implementation_t *imp;
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	REQUIRE(impp != NULL && *impp != NULL);
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	imp = *impp;
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	isc_mem_putanddetach(&imp->mctx, imp, sizeof(dyndb_implementation_t));
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	*impp = NULL;
Martin Nagy b1c08c
+}
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+#else	/* HAVE_DLFCN_H */
Martin Nagy b1c08c
+static isc_result_t
Martin Nagy b1c08c
+load_library(isc_mem_t *mctx, const char *filename, dyndb_implementation_t **impp)
Martin Nagy b1c08c
+{
Martin Nagy b1c08c
+	UNUSED(mctx);
Martin Nagy b1c08c
+	UNUSED(filename);
Martin Nagy b1c08c
+	UNUSED(impp);
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_DYNDB,
Martin Nagy b1c08c
+		      ISC_LOG_ERROR,
Martin Nagy b1c08c
+		      "dynamic database support is not implemented")
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	return ISC_R_NOTIMPLEMENTED;
Martin Nagy b1c08c
+}
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+static void
Martin Nagy b1c08c
+unload_library(dyndb_implementation_t **impp)
Martin Nagy b1c08c
+{
Martin Nagy b1c08c
+	dyndb_implementation_t *imp;
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	REQUIRE(impp != NULL && *impp != NULL);
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	imp = *impp;
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	isc_mem_putanddetach(&imp->mctx, imp, sizeof(dyndb_implementation_t));
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	*impp = NULL;
Martin Nagy b1c08c
+}
Martin Nagy b1c08c
+#endif	/* HAVE_DLFCN_H */
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+isc_result_t
Martin Nagy b1c08c
+dns_dynamic_db_load(const char *libname, const char *name, isc_mem_t *mctx,
Adam Tkac 95c9b3
+		    const char * const *argv,
Adam Tkac 95c9b3
+		    const dns_dyndb_arguments_t *dyndb_args)
Martin Nagy b1c08c
+{
Martin Nagy b1c08c
+	isc_result_t result;
Martin Nagy b1c08c
+	dyndb_implementation_t *implementation = NULL;
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	RUNTIME_CHECK(isc_once_do(&once, dyndb_initialize) == ISC_R_SUCCESS);
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	CHECK(load_library(mctx, libname, &implementation));
Martin Nagy 32aa83
+	CHECK(implementation->register_function(mctx, name, argv, dyndb_args));
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	LOCK(&dyndb_lock);
Martin Nagy b1c08c
+	APPEND(dyndb_implementations, implementation, link);
Martin Nagy b1c08c
+	UNLOCK(&dyndb_lock);
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	return ISC_R_SUCCESS;
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+cleanup:
Martin Nagy b1c08c
+	if (implementation != NULL)
Martin Nagy b1c08c
+		unload_library(&implementation);
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	return result;
Martin Nagy b1c08c
+}
Martin Nagy b1c08c
+
Martin Nagy 205f42
+void
Martin Nagy 01aab7
+dns_dynamic_db_cleanup(isc_boolean_t exiting)
Martin Nagy b1c08c
+{
Martin Nagy b1c08c
+	dyndb_implementation_t *elem;
Martin Nagy 01aab7
+	dyndb_implementation_t *prev;
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	RUNTIME_CHECK(isc_once_do(&once, dyndb_initialize) == ISC_R_SUCCESS);
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+	LOCK(&dyndb_lock);
Martin Nagy 01aab7
+	elem = TAIL(dyndb_implementations);
Martin Nagy b1c08c
+	while (elem != NULL) {
Martin Nagy 01aab7
+		prev = PREV(elem, link);
Martin Nagy b1c08c
+		UNLINK(dyndb_implementations, elem, link);
Martin Nagy b1c08c
+		elem->destroy_function();
Martin Nagy b1c08c
+		unload_library(&elem);
Martin Nagy 01aab7
+		elem = prev;
Martin Nagy b1c08c
+	}
Martin Nagy b1c08c
+	UNLOCK(&dyndb_lock);
Martin Nagy b1c08c
+
Martin Nagy 01aab7
+	if (exiting == ISC_TRUE)
Martin Nagy 01aab7
+		isc_mutex_destroy(&dyndb_lock);
Martin Nagy b1c08c
+}
Martin Nagy 32aa83
+
Martin Nagy 32aa83
+dns_dyndb_arguments_t *
Martin Nagy 32aa83
+dns_dyndb_arguments_create(isc_mem_t *mctx)
Martin Nagy 32aa83
+{
Martin Nagy 32aa83
+	dns_dyndb_arguments_t *args;
Martin Nagy 32aa83
+
Martin Nagy 32aa83
+	args = isc_mem_get(mctx, sizeof(*args));
Martin Nagy 32aa83
+	if (args != NULL)
Martin Nagy 32aa83
+		memset(args, 0, sizeof(*args));
Martin Nagy 32aa83
+
Martin Nagy 32aa83
+	return args;
Martin Nagy 32aa83
+}
Martin Nagy 32aa83
+
Martin Nagy 32aa83
+void
Martin Nagy 32aa83
+dns_dyndb_arguments_destroy(isc_mem_t *mctx, dns_dyndb_arguments_t *args)
Martin Nagy 32aa83
+{
Martin Nagy 32aa83
+	REQUIRE(args != NULL);
Martin Nagy 32aa83
+
Martin Nagy 32aa83
+	dns_dyndb_set_view(args, NULL);
Martin Nagy 32aa83
+	dns_dyndb_set_zonemgr(args, NULL);
Martin Nagy 32aa83
+	dns_dyndb_set_task(args, NULL);
Martin Nagy 32aa83
+	dns_dyndb_set_timermgr(args, NULL);
Martin Nagy 32aa83
+
Martin Nagy 32aa83
+	isc_mem_put(mctx, args, sizeof(*args));
Martin Nagy 32aa83
+}
Martin Nagy 32aa83
+
Martin Nagy 32aa83
+void
Martin Nagy 32aa83
+dns_dyndb_set_view(dns_dyndb_arguments_t *args, dns_view_t *view)
Martin Nagy 32aa83
+{
Martin Nagy 32aa83
+	REQUIRE(args != NULL);
Martin Nagy 32aa83
+
Martin Nagy 32aa83
+	if (args->view != NULL)
Martin Nagy 32aa83
+		dns_view_detach(&args->view);
Martin Nagy 32aa83
+	if (view != NULL)
Martin Nagy 32aa83
+		dns_view_attach(view, &args->view);
Martin Nagy 32aa83
+}
Martin Nagy 32aa83
+
Martin Nagy 32aa83
+dns_view_t *
Martin Nagy 32aa83
+dns_dyndb_get_view(dns_dyndb_arguments_t *args)
Martin Nagy 32aa83
+{
Martin Nagy 32aa83
+	REQUIRE(args != NULL);
Martin Nagy 32aa83
+
Martin Nagy 32aa83
+	return args->view;
Martin Nagy 32aa83
+}
Martin Nagy 32aa83
+
Martin Nagy 32aa83
+void
Martin Nagy 32aa83
+dns_dyndb_set_zonemgr(dns_dyndb_arguments_t *args, dns_zonemgr_t *zmgr)
Martin Nagy 32aa83
+{
Martin Nagy 32aa83
+	REQUIRE(args != NULL);
Martin Nagy 32aa83
+
Martin Nagy 32aa83
+	if (args->zmgr != NULL)
Martin Nagy 32aa83
+		dns_zonemgr_detach(&args->zmgr);
Martin Nagy 32aa83
+	if (zmgr != NULL)
Martin Nagy 32aa83
+		dns_zonemgr_attach(zmgr, &args->zmgr);
Martin Nagy 32aa83
+}
Martin Nagy 32aa83
+
Martin Nagy 32aa83
+dns_zonemgr_t *
Martin Nagy 32aa83
+dns_dyndb_get_zonemgr(dns_dyndb_arguments_t *args)
Martin Nagy 32aa83
+{
Martin Nagy 32aa83
+	REQUIRE(args != NULL);
Martin Nagy 32aa83
+
Martin Nagy 32aa83
+	return args->zmgr;
Martin Nagy 32aa83
+}
Martin Nagy 32aa83
+
Martin Nagy 32aa83
+void
Martin Nagy 32aa83
+dns_dyndb_set_task(dns_dyndb_arguments_t *args, isc_task_t *task)
Martin Nagy 32aa83
+{
Martin Nagy 32aa83
+	REQUIRE(args != NULL);
Martin Nagy 32aa83
+
Martin Nagy 32aa83
+	if (args->task != NULL)
Martin Nagy 32aa83
+		isc_task_detach(&args->task);
Martin Nagy 32aa83
+	if (task != NULL)
Martin Nagy 32aa83
+		isc_task_attach(task, &args->task);
Martin Nagy 32aa83
+}
Martin Nagy 32aa83
+
Martin Nagy 32aa83
+isc_task_t *
Martin Nagy 32aa83
+dns_dyndb_get_task(dns_dyndb_arguments_t *args)
Martin Nagy 32aa83
+{
Martin Nagy 32aa83
+	REQUIRE(args != NULL);
Martin Nagy 32aa83
+
Martin Nagy 32aa83
+	return args->task;
Martin Nagy 32aa83
+}
Martin Nagy 32aa83
+
Martin Nagy 32aa83
+void
Martin Nagy 32aa83
+dns_dyndb_set_timermgr(dns_dyndb_arguments_t *args, isc_timermgr_t *timermgr)
Martin Nagy 32aa83
+{
Martin Nagy 32aa83
+	REQUIRE(args != NULL);
Martin Nagy 32aa83
+
Martin Nagy 32aa83
+	args->timermgr = timermgr;
Martin Nagy 32aa83
+}
Martin Nagy 32aa83
+
Martin Nagy 32aa83
+isc_timermgr_t *
Martin Nagy 32aa83
+dns_dyndb_get_timermgr(dns_dyndb_arguments_t *args)
Martin Nagy 32aa83
+{
Martin Nagy 32aa83
+	REQUIRE(args != NULL);
Martin Nagy 32aa83
+
Martin Nagy 32aa83
+	return args->timermgr;
Martin Nagy 32aa83
+}
Adam Tkac d6323c
diff -up bind-9.9.2/lib/dns/include/dns/dynamic_db.h.dyndb bind-9.9.2/lib/dns/include/dns/dynamic_db.h
Adam Tkac d6323c
--- bind-9.9.2/lib/dns/include/dns/dynamic_db.h.dyndb	2012-10-11 13:13:10.631497588 +0200
Adam Tkac d6323c
+++ bind-9.9.2/lib/dns/include/dns/dynamic_db.h	2012-10-11 13:13:10.631497588 +0200
Martin Nagy 32aa83
@@ -0,0 +1,50 @@
Martin Nagy b1c08c
+/*
Adam Tkac 95c9b3
+ * Copyright (C) 2008-2011  Red Hat, Inc.
Martin Nagy b1c08c
+ *
Martin Nagy b1c08c
+ * Permission to use, copy, modify, and/or distribute this software for any
Martin Nagy b1c08c
+ * purpose with or without fee is hereby granted, provided that the above
Martin Nagy b1c08c
+ * copyright notice and this permission notice appear in all copies.
Martin Nagy b1c08c
+ *
Martin Nagy 32aa83
+ * THE SOFTWARE IS PROVIDED "AS IS" AND Red Hat DISCLAIMS ALL WARRANTIES WITH
Martin Nagy b1c08c
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
Martin Nagy 32aa83
+ * AND FITNESS.  IN NO EVENT SHALL Red Hat BE LIABLE FOR ANY SPECIAL, DIRECT,
Martin Nagy b1c08c
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
Martin Nagy b1c08c
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
Martin Nagy b1c08c
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
Martin Nagy b1c08c
+ * PERFORMANCE OF THIS SOFTWARE.
Martin Nagy b1c08c
+ */
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+#ifndef DYNAMIC_DB_H
Martin Nagy b1c08c
+#define DYNAMIC_DB_H
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+#include <isc/types.h>
Martin Nagy 205f42
+
Martin Nagy b1c08c
+#include <dns/types.h>
Martin Nagy b1c08c
+
Martin Nagy 32aa83
+/*
Martin Nagy 32aa83
+ * TODO:
Martin Nagy 32aa83
+ * Reformat the prototypes.
Martin Nagy 32aa83
+ * Add annotated comments.
Martin Nagy 32aa83
+ */
Martin Nagy 32aa83
+
Martin Nagy b1c08c
+isc_result_t dns_dynamic_db_load(const char *libname, const char *name,
Martin Nagy b1c08c
+				 isc_mem_t *mctx, const char * const *argv,
Adam Tkac 95c9b3
+				 const dns_dyndb_arguments_t *dyndb_args);
Martin Nagy b1c08c
+
Martin Nagy 01aab7
+void dns_dynamic_db_cleanup(isc_boolean_t exiting);
Martin Nagy b1c08c
+
Martin Nagy 32aa83
+dns_dyndb_arguments_t *dns_dyndb_arguments_create(isc_mem_t *mctx);
Martin Nagy 32aa83
+void dns_dyndb_arguments_destroy(isc_mem_t *mctx, dns_dyndb_arguments_t *args);
Martin Nagy 32aa83
+
Martin Nagy 32aa83
+void dns_dyndb_set_view(dns_dyndb_arguments_t *args, dns_view_t *view);
Martin Nagy 32aa83
+dns_view_t *dns_dyndb_get_view(dns_dyndb_arguments_t *args);
Martin Nagy 32aa83
+void dns_dyndb_set_zonemgr(dns_dyndb_arguments_t *args, dns_zonemgr_t *zmgr);
Martin Nagy 32aa83
+dns_zonemgr_t *dns_dyndb_get_zonemgr(dns_dyndb_arguments_t *args);
Martin Nagy 32aa83
+void dns_dyndb_set_task(dns_dyndb_arguments_t *args, isc_task_t *task);
Martin Nagy 32aa83
+isc_task_t *dns_dyndb_get_task(dns_dyndb_arguments_t *args);
Martin Nagy 32aa83
+void dns_dyndb_set_timermgr(dns_dyndb_arguments_t *args,
Martin Nagy 32aa83
+			    isc_timermgr_t *timermgr);
Martin Nagy 32aa83
+isc_timermgr_t *dns_dyndb_get_timermgr(dns_dyndb_arguments_t *args);
Martin Nagy 32aa83
+
Martin Nagy b1c08c
+#endif
Adam Tkac d6323c
diff -up bind-9.9.2/lib/dns/include/dns/log.h.dyndb bind-9.9.2/lib/dns/include/dns/log.h
Adam Tkac d6323c
--- bind-9.9.2/lib/dns/include/dns/log.h.dyndb	2012-09-27 02:35:19.000000000 +0200
Adam Tkac d6323c
+++ bind-9.9.2/lib/dns/include/dns/log.h	2012-10-11 13:13:45.309399482 +0200
Adam Tkac d6323c
@@ -76,6 +76,7 @@ LIBDNS_EXTERNAL_DATA extern isc_logmodul
Martin Nagy b1c08c
 #define DNS_LOGMODULE_DLZ		(&dns_modules[26])
Adam Tkac 7f138a
 #define DNS_LOGMODULE_DNSSEC		(&dns_modules[27])
Adam Tkac d6323c
 #define DNS_LOGMODULE_CRYPTO		(&dns_modules[28])
Adam Tkac d6323c
+#define DNS_LOGMODULE_DYNDB		(&dns_modules[29])
Martin Nagy b1c08c
 
Martin Nagy b1c08c
 ISC_LANG_BEGINDECLS
Martin Nagy b1c08c
 
Adam Tkac d6323c
diff -up bind-9.9.2/lib/dns/include/dns/Makefile.in.dyndb bind-9.9.2/lib/dns/include/dns/Makefile.in
Adam Tkac d6323c
--- bind-9.9.2/lib/dns/include/dns/Makefile.in.dyndb	2012-09-27 02:35:19.000000000 +0200
Adam Tkac d6323c
+++ bind-9.9.2/lib/dns/include/dns/Makefile.in	2012-10-11 13:13:10.632497587 +0200
Adam Tkac 2fc1c6
@@ -22,7 +22,7 @@ top_srcdir =	@top_srcdir@
Adam Tkac 2fc1c6
 @BIND9_VERSION@
Adam Tkac f12e46
 
Adam Tkac 2fc1c6
 HEADERS =	acl.h adb.h byaddr.h cache.h callbacks.h cert.h compress.h \
Adam Tkac 8e3808
-		clientinfo.h db.h dbiterator.h dbtable.h diff.h dispatch.h \
Adam Tkac 8e3808
+		clientinfo.h db.h dbiterator.h dbtable.h diff.h dispatch.h dynamic_db.h \
Adam Tkac 8e3808
 		dlz.h dnssec.h ds.h events.h fixedname.h iptable.h journal.h \
Adam Tkac 2fc1c6
 		keyflags.h keytable.h keyvalues.h lib.h log.h \
Adam Tkac 2fc1c6
 		master.h masterdump.h message.h name.h ncache.h nsec.h \
Adam Tkac d6323c
diff -up bind-9.9.2/lib/dns/include/dns/types.h.dyndb bind-9.9.2/lib/dns/include/dns/types.h
Adam Tkac d6323c
--- bind-9.9.2/lib/dns/include/dns/types.h.dyndb	2012-09-27 02:35:19.000000000 +0200
Adam Tkac d6323c
+++ bind-9.9.2/lib/dns/include/dns/types.h	2012-10-11 13:13:10.632497587 +0200
Adam Tkac e99cc3
@@ -60,6 +60,7 @@ typedef struct dns_dbtable			dns_dbtable
Martin Nagy 32aa83
 typedef void					dns_dbversion_t;
Martin Nagy 32aa83
 typedef struct dns_dlzimplementation		dns_dlzimplementation_t;
Martin Nagy 32aa83
 typedef struct dns_dlzdb			dns_dlzdb_t;
Martin Nagy 32aa83
+typedef struct dns_dyndb_arguments		dns_dyndb_arguments_t;
Martin Nagy 32aa83
 typedef struct dns_sdlzimplementation		dns_sdlzimplementation_t;
Martin Nagy 32aa83
 typedef struct dns_decompress			dns_decompress_t;
Martin Nagy 32aa83
 typedef struct dns_dispatch			dns_dispatch_t;
Adam Tkac d6323c
diff -up bind-9.9.2/lib/dns/log.c.dyndb bind-9.9.2/lib/dns/log.c
Adam Tkac d6323c
--- bind-9.9.2/lib/dns/log.c.dyndb	2012-09-27 02:35:19.000000000 +0200
Adam Tkac d6323c
+++ bind-9.9.2/lib/dns/log.c	2012-10-11 13:15:15.085414483 +0200
Adam Tkac d6323c
@@ -82,6 +82,7 @@ LIBDNS_EXTERNAL_DATA isc_logmodule_t dns
Martin Nagy b1c08c
 	{ "dns/dlz",		0 },
Adam Tkac 7f138a
 	{ "dns/dnssec",		0 },
Adam Tkac d6323c
 	{ "dns/crypto",		0 },
Martin Nagy b1c08c
+	{ "dns/dynamic_db",	0 },
Martin Nagy b1c08c
 	{ NULL, 		0 }
Martin Nagy b1c08c
 };
Martin Nagy b1c08c
 
Adam Tkac d6323c
diff -up bind-9.9.2/lib/dns/Makefile.in.dyndb bind-9.9.2/lib/dns/Makefile.in
Adam Tkac d6323c
--- bind-9.9.2/lib/dns/Makefile.in.dyndb	2012-10-11 13:13:10.605497637 +0200
Adam Tkac d6323c
+++ bind-9.9.2/lib/dns/Makefile.in	2012-10-11 13:13:10.633497585 +0200
Adam Tkac d6323c
@@ -59,7 +59,7 @@ DNSOBJS =	acache.@O@ acl.@O@ adb.@O@ bya
Adam Tkac 961e87
 		cache.@O@ callbacks.@O@ clientinfo.@O@ compress.@O@ \
Adam Tkac f12e46
 		db.@O@ dbiterator.@O@ dbtable.@O@ diff.@O@ dispatch.@O@ \
Adam Tkac 5bc2b4
 		dlz.@O@ dns64.@O@ dnssec.@O@ ds.@O@ forward.@O@ iptable.@O@ \
Adam Tkac 5bc2b4
-		journal.@O@ keydata.@O@ keytable.@O@ \
Adam Tkac 5bc2b4
+		dynamic_db.@O@ journal.@O@ keydata.@O@ keytable.@O@ \
Adam Tkac 5bc2b4
 		lib.@O@ log.@O@ lookup.@O@ \
Adam Tkac f12e46
 		master.@O@ masterdump.@O@ message.@O@ \
Adam Tkac f12e46
 		name.@O@ ncache.@O@ nsec.@O@ nsec3.@O@ order.@O@ peer.@O@ \
Adam Tkac d6323c
@@ -88,7 +88,7 @@ DNSSRCS =	acache.c acl.c adb.c byaddr.c
Adam Tkac 961e87
 		cache.c callbacks.c clientinfo.c compress.c \
Adam Tkac f12e46
 		db.c dbiterator.c dbtable.c diff.c dispatch.c \
Adam Tkac 5bc2b4
 		dlz.c dns64.c dnssec.c ds.c forward.c iptable.c journal.c \
Adam Tkac 5bc2b4
-		keydata.c keytable.c lib.c log.c lookup.c \
Adam Tkac 5bc2b4
+		dynamic_db.c keydata.c keytable.c lib.c log.c lookup.c \
Adam Tkac f12e46
 		master.c masterdump.c message.c \
Adam Tkac f12e46
 		name.c ncache.c nsec.c nsec3.c order.c peer.c portlist.c \
Adam Tkac 5bc2b4
 		rbt.c rbtdb.c rbtdb64.c rcode.c rdata.c rdatalist.c \
Adam Tkac d6323c
@@ -119,6 +119,11 @@ version.@O@: version.c
Adam Tkac f12e46
 		-DLIBAGE=${LIBAGE} \
Adam Tkac f12e46
 		-c ${srcdir}/version.c
Adam Tkac f12e46
 
Adam Tkac f12e46
+dynamic_db.@O@: dynamic_db.c
Adam Tkac f12e46
+	${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} \
Adam Tkac f12e46
+	-DDYNDB_LIBDIR=\"@libdir@/bind/\" \
Adam Tkac f12e46
+	-c ${srcdir}/dynamic_db.c
Adam Tkac f12e46
+
Adam Tkac f12e46
 libdns.@SA@: ${OBJS}
Adam Tkac f12e46
 	${AR} ${ARFLAGS} $@ ${OBJS}
Adam Tkac f12e46
 	${RANLIB} $@
Adam Tkac d6323c
diff -up bind-9.9.2/lib/isccfg/namedconf.c.dyndb bind-9.9.2/lib/isccfg/namedconf.c
Adam Tkac d6323c
--- bind-9.9.2/lib/isccfg/namedconf.c.dyndb	2012-09-27 02:35:19.000000000 +0200
Adam Tkac d6323c
+++ bind-9.9.2/lib/isccfg/namedconf.c	2012-10-11 13:13:10.634497583 +0200
Adam Tkac 5bc2b4
@@ -89,6 +89,7 @@ static cfg_type_t cfg_type_controls;
Martin Nagy b1c08c
 static cfg_type_t cfg_type_controls_sockaddr;
Martin Nagy b1c08c
 static cfg_type_t cfg_type_destinationlist;
Martin Nagy b1c08c
 static cfg_type_t cfg_type_dialuptype;
Martin Nagy b1c08c
+static cfg_type_t cfg_type_dynamic_db;
Martin Nagy b1c08c
 static cfg_type_t cfg_type_ixfrdifftype;
Martin Nagy b1c08c
 static cfg_type_t cfg_type_key;
Martin Nagy b1c08c
 static cfg_type_t cfg_type_logfile;
Adam Tkac 961e87
@@ -871,6 +872,7 @@ namedconf_or_view_clauses[] = {
Martin Nagy b1c08c
 	{ "zone", &cfg_type_zone, CFG_CLAUSEFLAG_MULTI },
Martin Nagy b1c08c
 	/* only 1 DLZ per view allowed */
Martin Nagy b1c08c
 	{ "dlz", &cfg_type_dynamically_loadable_zones, 0 },
Martin Nagy b1c08c
+	{ "dynamic-db", &cfg_type_dynamic_db, CFG_CLAUSEFLAG_MULTI },
Martin Nagy b1c08c
 	{ "server", &cfg_type_server, CFG_CLAUSEFLAG_MULTI },
Adam Tkac f12e46
 	{ "trusted-keys", &cfg_type_dnsseckeys, CFG_CLAUSEFLAG_MULTI },
Adam Tkac e99cc3
 	{ "managed-keys", &cfg_type_managedkeys, CFG_CLAUSEFLAG_MULTI },
Adam Tkac d6323c
@@ -1983,6 +1985,40 @@ static cfg_type_t cfg_type_dialuptype =
Martin Nagy b1c08c
 	&cfg_rep_string, dialup_enums
Martin Nagy b1c08c
 };
Martin Nagy b1c08c
 
Martin Nagy b1c08c
+/*
Martin Nagy b1c08c
+ * Dynamic database clauses.
Martin Nagy b1c08c
+ */
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+static cfg_clausedef_t
Martin Nagy b1c08c
+dynamic_db_clauses[] = {
Martin Nagy b1c08c
+	{ "library", &cfg_type_qstring, 0 },
Martin Nagy b1c08c
+	{ "arg", &cfg_type_qstring, CFG_CLAUSEFLAG_MULTI },
Martin Nagy b1c08c
+	{ NULL, NULL, 0 }
Martin Nagy b1c08c
+};
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+static cfg_clausedef_t *
Martin Nagy b1c08c
+dynamic_db_clausesets[] = {
Martin Nagy b1c08c
+	dynamic_db_clauses,
Martin Nagy b1c08c
+	NULL
Martin Nagy b1c08c
+};
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+static cfg_type_t cfg_type_dynamic_db_opts = {
Martin Nagy b1c08c
+	"dynamically_loadable_zones_opts", cfg_parse_map,
Martin Nagy b1c08c
+	cfg_print_map, cfg_doc_map, &cfg_rep_map,
Martin Nagy b1c08c
+	dynamic_db_clausesets
Martin Nagy b1c08c
+};
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+static cfg_tuplefielddef_t dynamic_db_fields[] = {
Martin Nagy b1c08c
+	{ "name", &cfg_type_astring, 0 },
Martin Nagy b1c08c
+	{ "options", &cfg_type_dynamic_db_opts, 0 },
Martin Nagy b1c08c
+	{ NULL, NULL, 0 }
Martin Nagy b1c08c
+};
Martin Nagy b1c08c
+
Martin Nagy b1c08c
+static cfg_type_t cfg_type_dynamic_db = {
Martin Nagy b1c08c
+	"dynamic_db", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple,
Martin Nagy b1c08c
+	&cfg_rep_tuple, dynamic_db_fields
Martin Nagy b1c08c
+};
Martin Nagy b1c08c
+
Martin Nagy b1c08c
 static const char *notify_enums[] = { "explicit", "master-only", NULL };
Martin Nagy b1c08c
 static isc_result_t
Martin Nagy b1c08c
 parse_notify_type(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {