+3066. [func] The DLZ "dlopen" driver is now built by default,
+ no longer requiring a configure option. To
+ disable it, use "configure --without-dlopen".
+ (Note: driver not supported on win32.) [RT #23467]
+
3065. [bug] RRSIG could have time stamps too far in the future.
[RT #23356]
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.114 2010/12/22 09:00:40 marka Exp $
+# $Id: Makefile.in,v 1.114.14.1 2011/03/10 04:29:14 each Exp $
srcdir = @srcdir@
VPATH = @srcdir@
${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \
${DLZDRIVER_INCLUDES} ${DBDRIVER_INCLUDES} @DST_OPENSSL_INC@
-CDEFINES = @USE_DLZ@ @USE_PKCS11@ @USE_OPENSSL@
+CDEFINES = @CONTRIB_DLZ@ @USE_PKCS11@ @USE_OPENSSL@
CWARNINGS =
lwdgnba.@O@ lwdgrbn.@O@ lwdnoop.@O@ lwsearch.@O@ \
${DLZDRIVER_OBJS} ${DBDRIVER_OBJS}
-UOBJS = unix/os.@O@
+UOBJS = unix/os.@O@ unix/dlz_dlopen_driver.@O@
SYMOBJS = symtbl.@O@
--- /dev/null
+/*
+ * Copyright (C) 2010-2011 Internet Systems Consortium, Inc. ("ISC")
+ *
+ * Written by Andrew Tridgell
+ *
+ * based on dlz_stub_driver.h
+ * which is:
+ * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
+ * Copyright (C) 1999-2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
+ * conceived and contributed by Rob Butler.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef DLZ_DLOPEN_DRIVER_H
+#define DLZ_DLOPEN_DRIVER_H
+
+isc_result_t
+dlz_dlopen_init(isc_mem_t *mctx);
+
+void
+dlz_dlopen_clear(void);
+
+#define DLZ_DLOPEN_VERSION 1
+
+#endif
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: main.c,v 1.180 2010/12/22 03:59:02 marka Exp $ */
+/* $Id: main.c,v 1.180.14.1 2011/03/10 04:29:14 each Exp $ */
/*! \file */
#include <dst/result.h>
+#include <dlz/dlz_dlopen_driver.h>
+
/*
* Defining NS_MAIN provides storage declarations (rather than extern)
* for variables in named/globals.h.
*/
/* #include "xxdb.h" */
+#ifdef CONTRIB_DLZ
/*
- * Include DLZ drivers if appropriate.
+ * Include contributed DLZ drivers if appropriate.
*/
-#ifdef DLZ
#include <dlz/dlz_drivers.h>
#endif
*/
/* xxdb_init(); */
-#ifdef DLZ
+#ifdef ISC_DLZ_DLOPEN
+ /*
+ * Register the DLZ "dlopen" driver.
+ */
+ result = dlz_dlopen_init(ns_g_mctx);
+ if (result != ISC_R_SUCCESS)
+ ns_main_earlyfatal("dlz_dlopen_init() failed: %s",
+ isc_result_totext(result));
+#endif
+
+#if CONTRIB_DLZ
/*
- * Register any DLZ drivers.
+ * Register any other contributed DLZ drivers.
*/
result = dlz_drivers_init();
if (result != ISC_R_SUCCESS)
*/
/* xxdb_clear(); */
-#ifdef DLZ
+#ifdef CONTRIB_DLZ
/*
- * Unregister any DLZ drivers.
+ * Unregister contributed DLZ drivers.
*/
dlz_drivers_clear();
#endif
+#ifdef ISC_DLZ_DLOPEN
+ /*
+ * Unregister "dlopen" DLZ driver.
+ */
+ dlz_dlopen_clear();
+#endif
dns_name_destroy();
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: query.c,v 1.353.8.2 2011/02/18 15:27:58 smann Exp $ */
+/* $Id: query.c,v 1.353.8.3 2011/03/10 04:29:15 each Exp $ */
/*! \file */
#include <dns/adb.h>
#include <dns/byaddr.h>
#include <dns/db.h>
-#ifdef DLZ
#include <dns/dlz.h>
-#endif
#include <dns/dns64.h>
#include <dns/dnssec.h>
#include <dns/events.h>
{
isc_result_t result;
-#ifdef DLZ
isc_result_t tresult;
unsigned int namelabels;
unsigned int zonelabels;
result = tresult;
}
}
-#else
- result = query_getzonedb(client, name, qtype, options,
- zonep, dbp, versionp);
-#endif
/* If successful, Transfer ownership of zone. */
if (result == ISC_R_SUCCESS) {
-#ifdef DLZ
*zonep = zone;
-#endif
/*
* If neither attempt above succeeded, return the cache instead
*/
if (event == NULL && client->query.restarts == 0) {
if (is_zone) {
-#ifdef DLZ
if (zone != NULL) {
/*
* if is_zone = true, zone = NULL then this is
* a DLZ zone. Don't attempt to attach zone.
*/
-#endif
dns_zone_attach(zone, &client->query.authzone);
-#ifdef DLZ
}
-#endif
dns_db_attach(db, &client->query.authdb);
}
client->query.authdbset = ISC_TRUE;
* resolver and not have it cached.
*/
if (qtype == dns_rdatatype_soa &&
-#ifdef DLZ
zone != NULL &&
-#endif
dns_zone_getzeronosoattl(zone))
result = query_addsoa(client, db, version, 0,
dns_rdataset_isassociated(rdataset));
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: server.c,v 1.599.8.6 2011/03/03 16:18:12 each Exp $ */
+/* $Id: server.c,v 1.599.8.7 2011/03/10 04:29:15 each Exp $ */
/*! \file */
#include <dns/cache.h>
#include <dns/db.h>
#include <dns/dispatch.h>
-#ifdef DLZ
#include <dns/dlz.h>
-#endif
#include <dns/dns64.h>
#include <dns/forward.h>
#include <dns/journal.h>
return (ISC_TRUE);
}
-#ifdef DLZ
/*
* Callback from DLZ configure when the driver sets up a writeable zone
*/
return ns_zone_configure_writeable_dlz(view->dlzdatabase,
zone, zclass, origin);
}
-#endif
static isc_result_t
dns64_reverse(dns_view_t *view, isc_mem_t *mctx, isc_netaddr_t *na,
const cfg_obj_t *forwarders;
const cfg_obj_t *alternates;
const cfg_obj_t *zonelist;
-#ifdef DLZ
const cfg_obj_t *dlz;
unsigned int dlzargc;
char **dlzargv;
-#endif
const cfg_obj_t *disabled;
const cfg_obj_t *obj;
const cfg_listelt_t *element;
}
}
-#ifdef DLZ
/*
* Create Dynamically Loadable Zone driver.
*/
goto cleanup;
}
}
-#endif
/*
* Obtain configuration parameters that affect the decision of whether
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.13 2009/12/05 23:31:40 each Exp $
+# $Id: Makefile.in,v 1.13.244.1 2011/03/10 04:29:15 each Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@BIND9_MAKE_INCLUDES@
CINCLUDES = -I${srcdir}/include -I${srcdir}/../include \
+ ${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} \
${DNS_INCLUDES} ${ISC_INCLUDES}
CDEFINES =
CWARNINGS =
-OBJS = os.@O@
+OBJS = os.@O@ dlz_dlopen_driver.@O@
-SRCS = os.c
+SRCS = os.c dlz_dlopen_driver.c
TARGETS = ${OBJS}
--- /dev/null
+/*
+ * Copyright (C) 2010,2011 Internet Systems Consortium, Inc. ("ISC")
+ *
+ * Written by Andrew Tridgell
+ *
+ * based on dlz_stub_driver.c
+ * which is:
+ * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
+ * Copyright (C) 1999-2001 Internet Software Consortium.
+ * see dlz_stub_driver.c for details
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
+ * conceived and contributed by Rob Butler.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <dlfcn.h>
+
+#include <dns/log.h>
+#include <dns/sdlz.h>
+#include <dns/result.h>
+
+#include <isc/mem.h>
+#include <isc/print.h>
+#include <isc/result.h>
+#include <isc/util.h>
+
+#include <named/globals.h>
+
+#include <dlz/dlz_dlopen_driver.h>
+
+#ifdef ISC_DLZ_DLOPEN
+static dns_sdlzimplementation_t *dlz_dlopen = NULL;
+
+
+typedef struct dlopen_data {
+ isc_mem_t *mctx;
+ char *dl_path;
+ char *dlzname;
+ void *dl_handle;
+ void *dbdata;
+ unsigned int flags;
+ isc_mutex_t lock;
+ int version;
+ isc_boolean_t in_configure;
+
+ int (*dlz_version)(unsigned int *flags);
+ isc_result_t (*dlz_create)(const char *dlzname,
+ unsigned int argc, char *argv[],
+ void **dbdata, ...);
+ isc_result_t (*dlz_findzonedb)(void *dbdata, const char *name);
+ isc_result_t (*dlz_lookup)(const char *zone, const char *name,
+ void *dbdata, dns_sdlzlookup_t *lookup);
+ isc_result_t (*dlz_authority)(const char *zone, void *dbdata,
+ dns_sdlzlookup_t *lookup);
+ isc_result_t (*dlz_allnodes)(const char *zone, void *dbdata,
+ dns_sdlzallnodes_t *allnodes);
+ isc_result_t (*dlz_allowzonexfr)(void *dbdata, const char *name,
+ const char *client);
+ isc_result_t (*dlz_newversion)(const char *zone, void *dbdata,
+ void **versionp);
+ void (*dlz_closeversion)(const char *zone, isc_boolean_t commit,
+ void *dbdata, void **versionp);
+ isc_result_t (*dlz_configure)(dns_view_t *view, void *dbdata);
+ isc_boolean_t (*dlz_ssumatch)(const char *signer, const char *name,
+ const char *tcpaddr, const char *type,
+ const char *key, isc_uint32_t keydatalen,
+ unsigned char *keydata, void *dbdata);
+ isc_result_t (*dlz_addrdataset)(const char *name, const char *rdatastr,
+ void *dbdata, void *version);
+ isc_result_t (*dlz_subrdataset)(const char *name, const char *rdatastr,
+ void *dbdata, void *version);
+ isc_result_t (*dlz_delrdataset)(const char *name, const char *type,
+ void *dbdata, void *version);
+ void (*dlz_destroy)(void *dbdata);
+} dlopen_data_t;
+
+/* Modules can choose whether they are lock-safe or not. */
+#define MAYBE_LOCK(cd) \
+ do { \
+ if ((cd->flags & DNS_SDLZFLAG_THREADSAFE) == 0 && \
+ cd->in_configure == ISC_FALSE) \
+ LOCK(&cd->lock); \
+ } while (0)
+
+#define MAYBE_UNLOCK(cd) \
+ do { \
+ if ((cd->flags & DNS_SDLZFLAG_THREADSAFE) == 0 && \
+ cd->in_configure == ISC_FALSE) \
+ UNLOCK(&cd->lock); \
+ } while (0)
+
+/*
+ * Log a message at the given level.
+ */
+static void dlopen_log(int level, const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ isc_log_vwrite(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(level),
+ fmt, ap);
+ va_end(ap);
+}
+
+/*
+ * SDLZ methods
+ */
+
+static isc_result_t
+dlopen_dlz_allnodes(const char *zone, void *driverarg, void *dbdata,
+ dns_sdlzallnodes_t *allnodes)
+{
+ dlopen_data_t *cd = (dlopen_data_t *) dbdata;
+ isc_result_t result;
+
+
+ UNUSED(driverarg);
+
+ if (cd->dlz_allnodes == NULL) {
+ return (ISC_R_NOPERM);
+ }
+
+ MAYBE_LOCK(cd);
+ result = cd->dlz_allnodes(zone, cd->dbdata, allnodes);
+ MAYBE_UNLOCK(cd);
+ return (result);
+}
+
+
+static isc_result_t
+dlopen_dlz_allowzonexfr(void *driverarg, void *dbdata, const char *name,
+ const char *client)
+{
+ dlopen_data_t *cd = (dlopen_data_t *) dbdata;
+ isc_result_t result;
+
+ UNUSED(driverarg);
+
+
+ if (cd->dlz_allowzonexfr == NULL) {
+ return (ISC_R_NOPERM);
+ }
+
+ MAYBE_LOCK(cd);
+ result = cd->dlz_allowzonexfr(cd->dbdata, name, client);
+ MAYBE_UNLOCK(cd);
+ return (result);
+}
+
+static isc_result_t
+dlopen_dlz_authority(const char *zone, void *driverarg, void *dbdata,
+ dns_sdlzlookup_t *lookup)
+{
+ dlopen_data_t *cd = (dlopen_data_t *) dbdata;
+ isc_result_t result;
+
+ UNUSED(driverarg);
+
+ if (cd->dlz_authority == NULL) {
+ return (ISC_R_NOTIMPLEMENTED);
+ }
+
+ MAYBE_LOCK(cd);
+ result = cd->dlz_authority(zone, cd->dbdata, lookup);
+ MAYBE_UNLOCK(cd);
+ return (result);
+}
+
+static isc_result_t
+dlopen_dlz_findzonedb(void *driverarg, void *dbdata, const char *name)
+{
+ dlopen_data_t *cd = (dlopen_data_t *) dbdata;
+ isc_result_t result;
+
+ UNUSED(driverarg);
+
+ MAYBE_LOCK(cd);
+ result = cd->dlz_findzonedb(cd->dbdata, name);
+ MAYBE_UNLOCK(cd);
+ return (result);
+}
+
+
+static isc_result_t
+dlopen_dlz_lookup(const char *zone, const char *name, void *driverarg,
+ void *dbdata, dns_sdlzlookup_t *lookup)
+{
+ dlopen_data_t *cd = (dlopen_data_t *) dbdata;
+ isc_result_t result;
+
+ UNUSED(driverarg);
+
+ MAYBE_LOCK(cd);
+ result = cd->dlz_lookup(zone, name, cd->dbdata, lookup);
+ MAYBE_UNLOCK(cd);
+ return (result);
+}
+
+/*
+ * Load a symbol from the library
+ */
+static void *
+dl_load_symbol(dlopen_data_t *cd, const char *symbol, isc_boolean_t mandatory) {
+ void *ptr = dlsym(cd->dl_handle, symbol);
+ if (ptr == NULL && mandatory) {
+ dlopen_log(ISC_LOG_ERROR,
+ "dlz_dlopen: library '%s' is missing "
+ "required symbol '%s'", cd->dl_path, symbol);
+ }
+ return (ptr);
+}
+
+/*
+ * Called at startup for each dlopen zone in named.conf
+ */
+static isc_result_t
+dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
+ void *driverarg, void **dbdata)
+{
+ dlopen_data_t *cd;
+ isc_mem_t *mctx = NULL;
+ isc_result_t result = ISC_R_FAILURE;
+ int dlopen_flags = 0;
+
+ UNUSED(driverarg);
+
+ if (argc < 2) {
+ dlopen_log(ISC_LOG_ERROR,
+ "dlz_dlopen driver for '%s' needs a path to "
+ "the shared library", dlzname);
+ return (ISC_R_FAILURE);
+ }
+
+ isc_mem_create(0, 0, &mctx);
+
+ cd = isc_mem_get(mctx, sizeof(*cd));
+ if (cd == NULL) {
+ isc_mem_destroy(&mctx);
+ return (ISC_R_NOMEMORY);
+ }
+ memset(cd, 0, sizeof(*cd));
+
+ cd->mctx = mctx;
+
+ cd->dl_path = isc_mem_strdup(cd->mctx, argv[1]);
+ if (cd->dl_path == NULL) {
+ goto failed;
+ }
+
+ cd->dlzname = isc_mem_strdup(cd->mctx, dlzname);
+ if (cd->dlzname == NULL) {
+ goto failed;
+ }
+
+ /* Initialize the lock */
+ isc_mutex_init(&cd->lock);
+
+ /* Open the library */
+ dlopen_flags = RTLD_NOW;
+
+#ifdef RTLD_DEEPBIND
+ /*
+ * If RTLD_DEEPBIND is available then use it. This can avoid
+ * issues with a module using a different version of a system
+ * library than one that bind9 uses. For example, bind9 may link
+ * to MIT kerberos, but the module may use Heimdal. If we don't
+ * use RTLD_DEEPBIND then we could end up with Heimdal functions
+ * calling MIT functions, which leads to bizarre results (usually
+ * a segfault).
+ */
+ dlopen_flags |= RTLD_DEEPBIND;
+#endif
+
+ cd->dl_handle = dlopen(cd->dl_path, dlopen_flags);
+ if (cd->dl_handle == NULL) {
+ dlopen_log(ISC_LOG_ERROR,
+ "dlz_dlopen failed to open library '%s' - %s",
+ cd->dl_path, dlerror());
+ goto failed;
+ }
+
+ /* Find the symbols */
+ cd->dlz_version = dl_load_symbol(cd, "dlz_version", ISC_TRUE);
+ cd->dlz_create = dl_load_symbol(cd, "dlz_create", ISC_TRUE);
+ cd->dlz_lookup = dl_load_symbol(cd, "dlz_lookup", ISC_TRUE);
+ cd->dlz_findzonedb = dl_load_symbol(cd, "dlz_findzonedb", ISC_TRUE);
+
+ if (cd->dlz_create == NULL ||
+ cd->dlz_lookup == NULL ||
+ cd->dlz_findzonedb == NULL)
+ {
+ /* We're missing a required symbol */
+ goto failed;
+ }
+
+ cd->dlz_allowzonexfr = dl_load_symbol(cd, "dlz_allowzonexfr",
+ ISC_FALSE);
+ cd->dlz_allnodes = dl_load_symbol(cd, "dlz_allnodes",
+ ISC_TF(cd->dlz_allowzonexfr != NULL));
+ cd->dlz_authority = dl_load_symbol(cd, "dlz_authority", ISC_FALSE);
+ cd->dlz_newversion = dl_load_symbol(cd, "dlz_newversion", ISC_FALSE);
+ cd->dlz_closeversion = dl_load_symbol(cd, "dlz_closeversion",
+ ISC_TF(cd->dlz_newversion != NULL));
+ cd->dlz_configure = dl_load_symbol(cd, "dlz_configure", ISC_FALSE);
+ cd->dlz_ssumatch = dl_load_symbol(cd, "dlz_ssumatch", ISC_FALSE);
+ cd->dlz_addrdataset = dl_load_symbol(cd, "dlz_addrdataset", ISC_FALSE);
+ cd->dlz_subrdataset = dl_load_symbol(cd, "dlz_subrdataset", ISC_FALSE);
+ cd->dlz_delrdataset = dl_load_symbol(cd, "dlz_delrdataset", ISC_FALSE);
+
+ /* Check the version of the API is the same */
+ cd->version = cd->dlz_version(&cd->flags);
+ if (cd->version != DLZ_DLOPEN_VERSION) {
+ dlopen_log(ISC_LOG_ERROR,
+ "dlz_dlopen: incorrect version %d "
+ "should be %d in '%s'",
+ cd->version, DLZ_DLOPEN_VERSION, cd->dl_path);
+ goto failed;
+ }
+
+ /*
+ * Call the library's create function. Note that this is an
+ * extended version of dlz create, with the addition of
+ * named function pointers for helper functions that the
+ * driver will need. This avoids the need for the backend to
+ * link the BIND9 libraries
+ */
+ MAYBE_LOCK(cd);
+ result = cd->dlz_create(dlzname, argc-1, argv+1,
+ &cd->dbdata,
+ "log", dlopen_log,
+ "putrr", dns_sdlz_putrr,
+ "putnamedrr", dns_sdlz_putnamedrr,
+ "writeable_zone", dns_dlz_writeablezone,
+ NULL);
+ MAYBE_UNLOCK(cd);
+ if (result != ISC_R_SUCCESS)
+ goto failed;
+
+ *dbdata = cd;
+
+ return (ISC_R_SUCCESS);
+
+failed:
+ dlopen_log(ISC_LOG_ERROR, "dlz_dlopen of '%s' failed", dlzname);
+ if (cd->dl_path)
+ isc_mem_free(mctx, cd->dl_path);
+ if (cd->dlzname)
+ isc_mem_free(mctx, cd->dlzname);
+ if (dlopen_flags)
+ isc_mutex_destroy(&cd->lock);
+#ifdef HAVE_DLCLOSE
+ if (cd->dl_handle)
+ dlclose(cd->dl_handle);
+#endif
+ isc_mem_put(mctx, cd, sizeof(*cd));
+ isc_mem_destroy(&mctx);
+ return (result);
+}
+
+
+/*
+ * Called when bind is shutting down
+ */
+static void
+dlopen_dlz_destroy(void *driverarg, void *dbdata) {
+ dlopen_data_t *cd = (dlopen_data_t *) dbdata;
+ isc_mem_t *mctx;
+
+ UNUSED(driverarg);
+
+ if (cd->dlz_destroy) {
+ MAYBE_LOCK(cd);
+ cd->dlz_destroy(cd->dbdata);
+ MAYBE_UNLOCK(cd);
+ }
+
+ if (cd->dl_path)
+ isc_mem_free(cd->mctx, cd->dl_path);
+ if (cd->dlzname)
+ isc_mem_free(cd->mctx, cd->dlzname);
+
+#ifdef HAVE_DLCLOSE
+ if (cd->dl_handle)
+ dlclose(cd->dl_handle);
+#endif
+
+ isc_mutex_destroy(&cd->lock);
+
+ mctx = cd->mctx;
+ isc_mem_put(mctx, cd, sizeof(*cd));
+ isc_mem_destroy(&mctx);
+}
+
+/*
+ * Called to start a transaction
+ */
+static isc_result_t
+dlopen_dlz_newversion(const char *zone, void *driverarg, void *dbdata,
+ void **versionp)
+{
+ dlopen_data_t *cd = (dlopen_data_t *) dbdata;
+ isc_result_t result;
+
+ UNUSED(driverarg);
+
+ if (cd->dlz_newversion == NULL)
+ return (ISC_R_NOTIMPLEMENTED);
+
+ MAYBE_LOCK(cd);
+ result = cd->dlz_newversion(zone, cd->dbdata, versionp);
+ MAYBE_UNLOCK(cd);
+ return (result);
+}
+
+/*
+ * Called to end a transaction
+ */
+static void
+dlopen_dlz_closeversion(const char *zone, isc_boolean_t commit,
+ void *driverarg, void *dbdata, void **versionp)
+{
+ dlopen_data_t *cd = (dlopen_data_t *) dbdata;
+
+ UNUSED(driverarg);
+
+ if (cd->dlz_newversion == NULL) {
+ *versionp = NULL;
+ return;
+ }
+
+ MAYBE_LOCK(cd);
+ cd->dlz_closeversion(zone, commit, cd->dbdata, versionp);
+ MAYBE_UNLOCK(cd);
+}
+
+/*
+ * Called on startup to configure any writeable zones
+ */
+static isc_result_t
+dlopen_dlz_configure(dns_view_t *view, void *driverarg, void *dbdata) {
+ dlopen_data_t *cd = (dlopen_data_t *) dbdata;
+ isc_result_t result;
+
+ UNUSED(driverarg);
+
+ if (cd->dlz_configure == NULL)
+ return (ISC_R_SUCCESS);
+
+ MAYBE_LOCK(cd);
+ cd->in_configure = ISC_TRUE;
+ result = cd->dlz_configure(view, cd->dbdata);
+ cd->in_configure = ISC_FALSE;
+ MAYBE_UNLOCK(cd);
+
+ return (result);
+}
+
+
+/*
+ * Check for authority to change a name
+ */
+static isc_boolean_t
+dlopen_dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
+ const char *type, const char *key, isc_uint32_t keydatalen,
+ unsigned char *keydata, void *driverarg, void *dbdata)
+{
+ dlopen_data_t *cd = (dlopen_data_t *) dbdata;
+ isc_boolean_t ret;
+
+ UNUSED(driverarg);
+
+ if (cd->dlz_ssumatch == NULL)
+ return (ISC_FALSE);
+
+ MAYBE_LOCK(cd);
+ ret = cd->dlz_ssumatch(signer, name, tcpaddr, type, key, keydatalen,
+ keydata, cd->dbdata);
+ MAYBE_UNLOCK(cd);
+
+ return (ret);
+}
+
+
+/*
+ * Add an rdataset
+ */
+static isc_result_t
+dlopen_dlz_addrdataset(const char *name, const char *rdatastr,
+ void *driverarg, void *dbdata, void *version)
+{
+ dlopen_data_t *cd = (dlopen_data_t *) dbdata;
+ isc_result_t result;
+
+ UNUSED(driverarg);
+
+ if (cd->dlz_addrdataset == NULL)
+ return (ISC_R_NOTIMPLEMENTED);
+
+ MAYBE_LOCK(cd);
+ result = cd->dlz_addrdataset(name, rdatastr, cd->dbdata, version);
+ MAYBE_UNLOCK(cd);
+
+ return (result);
+}
+
+/*
+ * Subtract an rdataset
+ */
+static isc_result_t
+dlopen_dlz_subrdataset(const char *name, const char *rdatastr,
+ void *driverarg, void *dbdata, void *version)
+{
+ dlopen_data_t *cd = (dlopen_data_t *) dbdata;
+ isc_result_t result;
+
+ UNUSED(driverarg);
+
+ if (cd->dlz_subrdataset == NULL)
+ return (ISC_R_NOTIMPLEMENTED);
+
+ MAYBE_LOCK(cd);
+ result = cd->dlz_subrdataset(name, rdatastr, cd->dbdata, version);
+ MAYBE_UNLOCK(cd);
+
+ return (result);
+}
+
+/*
+ delete a rdataset
+ */
+static isc_result_t
+dlopen_dlz_delrdataset(const char *name, const char *type,
+ void *driverarg, void *dbdata, void *version)
+{
+ dlopen_data_t *cd = (dlopen_data_t *) dbdata;
+ isc_result_t result;
+
+ UNUSED(driverarg);
+
+ if (cd->dlz_delrdataset == NULL)
+ return (ISC_R_NOTIMPLEMENTED);
+
+ MAYBE_LOCK(cd);
+ result = cd->dlz_delrdataset(name, type, cd->dbdata, version);
+ MAYBE_UNLOCK(cd);
+
+ return (result);
+}
+
+
+static dns_sdlzmethods_t dlz_dlopen_methods = {
+ dlopen_dlz_create,
+ dlopen_dlz_destroy,
+ dlopen_dlz_findzonedb,
+ dlopen_dlz_lookup,
+ dlopen_dlz_authority,
+ dlopen_dlz_allnodes,
+ dlopen_dlz_allowzonexfr,
+ dlopen_dlz_newversion,
+ dlopen_dlz_closeversion,
+ dlopen_dlz_configure,
+ dlopen_dlz_ssumatch,
+ dlopen_dlz_addrdataset,
+ dlopen_dlz_subrdataset,
+ dlopen_dlz_delrdataset
+};
+#endif
+
+/*
+ * Register driver with BIND
+ */
+isc_result_t
+dlz_dlopen_init(isc_mem_t *mctx) {
+#ifndef ISC_DLZ_DLOPEN
+ UNUSED(mctx);
+ return (ISC_R_NOTIMPLEMENTED);
+#else
+ isc_result_t result;
+
+ dlopen_log(2, "Registering DLZ_dlopen driver");
+
+ result = dns_sdlzregister("dlopen", &dlz_dlopen_methods, NULL,
+ DNS_SDLZFLAG_RELATIVEOWNER |
+ DNS_SDLZFLAG_THREADSAFE,
+ mctx, &dlz_dlopen);
+
+ if (result != ISC_R_SUCCESS) {
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "dns_sdlzregister() failed: %s",
+ isc_result_totext(result));
+ result = ISC_R_UNEXPECTED;
+ }
+
+ return (result);
+#endif
+}
+
+
+/*
+ * Unregister the driver
+ */
+void
+dlz_dlopen_clear(void) {
+#ifdef ISC_DLZ_DLOPEN
+ dlopen_log(2, "Unregistering DLZ_dlopen driver");
+ if (dlz_dlopen != NULL)
+ dns_sdlzunregister(&dlz_dlopen);
+#endif
+}
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: xfrout.c,v 1.139 2010/12/18 01:56:19 each Exp $ */
+/* $Id: xfrout.c,v 1.139.16.1 2011/03/10 04:29:15 each Exp $ */
#include <config.h>
#include <dns/db.h>
#include <dns/dbiterator.h>
-#ifdef DLZ
#include <dns/dlz.h>
-#endif
#include <dns/fixedname.h>
#include <dns/journal.h>
#include <dns/message.h>
char msg[NS_CLIENT_ACLMSGSIZE("zone transfer")];
char keyname[DNS_NAME_FORMATSIZE];
isc_boolean_t is_poll = ISC_FALSE;
-#ifdef DLZ
isc_boolean_t is_dlz = ISC_FALSE;
-#endif
switch (reqtype) {
case dns_rdatatype_axfr:
result = dns_zt_find(client->view->zonetable, question_name, 0, NULL,
&zone);
- if (result != ISC_R_SUCCESS)
-#ifdef DLZ
- {
+ if (result != ISC_R_SUCCESS) {
/*
* Normal zone table does not have a match.
* Try the DLZ database
goto failure;
}
if (result != ISC_R_SUCCESS)
-#endif
- FAILQ(DNS_R_NOTAUTH, "non-authoritative zone",
- question_name, question_class);
-#ifdef DLZ
+ FAILQ(DNS_R_NOTAUTH, "non-authoritative zone",
+ question_name, question_class);
is_dlz = ISC_TRUE;
/*
* DLZ only support full zone transfer, not incremental
}
} else {
/* zone table has a match */
-#endif
switch(dns_zone_gettype(zone)) {
case dns_zone_master:
case dns_zone_slave:
}
CHECK(dns_zone_getdb(zone, &db));
dns_db_currentversion(db, &ver);
-#ifdef DLZ
}
-#endif
xfrout_log1(client, question_name, question_class, ISC_LOG_DEBUG(6),
"%s question section OK", mnemonic);
"%s authority section OK", mnemonic);
/*
- * Decide whether to allow this transfer.
- */
-#ifdef DLZ
- /*
- * if not a DLZ zone decide whether to allow this transfer.
+ * If not a DLZ zone, decide whether to allow this transfer.
*/
if (!is_dlz) {
-#endif
ns_client_aclmsg("zone transfer", question_name, reqtype,
client->view->rdclass, msg, sizeof(msg));
CHECK(ns_client_checkacl(client, NULL, msg,
dns_zone_getxfracl(zone),
ISC_TRUE, ISC_LOG_ERROR));
-#ifdef DLZ
}
-#endif
/*
* AXFR over UDP is not possible.
/*
* Get a dynamically allocated copy of the current SOA.
*/
-#ifdef DLZ
if (is_dlz)
dns_db_currentversion(db, &ver);
-#endif
+
CHECK(dns_db_createsoatuple(db, ver, mctx, DNS_DIFFOP_EXISTS,
¤t_soa_tuple));
-#ifdef DLZ
if (is_dlz)
CHECK(xfrout_ctx_create(mctx, client, request->id,
question_name, reqtype, question_class,
ISC_TRUE : ISC_FALSE,
&xfr));
else
-#endif
CHECK(xfrout_ctx_create(mctx, client, request->id,
question_name, reqtype, question_class,
zone, db, ver, quota, stream,
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: zoneconf.c,v 1.170 2011/01/06 23:47:00 tbox Exp $ */
+/* $Id: zoneconf.c,v 1.170.14.1 2011/03/10 04:29:15 each Exp $ */
/*% */
}
-#ifdef DLZ
/*
* Set up a DLZ zone as writeable
*/
dns_db_detach(&db);
return result;
}
-#endif
isc_boolean_t
ns_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig) {
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.35 2011/01/13 04:59:24 tbox Exp $
+# $Id: Makefile.in,v 1.35.8.1 2011/03/10 04:29:16 each Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@BIND9_MAKE_INCLUDES@
-SUBDIRS = filter-aaaa lwresd rpz tkey
+SUBDIRS = dlzexternal filter-aaaa lwresd rpz tkey
TARGETS =
@BIND9_MAKE_RULES@
--- /dev/null
+# Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
+#
+# 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.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+
+# $Id: Makefile.in,v 1.1.4.2 2011/03/10 04:29:16 each Exp $
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+top_srcdir = @top_srcdir@
+
+@BIND9_VERSION@
+
+@BIND9_MAKE_INCLUDES@
+
+CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES}
+CDEFINES =
+CWARNINGS =
+
+LIBS = @LIBS@
+
+SO_TARGETS = driver.@SO@
+TARGETS = dlopen@EXEEXT@ @SO_TARGETS@
+
+SRCS = dlopen.c driver.c
+
+DLOPENOBJS = dlopen.@O@
+
+SO_OBJS = driver.@O@
+SO_SRCS = driver.c
+
+OBJS = ${DLOPENOBJS}
+
+@BIND9_MAKE_RULES@
+
+CFLAGS = @CFLAGS@ @SO_CFLAGS@
+
+dlopen@EXEEXT@: ${DLOPENOBJS}
+ ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} \
+ -o $@ ${DLOPENOBJS} ${LIBS}
+
+driver.@SO@: ${SO_OBJS}
+ @SO_LD@ -o $@ ${SO_OBJS}
+
+clean distclean::
+ rm -f ${TARGETS}
+
+distclean::
+ rm -f ns1/named.conf
--- /dev/null
+/*
+ * Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
+ *
+ * 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.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: dlopen.c,v 1.1.4.2 2011/03/10 04:29:16 each Exp $ */
+
+#include <config.h>
+
+int
+main() {
+#if defined(HAVE_DLOPEN) && defined(ISC_DLZ_DLOPEN)
+ return (0);
+#else
+ return (1);
+#endif
+}
--- /dev/null
+/*
+ * Copyright (C) 2010 Andrew Tridgell
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * This provides a very simple example of an external loadable DLZ
+ * driver, with update support.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+
+#include <isc/log.h>
+#include <isc/result.h>
+#include <isc/types.h>
+#include <isc/util.h>
+
+#include <dns/types.h>
+
+#include "driver.h"
+
+#ifdef WIN32
+#define strtok_r(a, b, c) strtok_s(a, b, c)
+#endif
+
+/* For this simple example, use fixed sized strings */
+struct record {
+ char name[100];
+ char type[10];
+ char data[200];
+ dns_ttl_t ttl;
+};
+
+#define MAX_RECORDS 100
+
+struct dlz_example_data {
+ char *zone_name;
+
+ /* An example driver doesn't need good memory management :-) */
+ struct record current[MAX_RECORDS];
+ struct record adds[MAX_RECORDS];
+ struct record deletes[MAX_RECORDS];
+
+ isc_boolean_t transaction_started;
+
+ /* Helper functions from the dlz_dlopen driver */
+ void (*log)(int level, const char *fmt, ...);
+ isc_result_t (*putrr)(dns_sdlzlookup_t *handle, const char *type,
+ dns_ttl_t ttl, const char *data);
+ isc_result_t (*putnamedrr)(dns_sdlzlookup_t *handle, const char *name,
+ const char *type, dns_ttl_t ttl,
+ const char *data);
+ isc_result_t (*writeable_zone)(dns_view_t *view, const char *zone_name);
+};
+
+static isc_boolean_t
+single_valued(const char *type) {
+ const char *single[] = { "soa", "cname", NULL };
+ int i;
+
+ for (i = 0; single[i]; i++) {
+ if (strcasecmp(single[i], type) == 0) {
+ return (ISC_TRUE);
+ }
+ }
+ return (ISC_FALSE);
+}
+
+/*
+ * Add a record to a list
+ */
+static isc_result_t
+add_name(struct dlz_example_data *state, struct record *list,
+ const char *name, const char *type, dns_ttl_t ttl, const char *data)
+{
+ int i;
+ isc_boolean_t single = single_valued(type);
+ int first_empty = -1;
+
+ for (i = 0; i < MAX_RECORDS; i++) {
+ if (first_empty == -1 && strlen(list[i].name) == 0) {
+ first_empty = i;
+ }
+ if (strcasecmp(list[i].name, name) != 0)
+ continue;
+ if (strcasecmp(list[i].type, type) != 0)
+ continue;
+ if (!single && strcasecmp(list[i].data, data) != 0)
+ continue;
+ break;
+ }
+ if (i == MAX_RECORDS && first_empty != -1) {
+ i = first_empty;
+ }
+ if (i == MAX_RECORDS) {
+ state->log(ISC_LOG_ERROR, "dlz_example: out of record space");
+ return (ISC_R_FAILURE);
+ }
+ strcpy(list[i].name, name);
+ strcpy(list[i].type, type);
+ strcpy(list[i].data, data);
+ list[i].ttl = ttl;
+ return (ISC_R_SUCCESS);
+}
+
+/*
+ * Delete a record from a list
+ */
+static isc_result_t
+del_name(struct dlz_example_data *state, struct record *list,
+ const char *name, const char *type, dns_ttl_t ttl,
+ const char *data)
+{
+ int i;
+
+ UNUSED(state);
+
+ for (i = 0; i < MAX_RECORDS; i++) {
+ if (strcasecmp(name, list[i].name) == 0 &&
+ strcasecmp(type, list[i].type) == 0 &&
+ strcasecmp(data, list[i].data) == 0 &&
+ ttl == list[i].ttl) {
+ break;
+ }
+ }
+ if (i == MAX_RECORDS) {
+ return (ISC_R_NOTFOUND);
+ }
+ memset(&list[i], 0, sizeof(struct record));
+ return (ISC_R_SUCCESS);
+}
+
+
+
+/*
+ * Return the version of the API
+ */
+int
+dlz_version(unsigned int *flags) {
+ UNUSED(flags);
+ return (DLZ_DLOPEN_VERSION);
+}
+
+/*
+ * Remember a helper function from the bind9 dlz_dlopen driver
+ */
+static void
+b9_add_helper(struct dlz_example_data *state,
+ const char *helper_name, void *ptr)
+{
+ if (strcmp(helper_name, "log") == 0)
+ state->log = ptr;
+ if (strcmp(helper_name, "putrr") == 0)
+ state->putrr = ptr;
+ if (strcmp(helper_name, "putnamedrr") == 0)
+ state->putnamedrr = ptr;
+ if (strcmp(helper_name, "writeable_zone") == 0)
+ state->writeable_zone = ptr;
+}
+
+
+/*
+ * Called to initialize the driver
+ */
+isc_result_t
+dlz_create(const char *dlzname, unsigned int argc, char *argv[],
+ void **dbdata, ...)
+{
+ struct dlz_example_data *state;
+ const char *helper_name;
+ va_list ap;
+ char soa_data[200];
+
+ UNUSED(dlzname);
+
+ state = calloc(1, sizeof(struct dlz_example_data));
+ if (state == NULL)
+ return (ISC_R_NOMEMORY);
+
+ /* Fill in the helper functions */
+ va_start(ap, dbdata);
+ while ((helper_name = va_arg(ap, const char *)) != NULL) {
+ b9_add_helper(state, helper_name, va_arg(ap, void*));
+ }
+ va_end(ap);
+
+ if (argc < 2) {
+ state->log(ISC_LOG_ERROR,
+ "dlz_example: please specify a zone name");
+ return (ISC_R_FAILURE);
+ }
+
+ state->zone_name = strdup(argv[1]);
+
+ sprintf(soa_data, "%s hostmaster.%s 123 900 600 86400 3600",
+ state->zone_name, state->zone_name);
+
+ add_name(state, &state->current[0], state->zone_name,
+ "soa", 3600, soa_data);
+ add_name(state, &state->current[0], state->zone_name,
+ "ns", 3600, state->zone_name);
+ add_name(state, &state->current[0], state->zone_name,
+ "a", 1800, "10.53.0.1");
+
+ state->log(ISC_LOG_INFO,
+ "dlz_example: started for zone %s",
+ state->zone_name);
+
+ *dbdata = state;
+ return (ISC_R_SUCCESS);
+}
+
+/*
+ * Shut down the backend
+ */
+void
+dlz_destroy(void *dbdata) {
+ struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
+
+ state->log(ISC_LOG_INFO,
+ "dlz_example: shutting down zone %s",
+ state->zone_name);
+ free(state->zone_name);
+ free(state);
+}
+
+
+/*
+ * See if we handle a given zone
+ */
+isc_result_t
+dlz_findzonedb(void *dbdata, const char *name) {
+ struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
+
+ if (strcasecmp(state->zone_name, name) == 0)
+ return (ISC_R_SUCCESS);
+
+ return (ISC_R_NOTFOUND);
+}
+
+
+
+/*
+ * Look up one record
+ */
+isc_result_t
+dlz_lookup(const char *zone, const char *name, void *dbdata,
+ dns_sdlzlookup_t *lookup)
+{
+ struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
+ isc_boolean_t found = ISC_FALSE;
+ char full_name[100];
+ int i;
+
+ UNUSED(zone);
+
+ if (strcmp(name, "@") == 0)
+ strcpy(full_name, state->zone_name);
+ else
+ sprintf(full_name, "%s.%s", name, state->zone_name);
+
+ for (i = 0; i < MAX_RECORDS; i++) {
+ if (strcasecmp(state->current[i].name, full_name) == 0) {
+ isc_result_t result;
+ found = ISC_TRUE;
+ result = state->putrr(lookup, state->current[i].type,
+ state->current[i].ttl,
+ state->current[i].data);
+ if (result != ISC_R_SUCCESS) {
+ return (result);
+ }
+ }
+ }
+
+ if (!found)
+ return (ISC_R_NOTFOUND);
+ return (ISC_R_SUCCESS);
+}
+
+
+/*
+ * See if a zone transfer is allowed
+ */
+isc_result_t
+dlz_allowzonexfr(void *dbdata, const char *name, const char *client) {
+ UNUSED(client);
+
+ /* Just say yes for all our zones */
+ return (dlz_findzonedb(dbdata, name));
+}
+
+/*
+ * Perform a zone transfer
+ */
+isc_result_t
+dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) {
+ struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
+ int i;
+
+ UNUSED(zone);
+
+ for (i = 0; i < MAX_RECORDS; i++) {
+ isc_result_t result;
+ if (strlen(state->current[i].name) == 0) {
+ continue;
+ }
+ result = state->putnamedrr(allnodes, state->current[i].name,
+ state->current[i].type,
+ state->current[i].ttl,
+ state->current[i].data);
+ if (result != ISC_R_SUCCESS)
+ return (result);
+ }
+
+ return (ISC_R_SUCCESS);
+}
+
+
+/*
+ * Start a transaction
+ */
+isc_result_t
+dlz_newversion(const char *zone, void *dbdata, void **versionp) {
+ struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
+
+ if (state->transaction_started) {
+ state->log(ISC_LOG_INFO,
+ "dlz_example: transaction already "
+ "started for zone %s", zone);
+ return (ISC_R_FAILURE);
+ }
+
+ state->transaction_started = ISC_TRUE;
+ *versionp = (void *) &state->transaction_started;
+
+ return (ISC_R_SUCCESS);
+}
+
+/*
+ * End a transaction
+ */
+void
+dlz_closeversion(const char *zone, isc_boolean_t commit,
+ void *dbdata, void **versionp)
+{
+ struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
+
+ if (!state->transaction_started) {
+ state->log(ISC_LOG_INFO,
+ "dlz_example: transaction not started for zone %s",
+ zone);
+ *versionp = NULL;
+ return;
+ }
+
+ state->transaction_started = ISC_FALSE;
+
+ *versionp = NULL;
+
+ if (commit) {
+ int i;
+ state->log(ISC_LOG_INFO,
+ "dlz_example: committing transaction on zone %s",
+ zone);
+ for (i = 0; i < MAX_RECORDS; i++) {
+ if (strlen(state->adds[i].name) > 0) {
+ add_name(state, &state->current[0],
+ state->adds[i].name,
+ state->adds[i].type,
+ state->adds[i].ttl,
+ state->adds[i].data);
+ }
+ }
+ for (i = 0; i < MAX_RECORDS; i++) {
+ if (strlen(state->deletes[i].name) > 0) {
+ del_name(state, &state->current[0],
+ state->deletes[i].name,
+ state->deletes[i].type,
+ state->deletes[i].ttl,
+ state->deletes[i].data);
+ }
+ }
+ } else {
+ state->log(ISC_LOG_INFO,
+ "dlz_example: cancelling transaction on zone %s",
+ zone);
+ }
+ memset(state->adds, 0, sizeof(state->adds));
+ memset(state->deletes, 0, sizeof(state->deletes));
+}
+
+
+/*
+ * Configure a writeable zone
+ */
+isc_result_t
+dlz_configure(dns_view_t *view, void *dbdata) {
+ struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
+ isc_result_t result;
+
+
+ state->log(ISC_LOG_INFO, "dlz_example: starting configure");
+ if (state->writeable_zone == NULL) {
+ state->log(ISC_LOG_INFO,
+ "dlz_example: no writeable_zone method available");
+ return (ISC_R_FAILURE);
+ }
+
+ result = state->writeable_zone(view, state->zone_name);
+ if (result != ISC_R_SUCCESS) {
+ state->log(ISC_LOG_ERROR,
+ "dlz_example: failed to configure zone %s",
+ state->zone_name);
+ return (result);
+ }
+
+ state->log(ISC_LOG_INFO,
+ "dlz_example: configured writeable zone %s",
+ state->zone_name);
+ return (ISC_R_SUCCESS);
+}
+
+/*
+ * Authorize a zone update
+ */
+isc_boolean_t
+dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
+ const char *type, const char *key, isc_uint32_t keydatalen,
+ unsigned char *keydata, void *dbdata)
+{
+ struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
+
+ UNUSED(tcpaddr);
+ UNUSED(type);
+ UNUSED(key);
+ UNUSED(keydatalen);
+ UNUSED(keydata);
+
+ if (strncmp(name, "deny.", 5) == 0) {
+ state->log(ISC_LOG_INFO,
+ "dlz_example: denying update of name=%s by %s",
+ name, signer);
+ return (ISC_FALSE);
+ }
+ state->log(ISC_LOG_INFO,
+ "dlz_example: allowing update of name=%s by %s",
+ name, signer);
+ return (ISC_TRUE);
+}
+
+
+static isc_result_t
+modrdataset(struct dlz_example_data *state, const char *name,
+ const char *rdatastr, struct record *list)
+{
+ char *full_name, *dclass, *type, *data, *ttlstr;
+ char *buf = strdup(rdatastr);
+ isc_result_t result;
+ char *saveptr = NULL;
+
+ /*
+ * The format is:
+ * FULLNAME\tTTL\tDCLASS\tTYPE\tDATA
+ *
+ * The DATA field is space separated, and is in the data format
+ * for the type used by dig
+ */
+
+ full_name = strtok_r(buf, "\t", &saveptr);
+ if (full_name == NULL)
+ return (ISC_R_FAILURE);
+
+ ttlstr = strtok_r(NULL, "\t", &saveptr);
+ if (ttlstr == NULL)
+ return (ISC_R_FAILURE);
+
+ dclass = strtok_r(NULL, "\t", &saveptr);
+ if (dclass == NULL)
+ return (ISC_R_FAILURE);
+
+ type = strtok_r(NULL, "\t", &saveptr);
+ if (type == NULL)
+ return (ISC_R_FAILURE);
+
+ data = strtok_r(NULL, "\t", &saveptr);
+ if (data == NULL)
+ return (ISC_R_FAILURE);
+
+ result = add_name(state, list, name, type,
+ strtoul(ttlstr, NULL, 10), data);
+ free(buf);
+ return (result);
+}
+
+
+isc_result_t
+dlz_addrdataset(const char *name, const char *rdatastr,
+ void *dbdata, void *version)
+{
+ struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
+
+ if (version != (void *) &state->transaction_started)
+ return (ISC_R_FAILURE);
+
+ state->log(ISC_LOG_INFO,
+ "dlz_example: adding rdataset %s '%s'",
+ name, rdatastr);
+
+ return (modrdataset(state, name, rdatastr, &state->adds[0]));
+}
+
+isc_result_t
+dlz_subrdataset(const char *name, const char *rdatastr,
+ void *dbdata, void *version)
+{
+ struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
+
+ if (version != (void *) &state->transaction_started)
+ return (ISC_R_FAILURE);
+
+ state->log(ISC_LOG_INFO,
+ "dlz_example: subtracting rdataset %s '%s'",
+ name, rdatastr);
+
+ return (modrdataset(state, name, rdatastr, &state->deletes[0]));
+}
+
+
+isc_result_t
+dlz_delrdataset(const char *name, const char *type,
+ void *dbdata, void *version)
+{
+ struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
+
+ if (version != (void *) &state->transaction_started)
+ return (ISC_R_FAILURE);
+
+ state->log(ISC_LOG_INFO,
+ "dlz_example: deleting rdataset %s of type %s",
+ name, type);
+
+ return (ISC_R_SUCCESS);
+}
--- /dev/null
+/*
+ * Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
+ *
+ * Written by Andrew Tridgell.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * This header provides a minimal set of defines and typedefs needed
+ * for building an external DLZ module for bind9. When creating a new
+ * external DLZ driver, please copy this header into your own source
+ * tree.
+ */
+
+#define DLZ_DLOPEN_VERSION 1
+
+/* Return this in flags to dlz_version() if thread safe */
+#define DNS_SDLZFLAG_THREADSAFE 0x00000001U
+
+#if 0
+/* Result codes */
+#define ISC_R_SUCCESS 0
+#define ISC_R_NOMEMORY 1
+#define ISC_R_NOTFOUND 23
+#define ISC_R_FAILURE 25
+
+/* Log levels */
+#define ISC_LOG_INFO (-1)
+#define ISC_LOG_NOTICE (-2)
+#define ISC_LOG_WARNING (-3)
+#define ISC_LOG_ERROR (-4)
+#define ISC_LOG_CRITICAL (-5)
+#endif
+
+/* Some opaque structures */
+typedef void *dns_sdlzlookup_t;
+typedef void *dns_sdlzallnodes_t;
+
+/*
+ * dlz_version() is required for all DLZ external drivers. It should
+ * return DLZ_DLOPEN_VERSION
+ */
+int
+dlz_version(unsigned int *flags);
+
+/*
+ * dlz_create() is required for all DLZ external drivers.
+ */
+isc_result_t
+dlz_create(const char *dlzname, unsigned int argc,
+ char *argv[], void **dbdata, ...);
+
+/*
+ * dlz_destroy() is optional, and will be called when the driver is
+ * unloaded if supplied
+ */
+void
+dlz_destroy(void *dbdata);
+
+/*
+ * dlz_findzonedb is required for all DLZ external drivers
+ */
+isc_result_t
+dlz_findzonedb(void *dbdata, const char *name);
+
+/*
+ * dlz_lookup is required for all DLZ external drivers
+ */
+isc_result_t
+dlz_lookup(const char *zone, const char *name,
+ void *dbdata, dns_sdlzlookup_t *lookup);
+
+/*
+ * dlz_allowzonexfr() is optional, and should be supplied if you want
+ * to support zone transfers
+ */
+isc_result_t
+dlz_allowzonexfr(void *dbdata, const char *name, const char *client);
+
+/*
+ * dlz_allnodes() is optional, but must be supplied if supply a
+ * dlz_allowzonexfr() function
+ */
+isc_result_t
+dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes);
+
+/*
+ * dlz_newversion() is optional. It should be supplied if you want to
+ * support dynamic updates.
+ */
+isc_result_t
+dlz_newversion(const char *zone, void *dbdata, void **versionp);
+
+/*
+ * dlz_closeversion() is optional, but must be supplied if you supply
+ * a dlz_newversion() function
+ */
+void
+dlz_closeversion(const char *zone, isc_boolean_t commit,
+ void *dbdata, void **versionp);
+
+/*
+ * dlz_configure() is optional, but must be supplied if you want to
+ * support dynamic updates
+ */
+isc_result_t
+dlz_configure(dns_view_t *view, void *dbdata);
+
+/*
+ * dlz_ssumatch() is optional, but must be supplied if you want to
+ * support dynamic updates
+ */
+isc_boolean_t
+dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
+ const char *type, const char *key, isc_uint32_t keydatalen,
+ unsigned char *keydata, void *dbdata);
+
+/*
+ * dlz_addrdataset() is optional, but must be supplied if you want to
+ * support dynamic updates
+ */
+isc_result_t
+dlz_addrdataset(const char *name, const char *rdatastr,
+ void *dbdata, void *version);
+
+/*
+ * dlz_subrdataset() is optional, but must be supplied if you want to
+ * support dynamic updates
+ */
+isc_result_t
+dlz_subrdataset(const char *name, const char *rdatastr,
+ void *dbdata, void *version);
+
+/*
+ * dlz_delrdataset() is optional, but must be supplied if you want to
+ * support dynamic updates
+ */
+isc_result_t
+dlz_delrdataset(const char *name, const char *type,
+ void *dbdata, void *version);
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: named.conf,v 1.3 2010/12/20 23:47:20 tbox Exp $ */
+/* $Id: named.conf.in,v 1.1.4.2 2011/03/10 04:29:17 each Exp $ */
controls { };
};
dlz "example zone" {
- database "dlopen ../../../../../contrib/dlz/example/dlz_example.so example.nil";
+ database "dlopen ../driver.@SO@ example.nil";
};
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
-# $Id: prereq.sh,v 1.4 2010/12/20 23:47:20 tbox Exp $
+# $Id: prereq.sh,v 1.4.14.1 2011/03/10 04:29:16 each Exp $
TOP=${SYSTEMTESTTOP:=.}/../../../..
-# enable the dlzexternal test only if it builds and dlz-dlopen was enabled
-$TOP/bin/named/named -V | grep with.dlz.dlopen | grep -v with.dlz.dlopen=no > /dev/null || {
- echo "I:not built with --with-dlz-dlopen=yes - skipping dlzexternal test"
- exit 255
-}
-
-cd ../../../../contrib/dlz/example && make all > /dev/null || {
- echo "I:build of dlz_example.so failed - skipping dlzexternal test"
- exit 1
+./dlopen || {
+ echo "I:dlopen() not supported - skipping dlzexternal test"
+ exit 1
}
exit 0
-
-
type="$2"
cmd="$3"
digout="$4"
+ should_fail="$5"
cat <<EOF > ns1/update.txt
server 10.53.0.1 5300
update add $host $cmd
send
EOF
- echo "I:testing update for $host $type $cmd"
- $NSUPDATE -k ns1/ddns.key ns1/update.txt || {
- echo "I:update failed for $host $type $cmd"
+
+ echo "I:testing update for $host $type $cmd $comment"
+ $NSUPDATE -k ns1/ddns.key ns1/update.txt > /dev/null 2>&1 || {
+ [ "$should_fail" ] || \
+ echo "I:update failed for $host $type $cmd"
return 1
}
- out=`$DIG $DIGOPTS -t $type -q $host | egrep ^$host`
+ out=`$DIG $DIGOPTS -t $type -q $host | egrep "^$host"`
lines=`echo "$out" | grep "$digout" | wc -l`
[ $lines -eq 1 ] || {
- echo "I:dig output incorrect for $host $type $cmd: $out"
+ [ "$should_fail" ] || \
+ echo "I:dig output incorrect for $host $type $cmd: $out"
return 1
}
return 0
}
-test_update testdc1.example.nil. A "86400 A 10.53.0.10" "10.53.0.10" || status=1
-test_update testdc2.example.nil. A "86400 A 10.53.0.11" "10.53.0.11" || status=1
-test_update testdc3.example.nil. A "86400 A 10.53.0.10" "10.53.0.10" || status=1
-test_update deny.example.nil. TXT "86400 TXT helloworld" "helloworld" && status=1
+ret=0
+
+test_update testdc1.example.nil. A "86400 A 10.53.0.10" "10.53.0.10" || ret=1
+status=`expr $status + $ret`
+
+test_update testdc2.example.nil. A "86400 A 10.53.0.11" "10.53.0.11" || ret=1
+status=`expr $status + $ret`
+
+test_update testdc3.example.nil. A "86400 A 10.53.0.10" "10.53.0.10" || ret=1
+status=`expr $status + $ret`
-[ $status -eq 0 ] && echo "I:dlzexternal tests all OK"
+test_update deny.example.nil. TXT "86400 TXT helloworld" "helloworld" should_fail && ret=1
+status=`expr $status + $ret`
exit $status
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: named.conf,v 1.2.4.2 2011/03/04 15:06:45 smann Exp $ */
+/* $Id: named.conf,v 1.2.4.3 2011/03/10 04:29:17 each Exp $ */
options {
query-source address 10.53.0.1;
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: config.h.in,v 1.143.8.3 2011/02/27 13:30:04 marka Exp $ */
+/* $Id: config.h.in,v 1.143.8.4 2011/03/10 04:29:14 each Exp $ */
/*! \file */
/* Define if threads need PTHREAD_SCOPE_SYSTEM */
#undef NEED_PTHREAD_SCOPE_SYSTEM
-/* Define if building universal (internal helper macro) */
-#undef AC_APPLE_UNIVERSAL_BUILD
-
/* Define to enable the "filter-aaaa-on-v4" option. */
#undef ALLOW_FILTER_AAAA_ON_V4
/* Define to 1 if you have the `c_r' library (-lc_r). */
#undef HAVE_LIBC_R
-/* Define to 1 if you have the `dl' library (-ldl). */
-#undef HAVE_LIBDL
-
/* Define to 1 if you have the `nsl' library (-lnsl). */
#undef HAVE_LIBNSL
/* Define to the flags type used by getnameinfo(3). */
#undef IRS_GETNAMEINFO_FLAGS_T
+/* Define to allow building of objects for dlopen(). */
+#undef ISC_DLZ_DLOPEN
+
/* Defined if extern char *optarg is not declared. */
#undef NEED_OPTARG
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
-/* Define to the home page for this package. */
-#undef PACKAGE_URL
-
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* define if idnkit support is to be included. */
#undef WITH_IDN
-/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
- significant byte first (like Motorola and SPARC, unlike Intel). */
-#if defined AC_APPLE_UNIVERSAL_BUILD
-# if defined __BIG_ENDIAN__
-# define WORDS_BIGENDIAN 1
-# endif
-#else
-# ifndef WORDS_BIGENDIAN
-# undef WORDS_BIGENDIAN
-# endif
-#endif
+/* Define to 1 if your processor stores words with the most significant byte
+ first (like Motorola and SPARC, unlike Intel and VAX). */
+#undef WORDS_BIGENDIAN
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
esyscmd([sed "s/^/# /" COPYRIGHT])dnl
AC_DIVERT_POP()dnl
-AC_REVISION($Revision: 1.512.8.6 $)
+AC_REVISION($Revision: 1.512.8.7 $)
AC_INIT(lib/dns/name.c)
AC_PREREQ(2.59)
# Configure any DLZ drivers.
#
# If config.dlz.in selects one or more DLZ drivers, it will set
-# USE_DLZ to a non-empty value, which will be our clue to
-# enable the DLZ core functions.
+# CONTRIB_DLZ to a non-empty value, which will be our clue to
+# build DLZ drivers in contrib.
#
# This section has to come after the libtool stuff because it needs to
# know how to name the driver object files.
#
-USE_DLZ=""
+CONTRIB_DLZ=""
DLZ_DRIVER_INCLUDES=""
DLZ_DRIVER_LIBS=""
DLZ_DRIVER_SRCS=""
DLZ_DRIVER_OBJS=""
DLZ_SYSTEM_TEST=""
-sinclude(contrib/dlz/config.dlz.in)
+#
+# Configure support for building a shared library object
+#
+# Even when libtool is available it can't always be relied upon
+# to build an object that can be dlopen()'ed, but this is necessary
+# for building the dlzexternal system test, so we'll try it the
+# old-fashioned way.
+#
+SO="so"
+SO_CFLAGS=""
+SO_LD=""
+SO_TARGETS=""
+
+AC_ARG_WITH(dlopen,
+ [ --with-dlopen=ARG Support dynamically loadable DLZ drivers],
+ dlopen="$withval", dlopen="yes")
+
+if test "$dlopen" = "yes"; then
+ AC_CHECK_LIB(dl, dlclose, have_dl=yes, have_dl=no)
+ AC_CHECK_FUNCS(dlopen dlclose dlsym,,dlopen=no)
+fi
+
+if test "$dlopen" = "yes"; then
+ case $host in
+ *-linux*)
+ SO_CFLAGS="-fPIC"
+ if test "$have_dl" = "yes"
+ then
+ SO_LD="${CC} -shared"
+ else
+ SO_LD="ld -shared"
+ fi
+ ;;
+ *-freebsd*|*-openbsd*|*-netbsd*)
+ SO_CFLAGS="-fpic"
+ SO_LD="ld -Bshareable -x"
+ ;;
+ *-solaris*)
+ SO_CFLAGS="-KPIC"
+ SO_LD="ld -G -z text"
+ ;;
+ *-hp-hpux*)
+ SO=sl
+ SO_CFLAGS="+z"
+ SO_LD="ld -b"
+ ;;
+ *)
+ SO_CFLAGS="-fPIC"
+ ;;
+ esac
+
+ if test "X$GCC" = "Xyes"; then
+ SO_CFLAGS="-fPIC"
+ test -n "$SO_LD" || SO_LD="${CC} -shared"
+ fi
-AC_MSG_CHECKING(for DLZ)
+ # If we still don't know how to make shared objects, don't make any.
+ if test -n "$SO_LD"; then
+ SO_TARGETS="\${SO_TARGETS}"
+ AC_DEFINE(ISC_DLZ_DLOPEN, 1,
+ [Define to allow building of objects for dlopen().])
+ fi
+fi
+
+AC_SUBST(SO)
+AC_SUBST(SO_CFLAGS)
+AC_SUBST(SO_LD)
+AC_SUBST(SO_TARGETS)
+
+sinclude(contrib/dlz/config.dlz.in)
+AC_MSG_CHECKING(contributed DLZ drivers)
-if test -n "$USE_DLZ"
+if test -n "$CONTRIB_DLZ"
then
AC_MSG_RESULT(yes)
- USE_DLZ="-DDLZ $USE_DLZ"
DLZ_DRIVER_RULES=contrib/dlz/drivers/rules
AC_CONFIG_FILES([$DLZ_DRIVER_RULES])
else
DLZ_DRIVER_RULES=/dev/null
fi
-AC_SUBST(USE_DLZ)
+AC_SUBST(CONTRIB_DLZ)
AC_SUBST(DLZ_DRIVER_INCLUDES)
AC_SUBST(DLZ_DRIVER_LIBS)
AC_SUBST(DLZ_DRIVER_SRCS)
bin/tests/sockaddr/Makefile
bin/tests/system/Makefile
bin/tests/system/conf.sh
+ bin/tests/system/dlzexternal/Makefile
+ bin/tests/system/dlzexternal/ns1/named.conf
bin/tests/system/filter-aaaa/Makefile
bin/tests/system/gost/prereq.sh
bin/tests/system/lwresd/Makefile
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.5 2009/12/05 23:31:40 each Exp $
+# $Id: Makefile.in,v 1.5.244.1 2011/03/10 04:29:17 each Exp $
srcdir = @srcdir@
VPATH = @srcdir@
CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include \
${ISC_INCLUDES} ${DLZINCLUDES}
-CDEFINES = @USE_DLZ@
+CDEFINES = @CONTRIB_DLZ@
CWARNINGS =
DLZLIBS = @DLZ_DRIVER_LIBS@
# LIBS is any necessary library definitions
#
AC_DEFUN(DLZ_ADD_DRIVER, [
- USE_DLZ="$USE_DLZ -DDLZ_$1"
+ CONTRIB_DLZ="$CONTRIB_DLZ -DDLZ_$1"
for i in $2
do
DLZ_DRIVER_SRCS="$DLZ_DRIVER_SRCS $dlzdir/$i.c"
;;
esac
-#
-# Was --with-dlz-dlopen specified?
-#
-
-AC_MSG_CHECKING(for dlopen DLZ driver)
-AC_ARG_WITH(dlz_dlopen,
-[ --with-dlz-dlopen[=PATH] Build with dlopen DLZ driver [yes|no].
- (Required to use dlopen driver with DLZ)],
- use_dlz_dlopen="$withval", use_dlz_dlopen="no")
-
-case "$use_dlz_dlopen" in
- no)
- AC_MSG_RESULT(no)
- ;;
- *)
- AC_CHECK_LIB(dl, dlclose)
- AC_CHECK_FUNCS(dlopen dlclose dlsym)
- DLZ_ADD_DRIVER(DLOPEN, dlz_dlopen_driver)
-
- AC_MSG_RESULT(yes)
- ;;
-esac
-
-
# Add any additional DLZ drivers here.
#
# Finally, some generic stuff that applies to all drivers, assuming
-# we're compiling DLZ at all.
+# we're compiling contrib DLZ drivers at all.
#
-if test -n "$USE_DLZ"
+if test -n "$CONTRIB_DLZ"
then
+ CONTRIB_DLZ="-DCONTRIB_DLZ $CONTRIB_DLZ"
+
#
# Where to find DLZ driver header files.
#
-/*
- * Copyright (C) 2010 Andrew Tridgell
- *
- * based on dlz_stub_driver.c
- * which is:
- * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
- * Copyright (C) 1999-2001 Internet Software Consortium.
- * see dlz_stub_driver.c for details
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the
- * above copyright notice and this permission notice appear in all
- * copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR
- * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
- * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
- * USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
- * conceived and contributed by Rob Butler.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the
- * above copyright notice and this permission notice appear in all
- * copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
- * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
- * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
- * USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef DLZ_DLOPEN
-
-#include <config.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <dlfcn.h>
-
-#include <dns/log.h>
-#include <dns/sdlz.h>
-#include <dns/result.h>
-
-#include <isc/mem.h>
-#include <isc/print.h>
-#include <isc/result.h>
-#include <isc/util.h>
-
-#include <named/globals.h>
-
-#include <dlz/dlz_dlopen_driver.h>
-
-static dns_sdlzimplementation_t *dlz_dlopen = NULL;
-
-
-typedef struct dlopen_data {
- isc_mem_t *mctx;
- char *dl_path;
- char *dlzname;
- void *dl_handle;
- void *dbdata;
- unsigned int flags;
- isc_mutex_t lock;
- int version;
- isc_boolean_t in_configure;
-
- int (*dlz_version)(unsigned int *flags);
- isc_result_t (*dlz_create)(const char *dlzname,
- unsigned int argc, char *argv[],
- void **dbdata, ...);
- isc_result_t (*dlz_findzonedb)(void *dbdata, const char *name);
- isc_result_t (*dlz_lookup)(const char *zone, const char *name,
- void *dbdata, dns_sdlzlookup_t *lookup);
- isc_result_t (*dlz_authority)(const char *zone, void *dbdata,
- dns_sdlzlookup_t *lookup);
- isc_result_t (*dlz_allnodes)(const char *zone, void *dbdata,
- dns_sdlzallnodes_t *allnodes);
- isc_result_t (*dlz_allowzonexfr)(void *dbdata, const char *name,
- const char *client);
- isc_result_t (*dlz_newversion)(const char *zone, void *dbdata,
- void **versionp);
- void (*dlz_closeversion)(const char *zone, isc_boolean_t commit,
- void *dbdata, void **versionp);
- isc_result_t (*dlz_configure)(dns_view_t *view, void *dbdata);
- isc_boolean_t (*dlz_ssumatch)(const char *signer, const char *name,
- const char *tcpaddr, const char *type,
- const char *key, uint32_t keydatalen,
- uint8_t *keydata, void *dbdata);
- isc_result_t (*dlz_addrdataset)(const char *name, const char *rdatastr,
- void *dbdata, void *version);
- isc_result_t (*dlz_subrdataset)(const char *name, const char *rdatastr,
- void *dbdata, void *version);
- isc_result_t (*dlz_delrdataset)(const char *name, const char *type,
- void *dbdata, void *version);
- void (*dlz_destroy)(void *dbdata);
-} dlopen_data_t;
-
-/* Modules can choose whether they are lock-safe or not. */
-#define MAYBE_LOCK(cd) \
- do { \
- if ((cd->flags & DNS_SDLZFLAG_THREADSAFE) == 0 && \
- cd->in_configure == ISC_FALSE) \
- LOCK(&cd->lock); \
- } while (0)
-
-#define MAYBE_UNLOCK(cd) \
- do { \
- if ((cd->flags & DNS_SDLZFLAG_THREADSAFE) == 0 && \
- cd->in_configure == ISC_FALSE) \
- UNLOCK(&cd->lock); \
- } while (0)
-
-/*
- * Log a message at the given level.
- */
-static void dlopen_log(int level, const char *fmt, ...)
-{
- va_list ap;
- va_start(ap, fmt);
- isc_log_vwrite(dns_lctx, DNS_LOGCATEGORY_DATABASE,
- DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(level),
- fmt, ap);
- va_end(ap);
-}
-
-/*
- * SDLZ methods
- */
-
-static isc_result_t
-dlopen_dlz_allnodes(const char *zone, void *driverarg, void *dbdata,
- dns_sdlzallnodes_t *allnodes)
-{
- dlopen_data_t *cd = (dlopen_data_t *) dbdata;
- isc_result_t result;
-
-
- UNUSED(driverarg);
-
- if (cd->dlz_allnodes == NULL) {
- return (ISC_R_NOPERM);
- }
-
- MAYBE_LOCK(cd);
- result = cd->dlz_allnodes(zone, cd->dbdata, allnodes);
- MAYBE_UNLOCK(cd);
- return (result);
-}
-
-
-static isc_result_t
-dlopen_dlz_allowzonexfr(void *driverarg, void *dbdata, const char *name,
- const char *client)
-{
- dlopen_data_t *cd = (dlopen_data_t *) dbdata;
- isc_result_t result;
-
- UNUSED(driverarg);
-
-
- if (cd->dlz_allowzonexfr == NULL) {
- return (ISC_R_NOPERM);
- }
-
- MAYBE_LOCK(cd);
- result = cd->dlz_allowzonexfr(cd->dbdata, name, client);
- MAYBE_UNLOCK(cd);
- return (result);
-}
-
-static isc_result_t
-dlopen_dlz_authority(const char *zone, void *driverarg, void *dbdata,
- dns_sdlzlookup_t *lookup)
-{
- dlopen_data_t *cd = (dlopen_data_t *) dbdata;
- isc_result_t result;
-
- UNUSED(driverarg);
-
- if (cd->dlz_authority == NULL) {
- return (ISC_R_NOTIMPLEMENTED);
- }
-
- MAYBE_LOCK(cd);
- result = cd->dlz_authority(zone, cd->dbdata, lookup);
- MAYBE_UNLOCK(cd);
- return (result);
-}
-
-static isc_result_t
-dlopen_dlz_findzonedb(void *driverarg, void *dbdata, const char *name)
-{
- dlopen_data_t *cd = (dlopen_data_t *) dbdata;
- isc_result_t result;
-
- UNUSED(driverarg);
-
- MAYBE_LOCK(cd);
- result = cd->dlz_findzonedb(cd->dbdata, name);
- MAYBE_UNLOCK(cd);
- return (result);
-}
-
-
-static isc_result_t
-dlopen_dlz_lookup(const char *zone, const char *name, void *driverarg,
- void *dbdata, dns_sdlzlookup_t *lookup)
-{
- dlopen_data_t *cd = (dlopen_data_t *) dbdata;
- isc_result_t result;
-
- UNUSED(driverarg);
-
- MAYBE_LOCK(cd);
- result = cd->dlz_lookup(zone, name, cd->dbdata, lookup);
- MAYBE_UNLOCK(cd);
- return (result);
-}
-
-/*
- * Load a symbol from the library
- */
-static void *
-dl_load_symbol(dlopen_data_t *cd, const char *symbol, bool mandatory) {
- void *ptr = dlsym(cd->dl_handle, symbol);
- if (ptr == NULL && mandatory) {
- dlopen_log(ISC_LOG_ERROR,
- "dlz_dlopen: library '%s' is missing "
- "required symbol '%s'", cd->dl_path, symbol);
- }
- return (ptr);
-}
-
-/*
- * Called at startup for each dlopen zone in named.conf
- */
-static isc_result_t
-dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
- void *driverarg, void **dbdata)
-{
- dlopen_data_t *cd;
- isc_mem_t *mctx = NULL;
- isc_result_t result = ISC_R_FAILURE;
- int dlopen_flags;
-
- UNUSED(driverarg);
-
- if (argc < 2) {
- dlopen_log(ISC_LOG_ERROR,
- "dlz_dlopen driver for '%s' needs a path to "
- "the shared library", dlzname);
- return (ISC_R_FAILURE);
- }
-
- isc_mem_create(0, 0, &mctx);
-
- cd = isc_mem_get(mctx, sizeof(*cd));
- if (cd == NULL) {
- isc_mem_destroy(&mctx);
- return (ISC_R_NOMEMORY);
- }
- memset(cd, 0, sizeof(*cd));
-
- cd->mctx = mctx;
-
- cd->dl_path = isc_mem_strdup(cd->mctx, argv[1]);
- if (cd->dl_path == NULL) {
- goto failed;
- }
-
- cd->dlzname = isc_mem_strdup(cd->mctx, dlzname);
- if (cd->dlzname == NULL) {
- goto failed;
- }
-
- /* Open the library */
- dlopen_flags = RTLD_NOW;
-
-#ifdef RTLD_DEEPBIND
- /*
- * If RTLD_DEEPBIND is available then use it. This can avoid
- * issues with a module using a different version of a system
- * library than one that bind9 uses. For example, bind9 may link
- * to MIT kerberos, but the module may use Heimdal. If we don't
- * use RTLD_DEEPBIND then we could end up with Heimdal functions
- * calling MIT functions, which leads to bizarre results (usually
- * a segfault).
- */
- dlopen_flags |= RTLD_DEEPBIND;
-#endif
-
- cd->dl_handle = dlopen(cd->dl_path, dlopen_flags);
- if (cd->dl_handle == NULL) {
- dlopen_log(ISC_LOG_ERROR,
- "dlz_dlopen failed to open library '%s' - %s",
- cd->dl_path, dlerror());
- goto failed;
- }
-
- /* Find the symbols */
- cd->dlz_version = dl_load_symbol(cd, "dlz_version", true);
- cd->dlz_create = dl_load_symbol(cd, "dlz_create", true);
- cd->dlz_lookup = dl_load_symbol(cd, "dlz_lookup", true);
- cd->dlz_findzonedb = dl_load_symbol(cd, "dlz_findzonedb", true);
-
- if (cd->dlz_create == NULL || cd->dlz_lookup == NULL ||
- cd->dlz_findzonedb == NULL)
- {
- /* We're missing a required symbol */
- goto failed;
- }
-
- cd->dlz_allowzonexfr = dl_load_symbol(cd, "dlz_allowzonexfr", false);
- cd->dlz_allnodes = dl_load_symbol(cd, "dlz_allnodes",
- cd->dlz_allowzonexfr != NULL);
- cd->dlz_authority = dl_load_symbol(cd, "dlz_authority", false);
- cd->dlz_newversion = dl_load_symbol(cd, "dlz_newversion", false);
- cd->dlz_closeversion = dl_load_symbol(cd, "dlz_closeversion",
- cd->dlz_newversion != NULL);
- cd->dlz_configure = dl_load_symbol(cd, "dlz_configure", false);
- cd->dlz_ssumatch = dl_load_symbol(cd, "dlz_ssumatch", false);
- cd->dlz_addrdataset = dl_load_symbol(cd, "dlz_addrdataset", false);
- cd->dlz_subrdataset = dl_load_symbol(cd, "dlz_subrdataset", false);
- cd->dlz_delrdataset = dl_load_symbol(cd, "dlz_delrdataset", false);
-
- /* Check the version of the API is the same */
- cd->version = cd->dlz_version(&cd->flags);
- if (cd->version != DLZ_DLOPEN_VERSION) {
- dlopen_log(ISC_LOG_ERROR,
- "dlz_dlopen: incorrect version %d "
- "should be %d in '%s'",
- cd->version, DLZ_DLOPEN_VERSION, cd->dl_path);
- goto failed;
- }
-
- /*
- * Call the library's create function. Note that this is an
- * extended version of dlz create, with the addition of
- * named function pointers for helper functions that the
- * driver will need. This avoids the need for the backend to
- * link the bind9 libraries
- */
- MAYBE_LOCK(cd);
- result = cd->dlz_create(dlzname, argc-1, argv+1,
- &cd->dbdata,
- "log", dlopen_log,
- "putrr", dns_sdlz_putrr,
- "putnamedrr", dns_sdlz_putnamedrr,
- "writeable_zone", dns_dlz_writeablezone,
- NULL);
- MAYBE_UNLOCK(cd);
- if (result != ISC_R_SUCCESS)
- goto failed;
-
- *dbdata = cd;
-
- return (ISC_R_SUCCESS);
-
-failed:
- dlopen_log(ISC_LOG_ERROR, "dlz_dlopen of '%s' failed", dlzname);
- if (cd->dl_path)
- isc_mem_free(mctx, cd->dl_path);
- if (cd->dlzname)
- isc_mem_free(mctx, cd->dlzname);
-#ifdef HAVE_DLCLOSE
- if (cd->dl_handle)
- dlclose(cd->dl_handle);
-#endif
- isc_mem_put(mctx, cd, sizeof(*cd));
- isc_mem_destroy(&mctx);
- return (result);
-}
-
-
-/*
- * Called when bind is shutting down
- */
-static void
-dlopen_dlz_destroy(void *driverarg, void *dbdata) {
- dlopen_data_t *cd = (dlopen_data_t *) dbdata;
- isc_mem_t *mctx;
-
- UNUSED(driverarg);
-
- if (cd->dlz_destroy) {
- MAYBE_LOCK(cd);
- cd->dlz_destroy(cd->dbdata);
- MAYBE_UNLOCK(cd);
- }
-
- if (cd->dl_path)
- isc_mem_free(cd->mctx, cd->dl_path);
- if (cd->dlzname)
- isc_mem_free(cd->mctx, cd->dlzname);
-#ifdef HAVE_DLCLOSE
- if (cd->dl_handle)
- dlclose(cd->dl_handle);
-#endif
- mctx = cd->mctx;
- isc_mem_put(mctx, cd, sizeof(*cd));
- isc_mem_destroy(&mctx);
-}
-
-/*
- * Called to start a transaction
- */
-static isc_result_t
-dlopen_dlz_newversion(const char *zone, void *driverarg, void *dbdata,
- void **versionp)
-{
- dlopen_data_t *cd = (dlopen_data_t *) dbdata;
- isc_result_t result;
-
- UNUSED(driverarg);
-
- if (cd->dlz_newversion == NULL)
- return (ISC_R_NOTIMPLEMENTED);
-
- MAYBE_LOCK(cd);
- result = cd->dlz_newversion(zone, cd->dbdata, versionp);
- MAYBE_UNLOCK(cd);
- return (result);
-}
-
-/*
- * Called to end a transaction
- */
-static void
-dlopen_dlz_closeversion(const char *zone, isc_boolean_t commit,
- void *driverarg, void *dbdata, void **versionp)
-{
- dlopen_data_t *cd = (dlopen_data_t *) dbdata;
-
- UNUSED(driverarg);
-
- if (cd->dlz_newversion == NULL) {
- *versionp = NULL;
- return;
- }
-
- MAYBE_LOCK(cd);
- cd->dlz_closeversion(zone, commit, cd->dbdata, versionp);
- MAYBE_UNLOCK(cd);
-}
-
-/*
- * Called on startup to configure any writeable zones
- */
-static isc_result_t
-dlopen_dlz_configure(dns_view_t *view, void *driverarg, void *dbdata) {
- dlopen_data_t *cd = (dlopen_data_t *) dbdata;
- isc_result_t result;
-
- UNUSED(driverarg);
-
- if (cd->dlz_configure == NULL)
- return (ISC_R_SUCCESS);
-
- MAYBE_LOCK(cd);
- cd->in_configure = ISC_TRUE;
- result = cd->dlz_configure(view, cd->dbdata);
- cd->in_configure = ISC_FALSE;
- MAYBE_UNLOCK(cd);
-
- return (result);
-}
-
-
-/*
- * Check for authority to change a name
- */
-static isc_boolean_t
-dlopen_dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
- const char *type, const char *key, uint32_t keydatalen,
- uint8_t *keydata, void *driverarg, void *dbdata)
-{
- dlopen_data_t *cd = (dlopen_data_t *) dbdata;
- isc_boolean_t ret;
-
- UNUSED(driverarg);
-
- if (cd->dlz_ssumatch == NULL)
- return (ISC_FALSE);
-
- MAYBE_LOCK(cd);
- ret = cd->dlz_ssumatch(signer, name, tcpaddr, type, key, keydatalen,
- keydata, cd->dbdata);
- MAYBE_UNLOCK(cd);
-
- return (ret);
-}
-
-
-/*
- * Add an rdataset
- */
-static isc_result_t
-dlopen_dlz_addrdataset(const char *name, const char *rdatastr,
- void *driverarg, void *dbdata, void *version)
-{
- dlopen_data_t *cd = (dlopen_data_t *) dbdata;
- isc_result_t result;
-
- UNUSED(driverarg);
-
- if (cd->dlz_addrdataset == NULL)
- return (ISC_R_NOTIMPLEMENTED);
-
- MAYBE_LOCK(cd);
- result = cd->dlz_addrdataset(name, rdatastr, cd->dbdata, version);
- MAYBE_UNLOCK(cd);
-
- return (result);
-}
-
-/*
- * Subtract an rdataset
- */
-static isc_result_t
-dlopen_dlz_subrdataset(const char *name, const char *rdatastr,
- void *driverarg, void *dbdata, void *version)
-{
- dlopen_data_t *cd = (dlopen_data_t *) dbdata;
- isc_result_t result;
-
- UNUSED(driverarg);
-
- if (cd->dlz_subrdataset == NULL)
- return (ISC_R_NOTIMPLEMENTED);
-
- MAYBE_LOCK(cd);
- result = cd->dlz_subrdataset(name, rdatastr, cd->dbdata, version);
- MAYBE_UNLOCK(cd);
-
- return (result);
-}
-
-/*
- delete a rdataset
- */
-static isc_result_t
-dlopen_dlz_delrdataset(const char *name, const char *type,
- void *driverarg, void *dbdata, void *version)
-{
- dlopen_data_t *cd = (dlopen_data_t *) dbdata;
- isc_result_t result;
-
- UNUSED(driverarg);
-
- if (cd->dlz_delrdataset == NULL)
- return (ISC_R_NOTIMPLEMENTED);
-
- MAYBE_LOCK(cd);
- result = cd->dlz_delrdataset(name, type, cd->dbdata, version);
- MAYBE_UNLOCK(cd);
-
- return (result);
-}
-
-
-static dns_sdlzmethods_t dlz_dlopen_methods = {
- dlopen_dlz_create,
- dlopen_dlz_destroy,
- dlopen_dlz_findzonedb,
- dlopen_dlz_lookup,
- dlopen_dlz_authority,
- dlopen_dlz_allnodes,
- dlopen_dlz_allowzonexfr,
- dlopen_dlz_newversion,
- dlopen_dlz_closeversion,
- dlopen_dlz_configure,
- dlopen_dlz_ssumatch,
- dlopen_dlz_addrdataset,
- dlopen_dlz_subrdataset,
- dlopen_dlz_delrdataset
-};
-
-/*
- * Register driver with BIND
- */
-isc_result_t
-dlz_dlopen_init(void) {
- isc_result_t result;
-
- dlopen_log(2, "Registering DLZ_dlopen driver");
-
- result = dns_sdlzregister("dlopen", &dlz_dlopen_methods, NULL,
- DNS_SDLZFLAG_RELATIVEOWNER |
- DNS_SDLZFLAG_THREADSAFE,
- ns_g_mctx, &dlz_dlopen);
-
- if (result != ISC_R_SUCCESS) {
- UNEXPECTED_ERROR(__FILE__, __LINE__,
- "dns_sdlzregister() failed: %s",
- isc_result_totext(result));
- result = ISC_R_UNEXPECTED;
- }
-
- return (result);
-}
-
-
-/*
- * Unregister the driver
- */
-void
-dlz_dlopen_clear(void) {
- dlopen_log(2, "Unregistering DLZ_dlopen driver");
- if (dlz_dlopen != NULL)
- dns_sdlzunregister(&dlz_dlopen);
-}
-
-#endif
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dlz_drivers.c,v 1.3 2010/12/18 01:56:20 each Exp $ */
+/* $Id: dlz_drivers.c,v 1.3.16.1 2011/03/10 04:29:17 each Exp $ */
/*! \file */
#include <dlz/dlz_odbc_driver.h>
#endif
-#ifdef DLZ_DLOPEN
-#include <dlz/dlz_dlopen_driver.h>
-#endif
-
/*%
* Call init functions for all relevant DLZ drivers.
*/
return (result);
#endif
-#ifdef DLZ_DLOPEN
- result = dlz_dlopen_init();
- if (result != ISC_R_SUCCESS)
- return (result);
-#endif
-
return (result);
}
dlz_odbc_clear();
#endif
-#ifdef DLZ_DLOPEN
- dlz_dlopen_clear();
-#endif
-
}
-/*
- * Copyright (C) 2010 Andrew Tridgell
- *
- * based on dlz_stub_driver.h
- * which is:
- * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
- * Copyright (C) 1999-2001 Internet Software Consortium.
- * see dlz_stub_driver.h for details
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the
- * above copyright notice and this permission notice appear in all
- * copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR
- * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
- * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
- * USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
- * conceived and contributed by Rob Butler.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the
- * above copyright notice and this permission notice appear in all
- * copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
- * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
- * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
- * USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef DLZ_DLOPEN_DRIVER_H
-#define DLZ_DLOPEN_DRIVER_H
-
-isc_result_t
-dlz_dlopen_init(void);
-
-void
-dlz_dlopen_clear(void);
-
-#define DLZ_DLOPEN_VERSION 1
-
-#endif
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.176.8.1 2011/02/26 02:36:45 each Exp $
+# $Id: Makefile.in,v 1.176.8.2 2011/03/10 04:29:17 each Exp $
srcdir = @srcdir@
VPATH = @srcdir@
stats.c tcpmsg.c time.c timer.c tkey.c \
tsec.c tsig.c ttl.c validator.c \
version.c view.c xfrin.c zone.c zonekey.c zt.c ${OTHERSRCS}
+
SRCS = ${DSTSRCS} ${DNSSRCS}
SUBDIRS = include
dns_dispatchmgr_setblackportlist
dns_dispatchmgr_setstats
dns_dlzallowzonexfr
+dns_dlzconfigure
dns_dlzcreate
dns_dlzdestroy
dns_dlzfindzone
dns_dlzregister
dns_dlzstrtoargv
dns_dlzunregister
+dns_dlz_writeablezone
dns_dns64_aaaafroma
dns_dns64_aaaaok
dns_dns64_append
dns_name_totext
dns_name_towire
dns_ncache_add
+dns_ncache_current
dns_ncache_getrdataset
dns_ncache_towire
dns_nsec3_active
dns_resolver_setclientsperquery
dns_resolver_setlamettl
dns_resolver_setmustbesecure
+dns_resolver_settimeout
dns_resolver_setudpsize
dns_resolver_setzeronosoattl
dns_resolver_shutdown
dns_sdlz_putnamedrr
dns_sdlz_putrr
dns_sdlz_putsoa
+dns_sdlz_setdb
dns_sdlzregister
dns_sdlzunregister
dns_secalg_format
dns_zone_create
dns_zone_detach
dns_zone_dialup
+dns_zone_dlzpostload
dns_zone_dump
dns_zone_dumptostream
dns_zone_dumptostream2
# 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.2 2011/02/28 01:20:04 tbox Exp $
+# $Id: Makefile.in,v 1.21.244.3 2011/03/10 04:29:18 each Exp $
srcdir = @srcdir@
VPATH = @srcdir@
CINCLUDES = -I. ${DNS_INCLUDES} ${ISC_INCLUDES} ${ISCCFG_INCLUDES}
-CDEFINES = @USE_DLZ@
+CDEFINES =
CWARNINGS =
ISCLIBS = ../../lib/isc/libisc.@A@