2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 15:05:23 +00:00

1913. [func] Integrate contibuted DLZ code into named. [RT #11382]

This commit is contained in:
Mark Andrews
2005-09-05 00:12:29 +00:00
parent 78f70e0b75
commit 03e200df5d
52 changed files with 15461 additions and 132 deletions

View File

@@ -1,3 +1,5 @@
1913. [func] Integrate contibuted DLZ code into named. [RT #11382]
1912. [port] aix: atomic locking for powerpc. [RT #15020] 1912. [port] aix: atomic locking for powerpc. [RT #15020]
1911. [bug] Update windows socket code. [RT #14965] 1911. [bug] Update windows socket code. [RT #14965]

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: check-tool.c,v 1.19 2005/08/24 23:53:54 marka Exp $ */ /* $Id: check-tool.c,v 1.20 2005/09/05 00:10:51 marka Exp $ */
/*! \file */ /*! \file */
@@ -435,7 +435,7 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
dns_zone_setchecksrv(zone, checksrv); dns_zone_setchecksrv(zone, checksrv);
CHECK(dns_zone_load(zone)); CHECK(dns_zone_load(zone));
if (zonep != NULL){ if (zonep != NULL) {
*zonep = zone; *zonep = zone;
zone = NULL; zone = NULL;
} }

View File

@@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE. # PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.86 2005/01/12 01:56:06 marka Exp $ # $Id: Makefile.in,v 1.87 2005/09/05 00:10:51 marka Exp $
srcdir = @srcdir@ srcdir = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
@@ -31,12 +31,20 @@ DBDRIVER_SRCS =
DBDRIVER_INCLUDES = DBDRIVER_INCLUDES =
DBDRIVER_LIBS = DBDRIVER_LIBS =
DLZ_DRIVER_DIR = ${top_srcdir}/contrib/dlz/drivers
DLZDRIVER_OBJS = @DLZ_DRIVER_OBJS@
DLZDRIVER_SRCS = @DLZ_DRIVER_SRCS@
DLZDRIVER_INCLUDES = @DLZ_DRIVER_INCLUDES@
DLZDRIVER_LIBS = @DLZ_DRIVER_LIBS@
CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include \ CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include \
${LWRES_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES} \ ${LWRES_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES} \
${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \ ${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \
${DBDRIVER_INCLUDES} ${DLZDRIVER_INCLUDES} ${DBDRIVER_INCLUDES}
CDEFINES = @USE_DLZ@
CDEFINES =
CWARNINGS = CWARNINGS =
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
@@ -57,7 +65,8 @@ DEPLIBS = ${LWRESDEPLIBS} ${DNSDEPLIBS} ${BIND9DEPLIBS} \
${ISCCFGDEPLIBS} ${ISCCCDEPLIBS} ${ISCDEPLIBS} ${ISCCFGDEPLIBS} ${ISCCCDEPLIBS} ${ISCDEPLIBS}
LIBS = ${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} \ LIBS = ${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} \
${ISCCFGLIBS} ${ISCCCLIBS} ${ISCLIBS} ${DBDRIVER_LIBS} @LIBS@ ${ISCCFGLIBS} ${ISCCCLIBS} ${ISCLIBS} \
${DLZDRIVER_LIBS} ${DBDRIVER_LIBS} @LIBS@
SUBDIRS = unix SUBDIRS = unix
@@ -71,7 +80,7 @@ OBJS = builtin.@O@ client.@O@ config.@O@ control.@O@ \
zoneconf.@O@ \ zoneconf.@O@ \
lwaddr.@O@ lwresd.@O@ lwdclient.@O@ lwderror.@O@ lwdgabn.@O@ \ lwaddr.@O@ lwresd.@O@ lwdclient.@O@ lwderror.@O@ lwdgabn.@O@ \
lwdgnba.@O@ lwdgrbn.@O@ lwdnoop.@O@ lwsearch.@O@ \ lwdgnba.@O@ lwdgrbn.@O@ lwdnoop.@O@ lwsearch.@O@ \
$(DBDRIVER_OBJS) ${DLZDRIVER_OBJS} ${DBDRIVER_OBJS}
UOBJS = unix/os.@O@ UOBJS = unix/os.@O@
@@ -83,7 +92,7 @@ SRCS = builtin.c client.c config.c control.c \
zoneconf.c \ zoneconf.c \
lwaddr.c lwresd.c lwdclient.c lwderror.c lwdgabn.c \ lwaddr.c lwresd.c lwdclient.c lwderror.c lwdgabn.c \
lwdgnba.c lwdgrbn.c lwdnoop.c lwsearch.c \ lwdgnba.c lwdgrbn.c lwdnoop.c lwsearch.c \
$(DBDRIVER_SRCS) ${DLZDRIVER_SRCS} ${DBDRIVER_SRCS}
MANPAGES = named.8 lwresd.8 named.conf.5 MANPAGES = named.8 lwresd.8 named.conf.5
@@ -133,3 +142,4 @@ install:: named@EXEEXT@ lwresd@EXEEXT@ installdirs
${INSTALL_DATA} ${srcdir}/lwresd.8 ${DESTDIR}${mandir}/man8 ${INSTALL_DATA} ${srcdir}/lwresd.8 ${DESTDIR}${mandir}/man8
${INSTALL_DATA} ${srcdir}/named.conf.5 ${DESTDIR}${mandir}/man5 ${INSTALL_DATA} ${srcdir}/named.conf.5 ${DESTDIR}${mandir}/man5
@DLZ_DRIVER_RULES@

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: main.c,v 1.147 2005/06/10 07:00:19 marka Exp $ */ /* $Id: main.c,v 1.148 2005/09/05 00:10:52 marka Exp $ */
/*! \file */ /*! \file */
@@ -73,6 +73,13 @@
*/ */
/* #include "xxdb.h" */ /* #include "xxdb.h" */
/*
* Include DLZ drivers if appropriate.
*/
#ifdef DLZ
#include <dlz/dlz_drivers.h>
#endif
static isc_boolean_t want_stats = ISC_FALSE; static isc_boolean_t want_stats = ISC_FALSE;
static char program_name[ISC_DIR_NAMEMAX] = "named"; static char program_name[ISC_DIR_NAMEMAX] = "named";
static char absolute_conffile[ISC_DIR_PATHMAX]; static char absolute_conffile[ISC_DIR_PATHMAX];
@@ -675,6 +682,16 @@ setup(void) {
*/ */
/* xxdb_init(); */ /* xxdb_init(); */
#ifdef DLZ
/*
* Registyer any DLZ drivers.
*/
result = dlz_drivers_init();
if (result != ISC_R_SUCCESS)
ns_main_earlyfatal("dlz_drivers_init() failed: %s",
isc_result_totext(result));
#endif
ns_server_create(ns_g_mctx, &ns_g_server); ns_server_create(ns_g_mctx, &ns_g_server);
} }
@@ -691,6 +708,13 @@ cleanup(void) {
*/ */
/* xxdb_clear(); */ /* xxdb_clear(); */
#ifdef DLZ
/*
* Unregister any DLZ drivers.
*/
dlz_drivers_clear();
#endif
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
ISC_LOG_NOTICE, "exiting"); ISC_LOG_NOTICE, "exiting");
ns_log_shutdown(); ns_log_shutdown();

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: query.c,v 1.272 2005/08/18 00:57:26 marka Exp $ */ /* $Id: query.c,v 1.273 2005/09/05 00:10:52 marka Exp $ */
/*! \file */ /*! \file */
@@ -29,6 +29,9 @@
#include <dns/adb.h> #include <dns/adb.h>
#include <dns/byaddr.h> #include <dns/byaddr.h>
#include <dns/db.h> #include <dns/db.h>
#ifdef DLZ
#include <dns/dlz.h>
#endif
#include <dns/events.h> #include <dns/events.h>
#include <dns/message.h> #include <dns/message.h>
#include <dns/ncache.h> #include <dns/ncache.h>
@@ -508,7 +511,7 @@ ns_query_init(ns_client_t *client) {
client->query.authdb = NULL; client->query.authdb = NULL;
client->query.authzone = NULL; client->query.authzone = NULL;
client->query.authdbset = ISC_FALSE; client->query.authdbset = ISC_FALSE;
client->query.isreferral = ISC_FALSE; client->query.isreferral = ISC_FALSE;
query_reset(client, ISC_FALSE); query_reset(client, ISC_FALSE);
result = query_newdbversion(client, 3); result = query_newdbversion(client, 3);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
@@ -577,7 +580,7 @@ query_validatezonedb(ns_client_t *client, dns_name_t *name,
/* /*
* This limits our searching to the zone where the first name * This limits our searching to the zone where the first name
* (the query target) was looked for. This prevents following * (the query target) was looked for. This prevents following
* CNAMES or DNAMES into other zones and prevents returning * CNAMES or DNAMES into other zones and prevents returning
* additional data from other zones. * additional data from other zones.
*/ */
if (!client->view->additionalfromauth && if (!client->view->additionalfromauth &&
@@ -654,7 +657,7 @@ query_validatezonedb(ns_client_t *client, dns_name_t *name,
ISC_LOG_DEBUG(3), ISC_LOG_DEBUG(3),
"%s approved", msg); "%s approved", msg);
} }
} else { } else {
ns_client_aclmsg("query", name, qtype, ns_client_aclmsg("query", name, qtype,
client->view->rdclass, client->view->rdclass,
msg, sizeof(msg)); msg, sizeof(msg));
@@ -733,7 +736,7 @@ query_getzonedb(ns_client_t *client, dns_name_t *name, dns_rdatatype_t qtype,
if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH)
result = dns_zone_getdb(zone, &db); result = dns_zone_getdb(zone, &db);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
goto fail; goto fail;
result = query_validatezonedb(client, name, qtype, options, zone, db, result = query_validatezonedb(client, name, qtype, options, zone, db,
@@ -801,7 +804,7 @@ query_getcachedb(ns_client_t *client, dns_name_t *name, dns_rdatatype_t qtype,
if (check_acl) { if (check_acl) {
isc_boolean_t log = ISC_TF((options & DNS_GETDB_NOLOG) == 0); isc_boolean_t log = ISC_TF((options & DNS_GETDB_NOLOG) == 0);
char msg[NS_CLIENT_ACLMSGSIZE("query (cache)")]; char msg[NS_CLIENT_ACLMSGSIZE("query (cache)")];
result = ns_client_checkaclsilent(client, result = ns_client_checkaclsilent(client,
client->view->queryacl, client->view->queryacl,
ISC_TRUE); ISC_TRUE);
@@ -867,9 +870,85 @@ query_getdb(ns_client_t *client, dns_name_t *name, dns_rdatatype_t qtype,
{ {
isc_result_t result; isc_result_t result;
#ifdef DLZ
isc_result_t tresult;
unsigned int namelabels;
unsigned int zonelabels;
dns_zone_t *zone = NULL;
dns_db_t *tdbp;
REQUIRE(zonep != NULL && *zonep == NULL);
tdbp = NULL;
/* Calculate how many labels are in name. */
namelabels = dns_name_countlabels(name);
zonelabels = 0;
/* Try to find name in bind's standard database. */
result = query_getzonedb(client, name, qtype, options, &zone,
dbp, versionp);
/* See how many labels are in the zone's name. */
if (result == ISC_R_SUCCESS && zone != NULL)
zonelabels = dns_name_countlabels(dns_zone_getorigin(zone));
/*
* If # zone labels < # name labels, try to find an even better match
* Only try if a DLZ driver is loaded for this view
*/
if (zonelabels < namelabels && client->view->dlzdatabase != NULL) {
tresult = dns_dlzfindzone(client->view, name,
zonelabels, &tdbp);
/* If we successful, we found a better match. */
if (tresult == ISC_R_SUCCESS) {
/*
* If the previous search returned a zone, detach it.
*/
if (zone != NULL)
dns_zone_detach(&zone);
/*
* If the previous search returned a database,
* detach it.
*/
if (*dbp != NULL)
dns_db_detach(dbp);
/*
* If the previous search returned a version, clear it.
*/
*versionp = NULL;
/*
* Get our database version.
*/
dns_db_currentversion(tdbp, versionp);
/*
* Be sure to return our database.
*/
*dbp = tdbp;
/*
* We return a null zone, No stats for DLZ zones.
*/
zone = NULL;
result = tresult;
}
}
#else
result = query_getzonedb(client, name, qtype, options, result = query_getzonedb(client, name, qtype, options,
zonep, dbp, versionp); zonep, dbp, versionp);
#endif
/* If successfull, Transfer ownership of zone. */
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
#ifdef DLZ
*zonep = zone;
#endif
/*
* If neither attempt above succeeded, return the cache instead
*/
*is_zonep = ISC_TRUE; *is_zonep = ISC_TRUE;
} else if (result == ISC_R_NOTFOUND) { } else if (result == ISC_R_NOTFOUND) {
result = query_getcachedb(client, name, qtype, dbp, options); result = query_getcachedb(client, name, qtype, dbp, options);
@@ -1032,7 +1111,7 @@ query_addadditional(void *arg, dns_name_t *name, dns_rdatatype_t qtype) {
*/ */
goto try_glue; goto try_glue;
result = dns_db_find(db, name, version, type, client->query.dboptions, result = dns_db_find(db, name, version, type, client->query.dboptions,
client->now, &node, fname, rdataset, client->now, &node, fname, rdataset,
sigrdataset); sigrdataset);
if (result == ISC_R_SUCCESS) if (result == ISC_R_SUCCESS)
@@ -1248,7 +1327,7 @@ query_addadditional(void *arg, dns_name_t *name, dns_rdatatype_t qtype) {
* recursing to add address records, which in turn can cause * recursing to add address records, which in turn can cause
* recursion to add KEYs. * recursion to add KEYs.
*/ */
if (type == dns_rdatatype_srv && trdataset != NULL) { if (type == dns_rdatatype_srv && trdataset != NULL) {
/* /*
* If we're adding SRV records to the additional data * If we're adding SRV records to the additional data
* section, it's helpful if we add the SRV additional data * section, it's helpful if we add the SRV additional data
@@ -1325,7 +1404,7 @@ query_iscachevalid(dns_zone_t *zone, dns_db_t *db, dns_db_t *db0,
dns_db_closeversion(db_current, &version_current, ISC_FALSE); dns_db_closeversion(db_current, &version_current, ISC_FALSE);
if (db0 == NULL && db_current != NULL) if (db0 == NULL && db_current != NULL)
dns_db_detach(&db_current); dns_db_detach(&db_current);
return (result); return (result);
} }
@@ -1391,7 +1470,7 @@ query_addadditional2(void *arg, dns_name_t *name, dns_rdatatype_t qtype) {
* lookup and iterate over the node. * lookup and iterate over the node.
* XXXJT: this approach can cause a suboptimal result when the cache * XXXJT: this approach can cause a suboptimal result when the cache
* DB only has partial address types and the glue DB has remaining * DB only has partial address types and the glue DB has remaining
* ones. * ones.
*/ */
type = dns_rdatatype_any; type = dns_rdatatype_any;
@@ -1682,7 +1761,7 @@ query_addadditional2(void *arg, dns_name_t *name, dns_rdatatype_t qtype) {
setcache: setcache:
/* /*
* Set the new result in the cache if required. We do not support * Set the new result in the cache if required. We do not support
* caching additional data from a cache DB. * caching additional data from a cache DB.
*/ */
if (needadditionalcache == ISC_TRUE && if (needadditionalcache == ISC_TRUE &&
(additionaltype == dns_rdatasetadditional_fromauth || (additionaltype == dns_rdatasetadditional_fromauth ||
@@ -2429,20 +2508,20 @@ query_addwildcardproof(ns_client_t *client, dns_db_t *db,
* Given: * Given:
* example SOA * example SOA
* example NSEC b.example * example NSEC b.example
* b.example A * b.example A
* b.example NSEC a.d.example * b.example NSEC a.d.example
* a.d.example A * a.d.example A
* a.d.example NSEC g.f.example * a.d.example NSEC g.f.example
* g.f.example A * g.f.example A
* g.f.example NSEC z.i.example * g.f.example NSEC z.i.example
* z.i.example A * z.i.example A
* z.i.example NSEC example * z.i.example NSEC example
* *
* QNAME: * QNAME:
* a.example -> example NSEC b.example * a.example -> example NSEC b.example
* owner common example * owner common example
* next common example * next common example
* wild *.example * wild *.example
* d.b.example -> b.example NSEC a.d.example * d.b.example -> b.example NSEC a.d.example
* owner common b.example * owner common b.example
* next common example * next common example
@@ -2453,7 +2532,7 @@ query_addwildcardproof(ns_client_t *client, dns_db_t *db,
* wild *.f.example * wild *.f.example
* j.example -> z.i.example NSEC example * j.example -> z.i.example NSEC example
* owner common example * owner common example
* next common example * next common example
* wild *.f.example * wild *.f.example
*/ */
options = client->query.dboptions | DNS_DBFIND_NOWILD; options = client->query.dboptions | DNS_DBFIND_NOWILD;
@@ -2514,7 +2593,7 @@ query_addwildcardproof(ns_client_t *client, dns_db_t *db,
name = wname; name = wname;
goto again; goto again;
} }
} }
cleanup: cleanup:
if (rdataset != NULL) if (rdataset != NULL)
query_putrdataset(client, &rdataset); query_putrdataset(client, &rdataset);
@@ -2777,7 +2856,7 @@ static isc_result_t
rdata_tonetaddr(dns_rdata_t *rdata, isc_netaddr_t *netaddr) { rdata_tonetaddr(dns_rdata_t *rdata, isc_netaddr_t *netaddr) {
struct in_addr ina; struct in_addr ina;
struct in6_addr in6a; struct in6_addr in6a;
switch (rdata->type) { switch (rdata->type) {
case dns_rdatatype_a: case dns_rdatatype_a:
INSIST(rdata->length == 4); INSIST(rdata->length == 4);
@@ -2830,7 +2909,7 @@ setup_query_sortlist(ns_client_t *client) {
isc_netaddr_t netaddr; isc_netaddr_t netaddr;
dns_rdatasetorderfunc_t order = NULL; dns_rdatasetorderfunc_t order = NULL;
void *order_arg = NULL; void *order_arg = NULL;
isc_netaddr_fromsockaddr(&netaddr, &client->peeraddr); isc_netaddr_fromsockaddr(&netaddr, &client->peeraddr);
switch (ns_sortlist_setup(client->view->sortlist, switch (ns_sortlist_setup(client->view->sortlist,
&netaddr, &order_arg)) { &netaddr, &order_arg)) {
@@ -3121,7 +3200,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
goto resume; goto resume;
} }
/* /*
* Not returning from recursion. * Not returning from recursion.
*/ */
@@ -3216,7 +3295,17 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
if (event == NULL && client->query.restarts == 0) { if (event == NULL && client->query.restarts == 0) {
if (is_zone) { if (is_zone) {
dns_zone_attach(zone, &client->query.authzone); #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); dns_db_attach(db, &client->query.authdb);
} }
client->query.authdbset = ISC_TRUE; client->query.authdbset = ISC_TRUE;
@@ -4131,10 +4220,10 @@ ns_query_start(ns_client_t *client) {
if ((message->flags & DNS_MESSAGEFLAG_RD) != 0) if ((message->flags & DNS_MESSAGEFLAG_RD) != 0)
client->query.attributes |= NS_QUERYATTR_WANTRECURSION; client->query.attributes |= NS_QUERYATTR_WANTRECURSION;
if ((client->extflags & DNS_MESSAGEEXTFLAG_DO) != 0) if ((client->extflags & DNS_MESSAGEEXTFLAG_DO) != 0)
client->attributes |= NS_CLIENTATTR_WANTDNSSEC; client->attributes |= NS_CLIENTATTR_WANTDNSSEC;
if (client->view->minimalresponses) if (client->view->minimalresponses)
client->query.attributes |= (NS_QUERYATTR_NOAUTHORITY | client->query.attributes |= (NS_QUERYATTR_NOAUTHORITY |
NS_QUERYATTR_NOADDITIONAL); NS_QUERYATTR_NOADDITIONAL);

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: server.c,v 1.449 2005/08/23 02:36:07 marka Exp $ */ /* $Id: server.c,v 1.450 2005/09/05 00:10:52 marka Exp $ */
/*! \file */ /*! \file */
@@ -48,6 +48,9 @@
#include <dns/cache.h> #include <dns/cache.h>
#include <dns/db.h> #include <dns/db.h>
#include <dns/dispatch.h> #include <dns/dispatch.h>
#ifdef DLZ
#include <dns/dlz.h>
#endif
#include <dns/forward.h> #include <dns/forward.h>
#include <dns/journal.h> #include <dns/journal.h>
#include <dns/keytable.h> #include <dns/keytable.h>
@@ -826,6 +829,11 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
cfg_obj_t *forwarders; cfg_obj_t *forwarders;
cfg_obj_t *alternates; cfg_obj_t *alternates;
cfg_obj_t *zonelist; cfg_obj_t *zonelist;
#ifdef DLZ
cfg_obj_t *dlz;
unsigned int dlzargc;
char **dlzargv;
#endif
cfg_obj_t *disabled; cfg_obj_t *disabled;
cfg_obj_t *obj; cfg_obj_t *obj;
cfg_listelt_t *element; cfg_listelt_t *element;
@@ -954,6 +962,45 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
actx)); actx));
} }
#ifdef DLZ
/*
* Create Dynamically Loadable Zone driver.
*/
dlz = NULL;
if (voptions != NULL)
(void)cfg_map_get(voptions, "dlz", &dlz);
else
(void)cfg_map_get(config, "dlz", &dlz);
obj = NULL;
if (dlz != NULL) {
(void)cfg_map_get(cfg_tuple_get(dlz, "options"),
"database", &obj);
if (obj != NULL) {
char *s = isc_mem_strdup(mctx, cfg_obj_asstring(obj));
if (s == NULL) {
result = ISC_R_NOMEMORY;
goto cleanup;
}
result = dns_dlzstrtoargv(mctx, s, &dlzargc, &dlzargv);
if (result != ISC_R_SUCCESS) {
isc_mem_free(mctx, s);
goto cleanup;
}
obj = cfg_tuple_get(dlz, "name");
result = dns_dlzcreate(mctx, cfg_obj_asstring(obj),
dlzargv[0], dlzargc, dlzargv,
&view->dlzdatabase);
isc_mem_free(mctx, s);
isc_mem_put(mctx, dlzargv, dlzargc * sizeof(*dlzargv));
if (result == ISC_R_SUCCESS)
goto cleanup;
}
}
#endif
/* /*
* Configure the view's cache. Try to reuse an existing * Configure the view's cache. Try to reuse an existing
* cache if possible, otherwise create a new cache. * cache if possible, otherwise create a new cache.

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: xfrout.c,v 1.119 2005/04/27 04:55:55 sra Exp $ */ /* $Id: xfrout.c,v 1.120 2005/09/05 00:10:53 marka Exp $ */
#include <config.h> #include <config.h>
@@ -27,6 +27,9 @@
#include <dns/db.h> #include <dns/db.h>
#include <dns/dbiterator.h> #include <dns/dbiterator.h>
#ifdef DLZ
#include <dns/dlz.h>
#endif
#include <dns/fixedname.h> #include <dns/fixedname.h>
#include <dns/journal.h> #include <dns/journal.h>
#include <dns/message.h> #include <dns/message.h>
@@ -905,6 +908,9 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) {
char msg[NS_CLIENT_ACLMSGSIZE("zone transfer")]; char msg[NS_CLIENT_ACLMSGSIZE("zone transfer")];
char keyname[DNS_NAME_FORMATSIZE]; char keyname[DNS_NAME_FORMATSIZE];
isc_boolean_t is_poll = ISC_FALSE; isc_boolean_t is_poll = ISC_FALSE;
#ifdef DLZ
isc_boolean_t is_dlz = ISC_FALSE;
#endif
switch (reqtype) { switch (reqtype) {
case dns_rdatatype_axfr: case dns_rdatatype_axfr:
@@ -955,19 +961,71 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) {
result = dns_zt_find(client->view->zonetable, question_name, 0, NULL, result = dns_zt_find(client->view->zonetable, question_name, 0, NULL,
&zone); &zone);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
FAILQ(DNS_R_NOTAUTH, "non-authoritative zone", #ifdef DLZ
question_name, question_class); {
switch(dns_zone_gettype(zone)) { /*
case dns_zone_master: * Normal zone table does not have a match. Try the DLZ database
case dns_zone_slave: */
break; /* Master and slave zones are OK for transfer. */ if (client->view->dlzdatabase != NULL) {
default: result = dns_dlzallowzonexfr(client->view,
FAILQ(DNS_R_NOTAUTH, "non-authoritative zone", question_name, &client->peeraddr,
question_name, question_class); &db);
if (result == ISC_R_NOPERM) {
char _buf1[DNS_NAME_FORMATSIZE];
char _buf2[DNS_RDATACLASS_FORMATSIZE];
result = DNS_R_REFUSED;
dns_name_format(question_name, _buf1,
sizeof(_buf1));
dns_rdataclass_format(question_class,
_buf2, sizeof(_buf2));
ns_client_log(client, DNS_LOGCATEGORY_SECURITY,
NS_LOGMODULE_XFER_OUT,
ISC_LOG_ERROR,
"zone transfer '%s/%s' denied",
_buf1, _buf2);
goto failure;
}
if (result != ISC_R_SUCCESS)
#endif
FAILQ(DNS_R_NOTAUTH, "non-authoritative zone",
question_name, question_class);
#ifdef DLZ
is_dlz = ISC_TRUE;
/*
* DLZ only support full zone transfer, not incremental
*/
if (reqtype != dns_rdatatype_axfr) {
mnemonic = "AXFR-style IXFR";
reqtype = dns_rdatatype_axfr;
}
} else {
/*
* not DLZ and not in normal zone table, we are
* not authoritative
*/
FAILQ(DNS_R_NOTAUTH, "non-authoritative zone",
question_name, question_class);
}
} else {
/* zone table has a match */
#endif
switch(dns_zone_gettype(zone)) {
case dns_zone_master:
case dns_zone_slave:
break; /* Master and slave zones are OK for transfer. */
default:
FAILQ(DNS_R_NOTAUTH, "non-authoritative zone", question_name, question_class);
}
CHECK(dns_zone_getdb(zone, &db));
dns_db_currentversion(db, &ver);
#ifdef DLZ
} }
CHECK(dns_zone_getdb(zone, &db)); #endif
dns_db_currentversion(db, &ver);
xfrout_log1(client, question_name, question_class, ISC_LOG_DEBUG(6), xfrout_log1(client, question_name, question_class, ISC_LOG_DEBUG(6),
"%s question section OK", mnemonic); "%s question section OK", mnemonic);
@@ -1023,11 +1081,20 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) {
/* /*
* Decide whether to allow this transfer. * Decide whether to allow this transfer.
*/ */
ns_client_aclmsg("zone transfer", question_name, reqtype, #ifdef DLZ
client->view->rdclass, msg, sizeof(msg)); /*
CHECK(ns_client_checkacl(client, msg, * if not a DLZ zone decide whether to allow this transfer.
dns_zone_getxfracl(zone), ISC_TRUE, */
ISC_LOG_ERROR)); if (!is_dlz) {
#endif
ns_client_aclmsg("zone transfer", question_name, reqtype,
client->view->rdclass, msg, sizeof(msg));
CHECK(ns_client_checkacl(client, msg,
dns_zone_getxfracl(zone), ISC_TRUE,
ISC_LOG_ERROR));
#ifdef DLZ
}
#endif
/* /*
* AXFR over UDP is not possible. * AXFR over UDP is not possible.
@@ -1051,6 +1118,10 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) {
/* /*
* Get a dynamically allocated copy of the current SOA. * 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, CHECK(dns_db_createsoatuple(db, ver, mctx, DNS_DIFFOP_EXISTS,
&current_soa_tuple)); &current_soa_tuple));
@@ -1133,15 +1204,32 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) {
* Create the xfrout context object. This transfers the ownership * Create the xfrout context object. This transfers the ownership
* of "stream", "db", "ver", and "quota" to the xfrout context object. * of "stream", "db", "ver", and "quota" to the xfrout context object.
*/ */
CHECK(xfrout_ctx_create(mctx, client, request->id, question_name,
reqtype, question_class, db, ver, quota,
stream, dns_message_gettsigkey(request),
tsigbuf, #ifdef DLZ
dns_zone_getmaxxfrout(zone), if (is_dlz)
dns_zone_getidleout(zone), CHECK(xfrout_ctx_create(mctx, client, request->id, question_name,
(format == dns_many_answers) ? reqtype, question_class, db, ver, quota,
ISC_TRUE : ISC_FALSE, stream, dns_message_gettsigkey(request),
&xfr)); tsigbuf,
3600,
3600,
(format == dns_many_answers) ?
ISC_TRUE : ISC_FALSE,
&xfr));
else
#endif
CHECK(xfrout_ctx_create(mctx, client, request->id, question_name,
reqtype, question_class, db, ver, quota,
stream, dns_message_gettsigkey(request),
tsigbuf,
dns_zone_getmaxxfrout(zone),
dns_zone_getidleout(zone),
(format == dns_many_answers) ?
ISC_TRUE : ISC_FALSE,
&xfr));
xfr->mnemonic = mnemonic; xfr->mnemonic = mnemonic;
stream = NULL; stream = NULL;
quota = NULL; quota = NULL;

View File

@@ -15,7 +15,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE. # PERFORMANCE OF THIS SOFTWARE.
# $Id: conf.sh.in,v 1.32 2005/07/27 04:12:00 marka Exp $ # $Id: conf.sh.in,v 1.33 2005/09/05 00:10:53 marka Exp $
# #
# Common configuration data for system tests, to be sourced into # Common configuration data for system tests, to be sourced into
@@ -43,8 +43,8 @@ CHECKCONF=$TOP/bin/check/named-checkconf
# The "stress" test is not run by default since it creates enough # The "stress" test is not run by default since it creates enough
# load on the machine to make it unusable to other users. # load on the machine to make it unusable to other users.
# v6synth # v6synth
SUBDIRS="cacheclean checkconf checknames dnssec forward glue ixfr limits \ SUBDIRS="cacheclean checkconf checknames dnssec forward glue ixfr limits
lwresd masterfile masterformat notify nsupdate resolver sortlist stub \ lwresd masterfile masterformat notify nsupdate resolver sortlist stub
tkey unknown upforwd views xfer xferquota zonechecks" tkey unknown upforwd views xfer xferquota zonechecks"
# PERL will be an empty string if no perl interpreter was found. # PERL will be an empty string if no perl interpreter was found.

775
configure vendored
View File

@@ -14,7 +14,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE. # PERFORMANCE OF THIS SOFTWARE.
# #
# $Id: configure,v 1.380 2005/09/01 03:36:18 marka Exp $ # $Id: configure,v 1.381 2005/09/05 00:12:29 marka Exp $
# #
# Portions Copyright (C) 1996-2001 Nominum, Inc. # Portions Copyright (C) 1996-2001 Nominum, Inc.
# #
@@ -29,7 +29,7 @@
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# From configure.in Revision: 1.391 . # From configure.in Revision: 1.392 .
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59. # Generated by GNU Autoconf 2.59.
# #
@@ -495,8 +495,8 @@ ac_includes_default="\
# include <unistd.h> # include <unistd.h>
#endif" #endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS subdirs build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE RANLIB ac_ct_RANLIB INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S STD_CINCLUDES STD_CDEFINES STD_CWARNINGS CCOPT AR ARFLAGS LN ETAGS PERL CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP ISC_SOCKADDR_LEN_T ISC_PLATFORM_HAVELONGLONG ISC_PLATFORM_HAVELIFCONF ISC_PLATFORM_NEEDSYSSELECTH LWRES_PLATFORM_NEEDSYSSELECTH USE_OPENSSL DST_OPENSSL_INC USE_GSSAPI DST_GSSAPI_INC DNS_CRYPTO_LIBS ALWAYS_DEFINES ISC_PLATFORM_USETHREADS ISC_THREAD_DIR MKDEPCC MKDEPCFLAGS MKDEPPROG IRIX_DNSSEC_WARNINGS_HACK purify_path PURIFY ECHO ac_ct_AR STRIP ac_ct_STRIP CXX CXXFLAGS ac_ct_CXX CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL O A SA LIBTOOL_MKDEP_SED LIBTOOL_MODE_COMPILE LIBTOOL_MODE_INSTALL LIBTOOL_MODE_LINK LIBTOOL_ALLOW_UNDEFINED LIBTOOL_IN_MAIN LIBBIND ISC_PLATFORM_HAVEIPV6 LWRES_PLATFORM_HAVEIPV6 ISC_PLATFORM_NEEDNETINETIN6H LWRES_PLATFORM_NEEDNETINETIN6H ISC_PLATFORM_NEEDNETINET6IN6H LWRES_PLATFORM_NEEDNETINET6IN6H ISC_PLATFORM_HAVEINADDR6 LWRES_PLATFORM_HAVEINADDR6 ISC_PLATFORM_NEEDIN6ADDRANY LWRES_PLATFORM_NEEDIN6ADDRANY ISC_PLATFORM_NEEDIN6ADDRLOOPBACK LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK ISC_PLATFORM_HAVEIN6PKTINFO ISC_PLATFORM_FIXIN6ISADDR ISC_IPV6_H ISC_IPV6_O ISC_ISCIPV6_O ISC_IPV6_C LWRES_HAVE_SIN6_SCOPE_ID ISC_PLATFORM_HAVESCOPEID ISC_PLATFORM_HAVEIF_LADDRREQ ISC_PLATFORM_HAVEIF_LADDRCONF ISC_PLATFORM_NEEDNTOP ISC_PLATFORM_NEEDPTON ISC_PLATFORM_NEEDATON ISC_PLATFORM_HAVESALEN LWRES_PLATFORM_HAVESALEN ISC_PLATFORM_MSGHDRFLAVOR ISC_PLATFORM_NEEDPORTT ISC_LWRES_NEEDADDRINFO ISC_LWRES_NEEDRRSETINFO ISC_LWRES_SETHOSTENTINT ISC_LWRES_ENDHOSTENTINT ISC_LWRES_GETNETBYADDRINADDR ISC_LWRES_SETNETENTINT ISC_LWRES_ENDNETENTINT ISC_LWRES_GETHOSTBYADDRVOID ISC_LWRES_NEEDHERRNO ISC_LWRES_GETIPNODEPROTO ISC_LWRES_GETADDRINFOPROTO ISC_LWRES_GETNAMEINFOPROTO ISC_PLATFORM_NEEDSTRSEP ISC_PLATFORM_NEEDMEMMOVE ISC_PLATFORM_NEEDSTRTOUL LWRES_PLATFORM_NEEDSTRTOUL GENRANDOMLIB ISC_PLATFORM_NEEDSTRLCPY ISC_PLATFORM_NEEDSTRLCAT ISC_PLATFORM_NEEDSPRINTF LWRES_PLATFORM_NEEDSPRINTF ISC_PLATFORM_NEEDVSNPRINTF LWRES_PLATFORM_NEEDVSNPRINTF ISC_EXTRA_OBJS ISC_EXTRA_SRCS ISC_PLATFORM_QUADFORMAT LWRES_PLATFORM_QUADFORMAT ISC_PLATFORM_HAVESYSUNH ISC_PLATFORM_RLIMITTYPE ISC_PLATFORM_USEDECLSPEC LWRES_PLATFORM_USEDECLSPEC ISC_PLATFORM_BRACEPTHREADONCEINIT ISC_PLATFORM_HAVEIFNAMETOINDEX ISC_PLATFORM_HAVEXADD ISC_PLATFORM_HAVECMPXCHG ISC_PLATFORM_HAVEATOMICSTORE ISC_PLATFORM_USEGCCASM ISC_PLATFORM_USEOSFASM ISC_PLATFORM_USESTDASM ISC_ARCH_DIR LATEX PDFLATEX W3M XSLTPROC XMLLINT XSLT_DOCBOOK_STYLE_HTML XSLT_DOCBOOK_STYLE_XHTML XSLT_DOCBOOK_STYLE_MAN XSLT_DOCBOOK_CHUNK_HTML XSLT_DOCBOOK_CHUNK_XHTML XSLT_DOCBOOK_CHUNKTOC_HTML XSLT_DOCBOOK_CHUNKTOC_XHTML XSLT_DOCBOOK_MAKETOC_HTML XSLT_DOCBOOK_MAKETOC_XHTML XSLT_DB2LATEX_STYLE XSLT_DB2LATEX_ADMONITIONS BIND9_TOP_BUILDDIR BIND9_ISC_BUILDINCLUDE BIND9_ISCCC_BUILDINCLUDE BIND9_ISCCFG_BUILDINCLUDE BIND9_DNS_BUILDINCLUDE BIND9_LWRES_BUILDINCLUDE BIND9_BIND9_BUILDINCLUDE BIND9_VERSION LIBOBJS LTLIBOBJS' ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS subdirs build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE RANLIB ac_ct_RANLIB INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S STD_CINCLUDES STD_CDEFINES STD_CWARNINGS CCOPT AR ARFLAGS LN ETAGS PERL CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP ISC_SOCKADDR_LEN_T ISC_PLATFORM_HAVELONGLONG ISC_PLATFORM_HAVELIFCONF ISC_PLATFORM_NEEDSYSSELECTH LWRES_PLATFORM_NEEDSYSSELECTH USE_OPENSSL DST_OPENSSL_INC USE_GSSAPI DST_GSSAPI_INC DNS_CRYPTO_LIBS ALWAYS_DEFINES ISC_PLATFORM_USETHREADS ISC_THREAD_DIR MKDEPCC MKDEPCFLAGS MKDEPPROG IRIX_DNSSEC_WARNINGS_HACK purify_path PURIFY ECHO ac_ct_AR STRIP ac_ct_STRIP CXX CXXFLAGS ac_ct_CXX CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL O A SA LIBTOOL_MKDEP_SED LIBTOOL_MODE_COMPILE LIBTOOL_MODE_INSTALL LIBTOOL_MODE_LINK LIBTOOL_ALLOW_UNDEFINED LIBTOOL_IN_MAIN LIBBIND ISC_PLATFORM_HAVEIPV6 LWRES_PLATFORM_HAVEIPV6 ISC_PLATFORM_NEEDNETINETIN6H LWRES_PLATFORM_NEEDNETINETIN6H ISC_PLATFORM_NEEDNETINET6IN6H LWRES_PLATFORM_NEEDNETINET6IN6H ISC_PLATFORM_HAVEINADDR6 LWRES_PLATFORM_HAVEINADDR6 ISC_PLATFORM_NEEDIN6ADDRANY LWRES_PLATFORM_NEEDIN6ADDRANY ISC_PLATFORM_NEEDIN6ADDRLOOPBACK LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK ISC_PLATFORM_HAVEIN6PKTINFO ISC_PLATFORM_FIXIN6ISADDR ISC_IPV6_H ISC_IPV6_O ISC_ISCIPV6_O ISC_IPV6_C LWRES_HAVE_SIN6_SCOPE_ID ISC_PLATFORM_HAVESCOPEID ISC_PLATFORM_HAVEIF_LADDRREQ ISC_PLATFORM_HAVEIF_LADDRCONF ISC_PLATFORM_NEEDNTOP ISC_PLATFORM_NEEDPTON ISC_PLATFORM_NEEDATON ISC_PLATFORM_HAVESALEN LWRES_PLATFORM_HAVESALEN ISC_PLATFORM_MSGHDRFLAVOR ISC_PLATFORM_NEEDPORTT ISC_LWRES_NEEDADDRINFO ISC_LWRES_NEEDRRSETINFO ISC_LWRES_SETHOSTENTINT ISC_LWRES_ENDHOSTENTINT ISC_LWRES_GETNETBYADDRINADDR ISC_LWRES_SETNETENTINT ISC_LWRES_ENDNETENTINT ISC_LWRES_GETHOSTBYADDRVOID ISC_LWRES_NEEDHERRNO ISC_LWRES_GETIPNODEPROTO ISC_LWRES_GETADDRINFOPROTO ISC_LWRES_GETNAMEINFOPROTO ISC_PLATFORM_NEEDSTRSEP ISC_PLATFORM_NEEDMEMMOVE ISC_PLATFORM_NEEDSTRTOUL LWRES_PLATFORM_NEEDSTRTOUL GENRANDOMLIB ISC_PLATFORM_NEEDSTRLCPY ISC_PLATFORM_NEEDSTRLCAT ISC_PLATFORM_NEEDSPRINTF LWRES_PLATFORM_NEEDSPRINTF ISC_PLATFORM_NEEDVSNPRINTF LWRES_PLATFORM_NEEDVSNPRINTF ISC_EXTRA_OBJS ISC_EXTRA_SRCS ISC_PLATFORM_QUADFORMAT LWRES_PLATFORM_QUADFORMAT ISC_PLATFORM_HAVESYSUNH ISC_PLATFORM_RLIMITTYPE ISC_PLATFORM_USEDECLSPEC LWRES_PLATFORM_USEDECLSPEC ISC_PLATFORM_BRACEPTHREADONCEINIT ISC_PLATFORM_HAVEIFNAMETOINDEX ISC_PLATFORM_HAVEXADD ISC_PLATFORM_HAVECMPXCHG ISC_PLATFORM_HAVEATOMICSTORE ISC_PLATFORM_USEGCCASM ISC_PLATFORM_USEOSFASM ISC_PLATFORM_USESTDASM ISC_ARCH_DIR LATEX PDFLATEX W3M XSLTPROC XMLLINT XSLT_DOCBOOK_STYLE_HTML XSLT_DOCBOOK_STYLE_XHTML XSLT_DOCBOOK_STYLE_MAN XSLT_DOCBOOK_CHUNK_HTML XSLT_DOCBOOK_CHUNK_XHTML XSLT_DOCBOOK_CHUNKTOC_HTML XSLT_DOCBOOK_CHUNKTOC_XHTML XSLT_DOCBOOK_MAKETOC_HTML XSLT_DOCBOOK_MAKETOC_XHTML XSLT_DB2LATEX_STYLE XSLT_DB2LATEX_ADMONITIONS BIND9_TOP_BUILDDIR BIND9_ISC_BUILDINCLUDE BIND9_ISCCC_BUILDINCLUDE BIND9_ISCCFG_BUILDINCLUDE BIND9_DNS_BUILDINCLUDE BIND9_LWRES_BUILDINCLUDE BIND9_BIND9_BUILDINCLUDE BIND9_VERSION PG_CONFIG USE_DLZ DLZ_DRIVER_INCLUDES DLZ_DRIVER_LIBS DLZ_DRIVER_SRCS DLZ_DRIVER_OBJS LIBOBJS LTLIBOBJS'
ac_subst_files='BIND9_MAKE_INCLUDES BIND9_MAKE_RULES LIBISC_API LIBISCCC_API LIBISCCFG_API LIBDNS_API LIBBIND9_API LIBLWRES_API' ac_subst_files='BIND9_MAKE_INCLUDES BIND9_MAKE_RULES LIBISC_API LIBISCCC_API LIBISCCFG_API LIBDNS_API LIBBIND9_API LIBLWRES_API DLZ_DRIVER_RULES'
# Initialize some variables set by options. # Initialize some variables set by options.
ac_init_help= ac_init_help=
@@ -1082,6 +1082,20 @@ Optional Packages:
--with-tags[=TAGS] --with-tags[=TAGS]
include additional configurations [automatic] include additional configurations [automatic]
--with-kame=PATH use Kame IPv6 default path /usr/local/v6 --with-kame=PATH use Kame IPv6 default path /usr/local/v6
--with-dlz-postgres=PATH Build with Postgres DLZ driver yes|no|path.
(Required to use Postgres with DLZ)
--with-dlz-mysql=PATH Build with MySQL DLZ driver yes|no|path.
(Required to use MySQL with DLZ)
--with-dlz-bdb=PATH Build with Berkeley DB DLZ driver yes|no|path.
(Required to use Berkeley DB with DLZ)
--with-dlz-filesystem=PATH Build with filesystem DLZ driver yes|no.
(Required to use file system driver with DLZ)
--with-dlz-ldap=PATH Build with LDAP DLZ driver yes|no|path.
(Required to use LDAP with DLZ)
--with-dlz-odbc=PATH Build with ODBC DLZ driver yes|no|path.
(Required to use ODBC with DLZ)
--with-dlz-stub=PATH Build with stub DLZ driver yes|no.
(Required to use stub driver with DLZ)
Some influential environment variables: Some influential environment variables:
CC C compiler command CC C compiler command
@@ -1829,6 +1843,14 @@ fi
#
# Make very sure that these are the first files processed by
# config.status, since we use the processed output as the input for
# AC_SUBST_FILE() subsitutions in other files.
#
ac_config_files="$ac_config_files make/rules make/includes"
# Extract the first word of "ar", so it can be a program name with args. # Extract the first word of "ar", so it can be a program name with args.
set dummy ar; ac_word=$2 set dummy ar; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5 echo "$as_me:$LINENO: checking for $ac_word" >&5
@@ -4815,6 +4837,7 @@ presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
esac esac
# #
# was --with-openssl specified? # was --with-openssl specified?
# #
@@ -8134,7 +8157,7 @@ ia64-*-hpux*)
;; ;;
*-*-irix6*) *-*-irix6*)
# Find out which ABI we are using. # Find out which ABI we are using.
echo '#line 8137 "configure"' > conftest.$ac_ext echo '#line 8160 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5 (eval $ac_compile) 2>&5
ac_status=$? ac_status=$?
@@ -9131,7 +9154,7 @@ fi
# Provide some information about the compiler. # Provide some information about the compiler.
echo "$as_me:9134:" \ echo "$as_me:9157:" \
"checking for Fortran 77 compiler version" >&5 "checking for Fortran 77 compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2` ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 { (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@@ -10192,11 +10215,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:10195: $lt_compile\"" >&5) (eval echo "\"\$as_me:10218: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err) (eval "$lt_compile" 2>conftest.err)
ac_status=$? ac_status=$?
cat conftest.err >&5 cat conftest.err >&5
echo "$as_me:10199: \$? = $ac_status" >&5 echo "$as_me:10222: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings # So say no if there are warnings
@@ -10435,11 +10458,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:10438: $lt_compile\"" >&5) (eval echo "\"\$as_me:10461: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err) (eval "$lt_compile" 2>conftest.err)
ac_status=$? ac_status=$?
cat conftest.err >&5 cat conftest.err >&5
echo "$as_me:10442: \$? = $ac_status" >&5 echo "$as_me:10465: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings # So say no if there are warnings
@@ -10495,11 +10518,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:10498: $lt_compile\"" >&5) (eval echo "\"\$as_me:10521: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err) (eval "$lt_compile" 2>out/conftest.err)
ac_status=$? ac_status=$?
cat out/conftest.err >&5 cat out/conftest.err >&5
echo "$as_me:10502: \$? = $ac_status" >&5 echo "$as_me:10525: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext if (exit $ac_status) && test -s out/conftest2.$ac_objext
then then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
@@ -12680,7 +12703,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 12683 "configure" #line 12706 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
@@ -12778,7 +12801,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 12781 "configure" #line 12804 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
@@ -14975,11 +14998,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:14978: $lt_compile\"" >&5) (eval echo "\"\$as_me:15001: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err) (eval "$lt_compile" 2>conftest.err)
ac_status=$? ac_status=$?
cat conftest.err >&5 cat conftest.err >&5
echo "$as_me:14982: \$? = $ac_status" >&5 echo "$as_me:15005: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings # So say no if there are warnings
@@ -15035,11 +15058,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:15038: $lt_compile\"" >&5) (eval echo "\"\$as_me:15061: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err) (eval "$lt_compile" 2>out/conftest.err)
ac_status=$? ac_status=$?
cat out/conftest.err >&5 cat out/conftest.err >&5
echo "$as_me:15042: \$? = $ac_status" >&5 echo "$as_me:15065: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext if (exit $ac_status) && test -s out/conftest2.$ac_objext
then then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
@@ -16396,7 +16419,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 16399 "configure" #line 16422 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
@@ -16494,7 +16517,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 16497 "configure" #line 16520 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
@@ -17331,11 +17354,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:17334: $lt_compile\"" >&5) (eval echo "\"\$as_me:17357: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err) (eval "$lt_compile" 2>conftest.err)
ac_status=$? ac_status=$?
cat conftest.err >&5 cat conftest.err >&5
echo "$as_me:17338: \$? = $ac_status" >&5 echo "$as_me:17361: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings # So say no if there are warnings
@@ -17391,11 +17414,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:17394: $lt_compile\"" >&5) (eval echo "\"\$as_me:17417: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err) (eval "$lt_compile" 2>out/conftest.err)
ac_status=$? ac_status=$?
cat out/conftest.err >&5 cat out/conftest.err >&5
echo "$as_me:17398: \$? = $ac_status" >&5 echo "$as_me:17421: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext if (exit $ac_status) && test -s out/conftest2.$ac_objext
then then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
@@ -19430,11 +19453,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:19433: $lt_compile\"" >&5) (eval echo "\"\$as_me:19456: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err) (eval "$lt_compile" 2>conftest.err)
ac_status=$? ac_status=$?
cat conftest.err >&5 cat conftest.err >&5
echo "$as_me:19437: \$? = $ac_status" >&5 echo "$as_me:19460: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings # So say no if there are warnings
@@ -19673,11 +19696,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:19676: $lt_compile\"" >&5) (eval echo "\"\$as_me:19699: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err) (eval "$lt_compile" 2>conftest.err)
ac_status=$? ac_status=$?
cat conftest.err >&5 cat conftest.err >&5
echo "$as_me:19680: \$? = $ac_status" >&5 echo "$as_me:19703: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings # So say no if there are warnings
@@ -19733,11 +19756,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:19736: $lt_compile\"" >&5) (eval echo "\"\$as_me:19759: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err) (eval "$lt_compile" 2>out/conftest.err)
ac_status=$? ac_status=$?
cat out/conftest.err >&5 cat out/conftest.err >&5
echo "$as_me:19740: \$? = $ac_status" >&5 echo "$as_me:19763: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext if (exit $ac_status) && test -s out/conftest2.$ac_objext
then then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
@@ -21918,7 +21941,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 21921 "configure" #line 21944 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
@@ -22016,7 +22039,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 22019 "configure" #line 22042 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
@@ -23092,6 +23115,7 @@ case "$enable_libbind" in
;; ;;
esac esac
# #
# Here begins a very long section to determine the system's networking # Here begins a very long section to determine the system's networking
# capabilities. The order of the tests is signficant. # capabilities. The order of the tests is signficant.
@@ -28390,6 +28414,673 @@ LIBBIND9_API=$srcdir/lib/bind9/api
LIBLWRES_API=$srcdir/lib/lwres/api LIBLWRES_API=$srcdir/lib/lwres/api
#
# 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.
#
# This section has to come after the libtool stuff because it needs to
# know how to name the driver object files.
#
USE_DLZ=""
DLZ_DRIVER_INCLUDES=""
DLZ_DRIVER_LIBS=""
DLZ_DRIVER_SRCS=""
DLZ_DRIVER_OBJS=""
# Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC")
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
#
# Shorthand. Note quoting: DLZ_DRIVER_DIR expanded in Makefile, not here.
#
dlzdir='${DLZ_DRIVER_DIR}'
#
# Private autoconf macro to simplify configuring drivers:
#
# DLZ_ADD_DRIVER(DEFINE, DRIVER, INCLUDES, LIBS)
#
# where:
# DEFINE is FOO (to define -DDLZ_FOO)
# DRIVER is dlz_foo_driver (sources without the .c)
# INCLUDES is any necessary include definitions
# LIBS is any necessary library definitions
#
#
# Check for the various DLZ drivers
#
#
# Was --with-dlz-postgres specified?
#
echo "$as_me:$LINENO: checking for Postgres DLZ driver" >&5
echo $ECHO_N "checking for Postgres DLZ driver... $ECHO_C" >&6
# Check whether --with-dlz_postgres or --without-dlz_postgres was given.
if test "${with_dlz_postgres+set}" = set; then
withval="$with_dlz_postgres"
use_dlz_postgres="$withval"
else
use_dlz_postgres="no"
fi;
if test "$use_dlz_postgres" = "yes"
then
# User did not specify a path - guess it
# Ask Postgres to tell us where it is
for ac_prog in pg_config
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_PG_CONFIG+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
case $PG_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_PG_CONFIG="$PG_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_PG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
;;
esac
fi
PG_CONFIG=$ac_cv_path_PG_CONFIG
if test -n "$PG_CONFIG"; then
echo "$as_me:$LINENO: result: $PG_CONFIG" >&5
echo "${ECHO_T}$PG_CONFIG" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
test -n "$PG_CONFIG" && break
done
test -n "$PG_CONFIG" || PG_CONFIG="not found"
if test "$PG_CONFIG" != "not found"
then
use_dlz_postgres=`$PG_CONFIG --includedir`
use_dlz_postgres_lib=`$PG_CONFIG --libdir`
fi
fi
if test "$use_dlz_postgres" = "yes"
then
# User did not specify path and Postgres didn't say - guess it
pgdirs="/usr /usr/local /usr/local/pgsql /usr/pkg"
for d in $pgdirs
do
if test -f $d/include/libpq-fe.h
then
use_dlz_postgres=$d/include
use_dlz_postgres_lib=$d/lib
break
fi
done
fi
if test "$use_dlz_postgres" = "yes"
then
# Still no joy, give up
echo "$as_me:$LINENO: result: not found" >&5
echo "${ECHO_T}not found" >&6
{ { echo "$as_me:$LINENO: error: No pg_config and PostgreSQL was not found in any of $pgdirs; use --with-dlz-postgres=/path or put pg_config in your path" >&5
echo "$as_me: error: No pg_config and PostgreSQL was not found in any of $pgdirs; use --with-dlz-postgres=/path or put pg_config in your path" >&2;}
{ (exit 1); exit 1; }; }
fi
case "$use_dlz_postgres" in
no)
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
;;
*)
USE_DLZ="$USE_DLZ -DDLZ_POSTGRES"
for i in dlz_postgres_driver
do
DLZ_DRIVER_SRCS="$DLZ_DRIVER_SRCS $dlzdir/$i.c"
DLZ_DRIVER_OBJS="$DLZ_DRIVER_OBJS $i.$O"
done
if test -n "-I$use_dlz_postgres"
then
DLZ_DRIVER_INCLUDES="$DLZ_DRIVER_INCLUDES -I$use_dlz_postgres"
fi
if test -n "-L$use_dlz_postgres_lib -lpq"
then
DLZ_DRIVER_LIBS="$DLZ_DRIVER_LIBS -L$use_dlz_postgres_lib -lpq"
fi
echo "$as_me:$LINENO: result: using PostgreSQL from $use_dlz_postgres_lib and $use_dlz_postgres" >&5
echo "${ECHO_T}using PostgreSQL from $use_dlz_postgres_lib and $use_dlz_postgres" >&6
;;
esac
#
# Was --with-dlz-mysql specified?
#
echo "$as_me:$LINENO: checking for MySQL DLZ driver" >&5
echo $ECHO_N "checking for MySQL DLZ driver... $ECHO_C" >&6
# Check whether --with-dlz_mysql or --without-dlz_mysql was given.
if test "${with_dlz_mysql+set}" = set; then
withval="$with_dlz_mysql"
use_dlz_mysql="$withval"
else
use_dlz_mysql="no"
fi;
if test "$use_dlz_mysql" = "yes"
then
# User did not specify a path - guess it
mysqldirs="/usr /usr/local /usr/local/mysql /usr/pkg"
for d in $mysqldirs
do
if test -f $d/include/mysql/mysql.h
then
use_dlz_mysql=$d
break
fi
done
fi
if test "$use_dlz_mysql" = "yes"
then
echo "$as_me:$LINENO: result: not found" >&5
echo "${ECHO_T}not found" >&6
{ { echo "$as_me:$LINENO: error: MySQL was not found in any of $mysqldirs; use --with-dlz-mysql=/path" >&5
echo "$as_me: error: MySQL was not found in any of $mysqldirs; use --with-dlz-mysql=/path" >&2;}
{ (exit 1); exit 1; }; }
fi
case "$use_dlz_mysql" in
no)
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
;;
*)
USE_DLZ="$USE_DLZ -DDLZ_MYSQL"
for i in dlz_mysql_driver
do
DLZ_DRIVER_SRCS="$DLZ_DRIVER_SRCS $dlzdir/$i.c"
DLZ_DRIVER_OBJS="$DLZ_DRIVER_OBJS $i.$O"
done
if test -n "-I$use_dlz_mysql/include/mysql"
then
DLZ_DRIVER_INCLUDES="$DLZ_DRIVER_INCLUDES -I$use_dlz_mysql/include/mysql"
fi
if test -n "-L$use_dlz_mysql/lib/mysql -lmysqlclient -lz -lcrypt -lm"
then
DLZ_DRIVER_LIBS="$DLZ_DRIVER_LIBS -L$use_dlz_mysql/lib/mysql -lmysqlclient -lz -lcrypt -lm"
fi
echo "$as_me:$LINENO: result: using mysql from $use_dlz_mysql/lib/mysql and $use_dlz_mysql/include/mysql" >&5
echo "${ECHO_T}using mysql from $use_dlz_mysql/lib/mysql and $use_dlz_mysql/include/mysql" >&6
;;
esac
#
# Was --with-dlz-bdb specified?
#
echo "$as_me:$LINENO: checking for Berkeley DB DLZ driver" >&5
echo $ECHO_N "checking for Berkeley DB DLZ driver... $ECHO_C" >&6
# Check whether --with-dlz_bdb or --without-dlz_bdb was given.
if test "${with_dlz_bdb+set}" = set; then
withval="$with_dlz_bdb"
use_dlz_bdb="$withval"
else
use_dlz_bdb="no"
fi;
case "$use_dlz_bdb" in
no)
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
;;
*)
if test "$use_dlz_bdb" = "yes"
then
# User did not specify a path - guess directories
bdbdirs="/usr/local /usr/pkg /usr"
elif test -d "$use_dlz_bdb"
then
# User specified directory and it exists
bdbdirs="$use_dlz_bdb"
else
echo "$as_me:$LINENO: result: not found" >&5
echo "${ECHO_T}not found" >&6
{ { echo "$as_me:$LINENO: error: path $use_dlz_bdb does not exist" >&5
echo "$as_me: error: path $use_dlz_bdb does not exist" >&2;}
{ (exit 1); exit 1; }; }
bdbdirs=""
fi
# Use path we were given or guessed. This is insanely
# complicated because we have to search for a bunch of
# platform-specific variations and have to check
# separately for include and library directories.
# Set both to yes, so we can check them later
dlz_bdb_inc="yes"
dlz_bdb_libs="yes"
for dd in $bdbdirs
do
# Skip nonexistant directories
if test ! -d "$dd"
then
continue
fi
# Check other locations for includes.
# Order is important (sigh).
bdb_incdirs="/ /db42/ /db41/ /db4/ /db/"
for d in $bdb_incdirs
do
if test -f "$dd/include${d}db.h"
then
dlz_bdb_inc="-I$dd/include${d}"
break
fi
done
# Give up on this directory if we couldn't
# find the include subdir
if test "$dlz_bdb_inc" = "yes"
then
continue
fi
# Look for libname other than libdb.so.
# Order is important (sigh).
bdb_libnames="db42 db-4.2 db41 db-4.1 db"
for d in $bdb_libnames
do
if test -f "$dd/lib/lib${d}.so"
then
if test "$dd" != "/usr"
then
dlz_bdb_libs="-L${dd}/lib "
fi
dlz_bdb_libs="${dlz_bdb_libs}-l${d}"
break
fi
done
# If we found both incdir and lib, we're done
if test "$dlz_bdb_libs" != "yes"
then
break
fi
# Otherwise, we're starting over
dlz_bdb_inc="yes"
dlz_bdb_libs="yes"
done
# Done searching, now make sure we got everything.
if test "$dlz_bdb_inc" = "yes"
then
echo "$as_me:$LINENO: result: not found" >&5
echo "${ECHO_T}not found" >&6
{ { echo "$as_me:$LINENO: error: could not find Berkeley DB include directory" >&5
echo "$as_me: error: could not find Berkeley DB include directory" >&2;}
{ (exit 1); exit 1; }; }
fi
if test "$dlz_bdb_libs" = "yes"
then
echo "$as_me:$LINENO: result: not found" >&5
echo "${ECHO_T}not found" >&6
{ { echo "$as_me:$LINENO: error: could not find Berkeley DB library" >&5
echo "$as_me: error: could not find Berkeley DB library" >&2;}
{ (exit 1); exit 1; }; }
fi
USE_DLZ="$USE_DLZ -DDLZ_BDB"
for i in dlz_bdb_driver dlz_bdbhpt_driver
do
DLZ_DRIVER_SRCS="$DLZ_DRIVER_SRCS $dlzdir/$i.c"
DLZ_DRIVER_OBJS="$DLZ_DRIVER_OBJS $i.$O"
done
if test -n "$dlz_bdb_inc"
then
DLZ_DRIVER_INCLUDES="$DLZ_DRIVER_INCLUDES $dlz_bdb_inc"
fi
if test -n "$dlz_bdb_libs"
then
DLZ_DRIVER_LIBS="$DLZ_DRIVER_LIBS $dlz_bdb_libs"
fi
echo "$as_me:$LINENO: result: using Berkeley DB: $dlz_bdb_inc $dlz_bdb_libs" >&5
echo "${ECHO_T}using Berkeley DB: $dlz_bdb_inc $dlz_bdb_libs" >&6
ac_config_files="$ac_config_files contrib/dlz/bin/dlzbdb/Makefile"
;;
esac
#
# Was --with-dlz-filesystem specified?
#
echo "$as_me:$LINENO: checking for file system DLZ driver" >&5
echo $ECHO_N "checking for file system DLZ driver... $ECHO_C" >&6
# Check whether --with-dlz_filesystem or --without-dlz_filesystem was given.
if test "${with_dlz_filesystem+set}" = set; then
withval="$with_dlz_filesystem"
use_dlz_filesystem="$withval"
else
use_dlz_filesystem="no"
fi;
case "$use_dlz_filesystem" in
no)
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
;;
*)
USE_DLZ="$USE_DLZ -DDLZ_FILESYSTEM"
for i in dlz_filesystem_driver
do
DLZ_DRIVER_SRCS="$DLZ_DRIVER_SRCS $dlzdir/$i.c"
DLZ_DRIVER_OBJS="$DLZ_DRIVER_OBJS $i.$O"
done
if test -n ""
then
DLZ_DRIVER_INCLUDES="$DLZ_DRIVER_INCLUDES "
fi
if test -n ""
then
DLZ_DRIVER_LIBS="$DLZ_DRIVER_LIBS "
fi
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
;;
esac
#
# Was --with-dlz-ldap specified?
#
echo "$as_me:$LINENO: checking for LDAP DLZ driver" >&5
echo $ECHO_N "checking for LDAP DLZ driver... $ECHO_C" >&6
# Check whether --with-dlz_ldap or --without-dlz_ldap was given.
if test "${with_dlz_ldap+set}" = set; then
withval="$with_dlz_ldap"
use_dlz_ldap="$withval"
else
use_dlz_ldap="no"
fi;
if test "$use_dlz_ldap" = "yes"
then
# User did not specify a path - guess it
ldapdirs="/usr /usr/local /usr/pkg"
for d in $ldapdirs
do
if test -f $d/include/ldap.h
then
use_dlz_ldap=$d
break
fi
done
fi
if test "$use_dlz_ldap" = "yes"
then
echo "$as_me:$LINENO: result: not found" >&5
echo "${ECHO_T}not found" >&6
{ { echo "$as_me:$LINENO: error: LDAP headers were not found in any of $ldapdirs; use --with-dlz-ldap=/path" >&5
echo "$as_me: error: LDAP headers were not found in any of $ldapdirs; use --with-dlz-ldap=/path" >&2;}
{ (exit 1); exit 1; }; }
fi
case "$use_dlz_ldap" in
no)
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
;;
*)
USE_DLZ="$USE_DLZ -DDLZ_LDAP"
for i in dlz_ldap_driver
do
DLZ_DRIVER_SRCS="$DLZ_DRIVER_SRCS $dlzdir/$i.c"
DLZ_DRIVER_OBJS="$DLZ_DRIVER_OBJS $i.$O"
done
if test -n "-I$use_dlz_ldap/include"
then
DLZ_DRIVER_INCLUDES="$DLZ_DRIVER_INCLUDES -I$use_dlz_ldap/include"
fi
if test -n "-L$use_dlz_ldap/lib -lldap -llber"
then
DLZ_DRIVER_LIBS="$DLZ_DRIVER_LIBS -L$use_dlz_ldap/lib -lldap -llber"
fi
echo "$as_me:$LINENO: result: using LDAP from $use_dlz_ldap/lib and $use_dlz_ldap/include" >&5
echo "${ECHO_T}using LDAP from $use_dlz_ldap/lib and $use_dlz_ldap/include" >&6
;;
esac
#
# Was --with-dlz-odbc specified?
#
echo "$as_me:$LINENO: checking for ODBC DLZ driver" >&5
echo $ECHO_N "checking for ODBC DLZ driver... $ECHO_C" >&6
# Check whether --with-dlz_odbc or --without-dlz_odbc was given.
if test "${with_dlz_odbc+set}" = set; then
withval="$with_dlz_odbc"
use_dlz_odbc="$withval"
else
use_dlz_odbc="no"
fi;
if test "$use_dlz_odbc" = "yes"
then
# User did not specify a path - guess it
odbcdirs="/usr /usr/local /usr/pkg"
for d in $odbcdirs
do
if test -f $d/include/sql.h -a -f $d/lib/libodbc.a
then
use_dlz_odbc=$d
break
fi
done
fi
case "$use_dlz_odbc" in
no)
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
;;
yes)
echo "$as_me:$LINENO: result: not found" >&5
echo "${ECHO_T}not found" >&6
{ { echo "$as_me:$LINENO: error: ODBC headers were not found in any of $odbcdirs; use --with-dlz-odbc=/path" >&5
echo "$as_me: error: ODBC headers were not found in any of $odbcdirs; use --with-dlz-odbc=/path" >&2;}
{ (exit 1); exit 1; }; }
;;
*)
USE_DLZ="$USE_DLZ -DDLZ_ODBC"
for i in dlz_odbc_driver
do
DLZ_DRIVER_SRCS="$DLZ_DRIVER_SRCS $dlzdir/$i.c"
DLZ_DRIVER_OBJS="$DLZ_DRIVER_OBJS $i.$O"
done
if test -n "-I$use_dlz_odbc/include"
then
DLZ_DRIVER_INCLUDES="$DLZ_DRIVER_INCLUDES -I$use_dlz_odbc/include"
fi
if test -n "-L$use_dlz_odbc/lib -lodbc"
then
DLZ_DRIVER_LIBS="$DLZ_DRIVER_LIBS -L$use_dlz_odbc/lib -lodbc"
fi
echo "$as_me:$LINENO: result: using ODBC from $use_dlz_odbc" >&5
echo "${ECHO_T}using ODBC from $use_dlz_odbc" >&6
;;
esac
#
# Was --with-dlz-stub specified?
#
echo "$as_me:$LINENO: checking for stub DLZ driver" >&5
echo $ECHO_N "checking for stub DLZ driver... $ECHO_C" >&6
# Check whether --with-dlz_stub or --without-dlz_stub was given.
if test "${with_dlz_stub+set}" = set; then
withval="$with_dlz_stub"
use_dlz_stub="$withval"
else
use_dlz_stub="no"
fi;
case "$use_dlz_stub" in
no)
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
;;
*)
USE_DLZ="$USE_DLZ -DDLZ_STUB"
for i in dlz_stub_driver
do
DLZ_DRIVER_SRCS="$DLZ_DRIVER_SRCS $dlzdir/$i.c"
DLZ_DRIVER_OBJS="$DLZ_DRIVER_OBJS $i.$O"
done
if test -n ""
then
DLZ_DRIVER_INCLUDES="$DLZ_DRIVER_INCLUDES "
fi
if test -n ""
then
DLZ_DRIVER_LIBS="$DLZ_DRIVER_LIBS "
fi
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
;;
esac
# Add any additional DLZ drivers here.
#
# Finally, some generic stuff that applies to all drivers, assuming
# we're compiling DLZ at all.
#
if test -n "$USE_DLZ"
then
#
# Where to find DLZ driver header files.
#
DLZ_DRIVER_INCLUDES="-I$dlzdir/include $DLZ_DRIVER_INCLUDES"
#
# Initialization and shutdown wrappers, helper functions.
#
DLZ_DRIVER_SRCS="$dlzdir/dlz_drivers.c $dlzdir/sdlz_helper.c $DLZ_DRIVER_SRCS"
DLZ_DRIVER_OBJS="dlz_drivers.$O sdlz_helper.$O $DLZ_DRIVER_OBJS"
fi
echo "$as_me:$LINENO: checking for DLZ" >&5
echo $ECHO_N "checking for DLZ... $ECHO_C" >&6
if test -n "$USE_DLZ"
then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
USE_DLZ="-DDLZ $USE_DLZ"
DLZ_DRIVER_RULES=contrib/dlz/drivers/rules
ac_config_files="$ac_config_files $DLZ_DRIVER_RULES"
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
DLZ_DRIVER_RULES=/dev/null
fi
# #
# Commands to run at the end of config.status. # Commands to run at the end of config.status.
# Don't just put these into configure, it won't work right if somebody # Don't just put these into configure, it won't work right if somebody
@@ -28399,11 +29090,19 @@ LIBLWRES_API=$srcdir/lib/lwres/api
ac_config_commands="$ac_config_commands chmod" ac_config_commands="$ac_config_commands chmod"
#
# Files to configure. These are listed here because we used to
# specify them as arguments to AC_OUTPUT. It's (now) ok to move these
# elsewhere if there's a good reason for doing so.
#
ac_config_files="$ac_config_files Makefile make/Makefile make/mkdep lib/Makefile lib/isc/Makefile lib/isc/include/Makefile lib/isc/include/isc/Makefile lib/isc/include/isc/platform.h lib/isc/unix/Makefile lib/isc/unix/include/Makefile lib/isc/unix/include/isc/Makefile lib/isc/nls/Makefile lib/isc/$thread_dir/Makefile lib/isc/$thread_dir/include/Makefile lib/isc/$thread_dir/include/isc/Makefile lib/isccc/Makefile lib/isccc/include/Makefile lib/isccc/include/isccc/Makefile lib/isccfg/Makefile lib/isccfg/include/Makefile lib/isccfg/include/isccfg/Makefile lib/dns/Makefile lib/dns/include/Makefile lib/dns/include/dns/Makefile lib/dns/include/dst/Makefile lib/bind9/Makefile lib/bind9/include/Makefile lib/bind9/include/bind9/Makefile lib/lwres/Makefile lib/lwres/include/Makefile lib/lwres/include/lwres/Makefile lib/lwres/include/lwres/netdb.h lib/lwres/include/lwres/platform.h lib/lwres/man/Makefile lib/lwres/unix/Makefile lib/lwres/unix/include/Makefile lib/lwres/unix/include/lwres/Makefile lib/tests/Makefile lib/tests/include/Makefile lib/tests/include/tests/Makefile bin/Makefile bin/check/Makefile bin/named/Makefile bin/named/unix/Makefile bin/rndc/Makefile bin/rndc/unix/Makefile bin/dig/Makefile bin/nsupdate/Makefile bin/tests/Makefile bin/tests/names/Makefile bin/tests/master/Makefile bin/tests/rbt/Makefile bin/tests/db/Makefile bin/tests/tasks/Makefile bin/tests/timers/Makefile bin/tests/dst/Makefile bin/tests/mem/Makefile bin/tests/net/Makefile bin/tests/sockaddr/Makefile bin/tests/system/Makefile bin/tests/system/conf.sh bin/tests/system/lwresd/Makefile bin/tests/system/tkey/Makefile bin/tests/headerdep_test.sh bin/dnssec/Makefile doc/Makefile doc/arm/Makefile doc/misc/Makefile isc-config.sh doc/xsl/Makefile doc/xsl/isc-docbook-chunk.xsl doc/xsl/isc-docbook-html.xsl doc/xsl/isc-docbook-latex.xsl doc/xsl/isc-manpage.xsl"
# #
# Do it # Do it
# #
ac_config_files="$ac_config_files make/rules make/includes Makefile make/Makefile make/mkdep lib/Makefile lib/isc/Makefile lib/isc/include/Makefile lib/isc/include/isc/Makefile lib/isc/include/isc/platform.h lib/isc/unix/Makefile lib/isc/unix/include/Makefile lib/isc/unix/include/isc/Makefile lib/isc/nls/Makefile lib/isc/$thread_dir/Makefile lib/isc/$thread_dir/include/Makefile lib/isc/$thread_dir/include/isc/Makefile lib/isccc/Makefile lib/isccc/include/Makefile lib/isccc/include/isccc/Makefile lib/isccfg/Makefile lib/isccfg/include/Makefile lib/isccfg/include/isccfg/Makefile lib/dns/Makefile lib/dns/include/Makefile lib/dns/include/dns/Makefile lib/dns/include/dst/Makefile lib/bind9/Makefile lib/bind9/include/Makefile lib/bind9/include/bind9/Makefile lib/lwres/Makefile lib/lwres/include/Makefile lib/lwres/include/lwres/Makefile lib/lwres/include/lwres/netdb.h lib/lwres/include/lwres/platform.h lib/lwres/man/Makefile lib/lwres/unix/Makefile lib/lwres/unix/include/Makefile lib/lwres/unix/include/lwres/Makefile lib/tests/Makefile lib/tests/include/Makefile lib/tests/include/tests/Makefile bin/Makefile bin/check/Makefile bin/named/Makefile bin/named/unix/Makefile bin/rndc/Makefile bin/rndc/unix/Makefile bin/dig/Makefile bin/nsupdate/Makefile bin/tests/Makefile bin/tests/names/Makefile bin/tests/master/Makefile bin/tests/rbt/Makefile bin/tests/db/Makefile bin/tests/tasks/Makefile bin/tests/timers/Makefile bin/tests/dst/Makefile bin/tests/mem/Makefile bin/tests/net/Makefile bin/tests/sockaddr/Makefile bin/tests/system/Makefile bin/tests/system/conf.sh bin/tests/system/lwresd/Makefile bin/tests/system/tkey/Makefile bin/tests/headerdep_test.sh bin/dnssec/Makefile doc/Makefile doc/arm/Makefile doc/misc/Makefile isc-config.sh doc/xsl/Makefile doc/xsl/isc-docbook-chunk.xsl doc/xsl/isc-docbook-html.xsl doc/xsl/isc-docbook-latex.xsl doc/xsl/isc-manpage.xsl"
cat >confcache <<\_ACEOF cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure # This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure # tests run on this system so they can be shared between configure
@@ -28934,6 +29633,8 @@ do
# Handling of arguments. # Handling of arguments.
"make/rules" ) CONFIG_FILES="$CONFIG_FILES make/rules" ;; "make/rules" ) CONFIG_FILES="$CONFIG_FILES make/rules" ;;
"make/includes" ) CONFIG_FILES="$CONFIG_FILES make/includes" ;; "make/includes" ) CONFIG_FILES="$CONFIG_FILES make/includes" ;;
"contrib/dlz/bin/dlzbdb/Makefile" ) CONFIG_FILES="$CONFIG_FILES contrib/dlz/bin/dlzbdb/Makefile" ;;
"$DLZ_DRIVER_RULES" ) CONFIG_FILES="$CONFIG_FILES $DLZ_DRIVER_RULES" ;;
"Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"make/Makefile" ) CONFIG_FILES="$CONFIG_FILES make/Makefile" ;; "make/Makefile" ) CONFIG_FILES="$CONFIG_FILES make/Makefile" ;;
"make/mkdep" ) CONFIG_FILES="$CONFIG_FILES make/mkdep" ;; "make/mkdep" ) CONFIG_FILES="$CONFIG_FILES make/mkdep" ;;
@@ -29263,6 +29964,12 @@ s,@BIND9_DNS_BUILDINCLUDE@,$BIND9_DNS_BUILDINCLUDE,;t t
s,@BIND9_LWRES_BUILDINCLUDE@,$BIND9_LWRES_BUILDINCLUDE,;t t s,@BIND9_LWRES_BUILDINCLUDE@,$BIND9_LWRES_BUILDINCLUDE,;t t
s,@BIND9_BIND9_BUILDINCLUDE@,$BIND9_BIND9_BUILDINCLUDE,;t t s,@BIND9_BIND9_BUILDINCLUDE@,$BIND9_BIND9_BUILDINCLUDE,;t t
s,@BIND9_VERSION@,$BIND9_VERSION,;t t s,@BIND9_VERSION@,$BIND9_VERSION,;t t
s,@PG_CONFIG@,$PG_CONFIG,;t t
s,@USE_DLZ@,$USE_DLZ,;t t
s,@DLZ_DRIVER_INCLUDES@,$DLZ_DRIVER_INCLUDES,;t t
s,@DLZ_DRIVER_LIBS@,$DLZ_DRIVER_LIBS,;t t
s,@DLZ_DRIVER_SRCS@,$DLZ_DRIVER_SRCS,;t t
s,@DLZ_DRIVER_OBJS@,$DLZ_DRIVER_OBJS,;t t
s,@LIBOBJS@,$LIBOBJS,;t t s,@LIBOBJS@,$LIBOBJS,;t t
s,@LTLIBOBJS@,$LTLIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t
/@BIND9_MAKE_INCLUDES@/r $BIND9_MAKE_INCLUDES /@BIND9_MAKE_INCLUDES@/r $BIND9_MAKE_INCLUDES
@@ -29281,6 +29988,8 @@ s,@LIBDNS_API@,,;t t
s,@LIBBIND9_API@,,;t t s,@LIBBIND9_API@,,;t t
/@LIBLWRES_API@/r $LIBLWRES_API /@LIBLWRES_API@/r $LIBLWRES_API
s,@LIBLWRES_API@,,;t t s,@LIBLWRES_API@,,;t t
/@DLZ_DRIVER_RULES@/r $DLZ_DRIVER_RULES
s,@DLZ_DRIVER_RULES@,,;t t
CEOF CEOF
_ACEOF _ACEOF

View File

@@ -18,10 +18,10 @@ AC_DIVERT_PUSH(1)dnl
esyscmd([sed "s/^/# /" COPYRIGHT])dnl esyscmd([sed "s/^/# /" COPYRIGHT])dnl
AC_DIVERT_POP()dnl AC_DIVERT_POP()dnl
AC_REVISION($Revision: 1.391 $) AC_REVISION($Revision: 1.392 $)
AC_INIT(lib/dns/name.c) AC_INIT(lib/dns/name.c)
AC_PREREQ(2.13) AC_PREREQ(2.59)
AC_CONFIG_HEADER(config.h) AC_CONFIG_HEADER(config.h)
AC_CONFIG_SUBDIRS(lib/bind) AC_CONFIG_SUBDIRS(lib/bind)
@@ -38,6 +38,13 @@ AC_SUBST(STD_CDEFINES)
AC_SUBST(STD_CWARNINGS) AC_SUBST(STD_CWARNINGS)
AC_SUBST(CCOPT) AC_SUBST(CCOPT)
#
# Make very sure that these are the first files processed by
# config.status, since we use the processed output as the input for
# AC_SUBST_FILE() subsitutions in other files.
#
AC_CONFIG_FILES([make/rules make/includes])
AC_PATH_PROG(AR, ar) AC_PATH_PROG(AR, ar)
ARFLAGS="cruv" ARFLAGS="cruv"
AC_SUBST(AR) AC_SUBST(AR)
@@ -355,6 +362,7 @@ AC_SUBST(LWRES_PLATFORM_NEEDSYSSELECTH)
# #
AC_C_BIGENDIAN AC_C_BIGENDIAN
# #
# was --with-openssl specified? # was --with-openssl specified?
# #
@@ -979,6 +987,7 @@ case "$enable_libbind" in
;; ;;
esac esac
# #
# Here begins a very long section to determine the system's networking # Here begins a very long section to determine the system's networking
# capabilities. The order of the tests is signficant. # capabilities. The order of the tests is signficant.
@@ -2180,6 +2189,46 @@ LIBBIND9_API=$srcdir/lib/bind9/api
AC_SUBST_FILE(LIBLWRES_API) AC_SUBST_FILE(LIBLWRES_API)
LIBLWRES_API=$srcdir/lib/lwres/api LIBLWRES_API=$srcdir/lib/lwres/api
#
# 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.
#
# This section has to come after the libtool stuff because it needs to
# know how to name the driver object files.
#
USE_DLZ=""
DLZ_DRIVER_INCLUDES=""
DLZ_DRIVER_LIBS=""
DLZ_DRIVER_SRCS=""
DLZ_DRIVER_OBJS=""
sinclude(contrib/dlz/config.dlz.in)
AC_MSG_CHECKING(for DLZ)
if test -n "$USE_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
AC_MSG_RESULT(no)
DLZ_DRIVER_RULES=/dev/null
fi
AC_SUBST(USE_DLZ)
AC_SUBST(DLZ_DRIVER_INCLUDES)
AC_SUBST(DLZ_DRIVER_LIBS)
AC_SUBST(DLZ_DRIVER_SRCS)
AC_SUBST(DLZ_DRIVER_OBJS)
AC_SUBST_FILE(DLZ_DRIVER_RULES)
# #
# Commands to run at the end of config.status. # Commands to run at the end of config.status.
# Don't just put these into configure, it won't work right if somebody # Don't just put these into configure, it won't work right if somebody
@@ -2191,12 +2240,12 @@ AC_CONFIG_COMMANDS(
[chmod a+x isc-config.sh]) [chmod a+x isc-config.sh])
# #
# Do it # Files to configure. These are listed here because we used to
# specify them as arguments to AC_OUTPUT. It's (now) ok to move these
# elsewhere if there's a good reason for doing so.
# #
AC_OUTPUT( AC_CONFIG_FILES([
make/rules
make/includes
Makefile Makefile
make/Makefile make/Makefile
make/mkdep make/mkdep
@@ -2271,7 +2320,13 @@ AC_OUTPUT(
doc/xsl/isc-docbook-html.xsl doc/xsl/isc-docbook-html.xsl
doc/xsl/isc-docbook-latex.xsl doc/xsl/isc-docbook-latex.xsl
doc/xsl/isc-manpage.xsl doc/xsl/isc-manpage.xsl
) ])
#
# Do it
#
AC_OUTPUT
# Tell Emacs to edit this file in shell mode. # Tell Emacs to edit this file in shell mode.
# Local Variables: # Local Variables:

View File

@@ -0,0 +1,3 @@
Makefile
dlzbdb
*.o

View File

@@ -0,0 +1,73 @@
# Copyright (C) 1998-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 INTERNET SOFTWARE CONSORTIUM
# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
# INTERNET SOFTWARE CONSORTIUM 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.2 2005/09/05 00:10:54 marka Exp $
srcdir = @srcdir@
VPATH = @srcdir@
top_srcdir = @top_srcdir@
@BIND9_VERSION@
@BIND9_MAKE_INCLUDES@
DLZINCLUDES = @DLZ_BDB_INC@
CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include \
${ISC_INCLUDES} ${DLZINCLUDES}
CDEFINES = @USE_DLZ_BDB@
CWARNINGS =
DLZLIBS = @DLZ_BDB_LIBS@
ISCLIBS = ../../lib/isc/libisc.@A@
DEPLIBS = ${ISCDEPLIBS}
LIBS = ${ISCLIBS} ${DLZLIBS} @LIBS@
TARGETS = dlzbdb
SRCS = dlzbdb.c
#MANPAGES =
#HTMLPAGES =
#MANOBJS = ${MANPAGES} ${HTMLPAGES}
@BIND9_MAKE_RULES@
dlzbdb.@O@: dlzbdb.c
${LIBTOOL} ${CC} ${ALL_CFLAGS} -DVERSION=\"${VERSION}\" \
-c ${srcdir}/dlzbdb.c
dlzbdb: dlzbdb.@O@ ${DEPLIBS}
${LIBTOOL} ${PURIFY} ${CC} ${CFLAGS} -o $@ dlzbdb.@O@ ${LIBS}
doc man:: ${MANOBJS}
#docclean manclean maintainer-clean::
# rm -f ${MANOBJS}
clean distclean maintainer-clean::
rm -f ${TARGETS}
installdirs:
$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${sbindir}
# $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man8
install:: dlzbdb installdirs
${LIBTOOL} ${INSTALL_PROGRAM} dlzbdb ${DESTDIR}${sbindir}

File diff suppressed because it is too large Load Diff

434
contrib/dlz/config.dlz.in Normal file
View File

@@ -0,0 +1,434 @@
# Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC")
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
#
# Shorthand. Note quoting: DLZ_DRIVER_DIR expanded in Makefile, not here.
#
dlzdir='${DLZ_DRIVER_DIR}'
#
# Private autoconf macro to simplify configuring drivers:
#
# DLZ_ADD_DRIVER(DEFINE, DRIVER, INCLUDES, LIBS)
#
# where:
# DEFINE is FOO (to define -DDLZ_FOO)
# DRIVER is dlz_foo_driver (sources without the .c)
# INCLUDES is any necessary include definitions
# LIBS is any necessary library definitions
#
AC_DEFUN(DLZ_ADD_DRIVER, [
USE_DLZ="$USE_DLZ -DDLZ_$1"
for i in $2
do
DLZ_DRIVER_SRCS="$DLZ_DRIVER_SRCS $dlzdir/$i.c"
DLZ_DRIVER_OBJS="$DLZ_DRIVER_OBJS $i.$O"
done
if test -n "$3"
then
DLZ_DRIVER_INCLUDES="$DLZ_DRIVER_INCLUDES $3"
fi
if test -n "$4"
then
DLZ_DRIVER_LIBS="$DLZ_DRIVER_LIBS $4"
fi
])
#
# Check for the various DLZ drivers
#
#
# Was --with-dlz-postgres specified?
#
AC_MSG_CHECKING(for Postgres DLZ driver)
AC_ARG_WITH(dlz_postgres,
[ --with-dlz-postgres[=PATH] Build with Postgres DLZ driver [yes|no|path].
(Required to use Postgres with DLZ)],
use_dlz_postgres="$withval", use_dlz_postgres="no")
if test "$use_dlz_postgres" = "yes"
then
# User did not specify a path - guess it
# Ask Postgres to tell us where it is
AC_PATH_PROGS(PG_CONFIG, pg_config, [not found])
if test "$PG_CONFIG" != "not found"
then
use_dlz_postgres=`$PG_CONFIG --includedir`
use_dlz_postgres_lib=`$PG_CONFIG --libdir`
fi
fi
if test "$use_dlz_postgres" = "yes"
then
# User did not specify path and Postgres didn't say - guess it
pgdirs="/usr /usr/local /usr/local/pgsql /usr/pkg"
for d in $pgdirs
do
if test -f $d/include/libpq-fe.h
then
use_dlz_postgres=$d/include
use_dlz_postgres_lib=$d/lib
break
fi
done
fi
if test "$use_dlz_postgres" = "yes"
then
# Still no joy, give up
AC_MSG_RESULT(not found)
AC_MSG_ERROR(
[No pg_config and PostgreSQL was not found in any of $pgdirs; use --with-dlz-postgres=/path or put pg_config in your path])
fi
case "$use_dlz_postgres" in
no)
AC_MSG_RESULT(no)
;;
*)
DLZ_ADD_DRIVER(POSTGRES, dlz_postgres_driver,
[-I$use_dlz_postgres],
[-L$use_dlz_postgres_lib -lpq])
AC_MSG_RESULT(
[using PostgreSQL from $use_dlz_postgres_lib and $use_dlz_postgres])
;;
esac
#
# Was --with-dlz-mysql specified?
#
AC_MSG_CHECKING(for MySQL DLZ driver)
AC_ARG_WITH(dlz_mysql,
[ --with-dlz-mysql[=PATH] Build with MySQL DLZ driver [yes|no|path].
(Required to use MySQL with DLZ)],
use_dlz_mysql="$withval", use_dlz_mysql="no")
if test "$use_dlz_mysql" = "yes"
then
# User did not specify a path - guess it
mysqldirs="/usr /usr/local /usr/local/mysql /usr/pkg"
for d in $mysqldirs
do
if test -f $d/include/mysql/mysql.h
then
use_dlz_mysql=$d
break
fi
done
fi
if test "$use_dlz_mysql" = "yes"
then
AC_MSG_RESULT(not found)
AC_MSG_ERROR(
[MySQL was not found in any of $mysqldirs; use --with-dlz-mysql=/path])
fi
case "$use_dlz_mysql" in
no)
AC_MSG_RESULT(no)
;;
*)
DLZ_ADD_DRIVER(MYSQL, dlz_mysql_driver,
[-I$use_dlz_mysql/include/mysql],
[-L$use_dlz_mysql/lib/mysql -lmysqlclient -lz -lcrypt -lm])
AC_MSG_RESULT(
[using mysql from $use_dlz_mysql/lib/mysql and $use_dlz_mysql/include/mysql])
;;
esac
#
# Was --with-dlz-bdb specified?
#
AC_MSG_CHECKING(for Berkeley DB DLZ driver)
AC_ARG_WITH(dlz_bdb,
[ --with-dlz-bdb[=PATH] Build with Berkeley DB DLZ driver [yes|no|path].
(Required to use Berkeley DB with DLZ)],
use_dlz_bdb="$withval", use_dlz_bdb="no")
case "$use_dlz_bdb" in
no)
AC_MSG_RESULT(no)
;;
*)
if test "$use_dlz_bdb" = "yes"
then
# User did not specify a path - guess directories
bdbdirs="/usr/local /usr/pkg /usr"
elif test -d "$use_dlz_bdb"
then
# User specified directory and it exists
bdbdirs="$use_dlz_bdb"
else
AC_MSG_RESULT(not found)
AC_MSG_ERROR([path $use_dlz_bdb does not exist])
bdbdirs=""
fi
# Use path we were given or guessed. This is insanely
# complicated because we have to search for a bunch of
# platform-specific variations and have to check
# separately for include and library directories.
# Set both to yes, so we can check them later
dlz_bdb_inc="yes"
dlz_bdb_libs="yes"
for dd in $bdbdirs
do
# Skip nonexistant directories
if test ! -d "$dd"
then
continue
fi
# Check other locations for includes.
# Order is important (sigh).
bdb_incdirs="/ /db42/ /db41/ /db4/ /db/"
for d in $bdb_incdirs
do
if test -f "$dd/include${d}db.h"
then
dlz_bdb_inc="-I$dd/include${d}"
break
fi
done
# Give up on this directory if we couldn't
# find the include subdir
if test "$dlz_bdb_inc" = "yes"
then
continue
fi
# Look for libname other than libdb.so.
# Order is important (sigh).
bdb_libnames="db42 db-4.2 db41 db-4.1 db"
for d in $bdb_libnames
do
if test -f "$dd/lib/lib${d}.so"
then
if test "$dd" != "/usr"
then
dlz_bdb_libs="-L${dd}/lib "
fi
dlz_bdb_libs="${dlz_bdb_libs}-l${d}"
break
fi
done
# If we found both incdir and lib, we're done
if test "$dlz_bdb_libs" != "yes"
then
break
fi
# Otherwise, we're starting over
dlz_bdb_inc="yes"
dlz_bdb_libs="yes"
done
# Done searching, now make sure we got everything.
if test "$dlz_bdb_inc" = "yes"
then
AC_MSG_RESULT(not found)
AC_MSG_ERROR([could not find Berkeley DB include directory])
fi
if test "$dlz_bdb_libs" = "yes"
then
AC_MSG_RESULT(not found)
AC_MSG_ERROR([could not find Berkeley DB library])
fi
DLZ_ADD_DRIVER(BDB, dlz_bdb_driver dlz_bdbhpt_driver,
[$dlz_bdb_inc], [$dlz_bdb_libs])
AC_MSG_RESULT([using Berkeley DB: $dlz_bdb_inc $dlz_bdb_libs])
AC_CONFIG_FILES([contrib/dlz/bin/dlzbdb/Makefile])
;;
esac
#
# Was --with-dlz-filesystem specified?
#
AC_MSG_CHECKING(for file system DLZ driver)
AC_ARG_WITH(dlz_filesystem,
[ --with-dlz-filesystem[=PATH] Build with filesystem DLZ driver [yes|no].
(Required to use file system driver with DLZ)],
use_dlz_filesystem="$withval", use_dlz_filesystem="no")
case "$use_dlz_filesystem" in
no)
AC_MSG_RESULT(no)
;;
*)
DLZ_ADD_DRIVER(FILESYSTEM, dlz_filesystem_driver)
AC_MSG_RESULT(yes)
;;
esac
#
# Was --with-dlz-ldap specified?
#
AC_MSG_CHECKING(for LDAP DLZ driver)
AC_ARG_WITH(dlz_ldap,
[ --with-dlz-ldap[=PATH] Build with LDAP DLZ driver [yes|no|path].
(Required to use LDAP with DLZ)],
use_dlz_ldap="$withval", use_dlz_ldap="no")
if test "$use_dlz_ldap" = "yes"
then
# User did not specify a path - guess it
ldapdirs="/usr /usr/local /usr/pkg"
for d in $ldapdirs
do
if test -f $d/include/ldap.h
then
use_dlz_ldap=$d
break
fi
done
fi
if test "$use_dlz_ldap" = "yes"
then
AC_MSG_RESULT(not found)
AC_MSG_ERROR(
[LDAP headers were not found in any of $ldapdirs; use --with-dlz-ldap=/path])
fi
case "$use_dlz_ldap" in
no)
AC_MSG_RESULT(no)
;;
*)
DLZ_ADD_DRIVER(LDAP, dlz_ldap_driver,
[-I$use_dlz_ldap/include],
[-L$use_dlz_ldap/lib -lldap -llber])
AC_MSG_RESULT(
[using LDAP from $use_dlz_ldap/lib and $use_dlz_ldap/include])
;;
esac
#
# Was --with-dlz-odbc specified?
#
AC_MSG_CHECKING(for ODBC DLZ driver)
AC_ARG_WITH(dlz_odbc,
[ --with-dlz-odbc[=PATH] Build with ODBC DLZ driver [yes|no|path].
(Required to use ODBC with DLZ)],
use_dlz_odbc="$withval", use_dlz_odbc="no")
if test "$use_dlz_odbc" = "yes"
then
# User did not specify a path - guess it
odbcdirs="/usr /usr/local /usr/pkg"
for d in $odbcdirs
do
if test -f $d/include/sql.h -a -f $d/lib/libodbc.a
then
use_dlz_odbc=$d
break
fi
done
fi
case "$use_dlz_odbc" in
no)
AC_MSG_RESULT(no)
;;
yes)
AC_MSG_RESULT(not found)
AC_MSG_ERROR(
[ODBC headers were not found in any of $odbcdirs; use --with-dlz-odbc=/path])
;;
*)
DLZ_ADD_DRIVER(ODBC, dlz_odbc_driver,
[-I$use_dlz_odbc/include],
[-L$use_dlz_odbc/lib -lodbc])
AC_MSG_RESULT([using ODBC from $use_dlz_odbc])
;;
esac
#
# Was --with-dlz-stub specified?
#
AC_MSG_CHECKING(for stub DLZ driver)
AC_ARG_WITH(dlz_stub,
[ --with-dlz-stub[=PATH] Build with stub DLZ driver [yes|no].
(Required to use stub driver with DLZ)],
use_dlz_stub="$withval", use_dlz_stub="no")
case "$use_dlz_stub" in
no)
AC_MSG_RESULT(no)
;;
*)
DLZ_ADD_DRIVER(STUB, dlz_stub_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.
#
if test -n "$USE_DLZ"
then
#
# Where to find DLZ driver header files.
#
DLZ_DRIVER_INCLUDES="-I$dlzdir/include $DLZ_DRIVER_INCLUDES"
#
# Initialization and shutdown wrappers, helper functions.
#
DLZ_DRIVER_SRCS="$dlzdir/dlz_drivers.c $dlzdir/sdlz_helper.c $DLZ_DRIVER_SRCS"
DLZ_DRIVER_OBJS="dlz_drivers.$O sdlz_helper.$O $DLZ_DRIVER_OBJS"
fi

View File

@@ -0,0 +1 @@
rules

View File

@@ -0,0 +1,797 @@
/*
* Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
*
* 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 STICHTING NLNET
* 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.
*/
/*
* 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 INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM 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_BDB
#include <config.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.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_bdb_driver.h>
#include <db.h>
static dns_sdlzimplementation_t *dlz_bdb = NULL;
/* should the bdb driver use threads. */
#ifdef ISC_PLATFORM_USETHREADS
#define bdb_threads DB_THREAD
#else
#define bdb_threads 0
#endif
/* BDB database names */
#define dlz_data "dns_data"
#define dlz_zone "dns_zone"
#define dlz_host "dns_host"
#define dlz_client "dns_client"
/*%
* This structure contains all the Berkeley DB handles
* for this instance of the BDB driver.
*/
typedef struct bdb_instance {
DB_ENV *dbenv; /*%< BDB environment */
DB *data; /*%< dns_data database handle */
DB *zone; /*%< zone database handle */
DB *host; /*%< host database handle */
DB *client; /*%< client database handle */
isc_mem_t *mctx; /*%< memory context */
} bdb_instance_t;
typedef struct parsed_data {
char *zone;
char *host;
char *type;
int ttl;
char *data;
} parsed_data_t;
/* forward reference */
static isc_result_t
bdb_findzone(void *driverarg, void *dbdata, const char *name);
/*%
* Parses the DBT from the Berkeley DB into a parsed_data record
* The parsed_data record should be allocated before and passed into the
* bdb_parse_data function. The char (type & data) fields should not
* be "free"d as that memory is part of the DBT data field. It will be
* "free"d when the DBT is freed.
*/
static isc_result_t
bdb_parse_data(char *in, parsed_data_t *pd) {
char *endp, *ttlStr;
char *tmp = in;
char *lastchar = (char *) &tmp[strlen(tmp) + 1];
/*%
* String should be formated as:
* zone(a space)host(a space)ttl(a space)type(a space)remaining data
* examples:
* example.com www 10 A 127.0.0.1
* example.com mail 10 A 127.0.0.2
* example.com @ 10 MX 20 mail.example.com
*/
/* save pointer to zone */
pd->zone = tmp;
/* find space after zone and change it to a '\0' */
tmp = strchr(tmp, ' ');
/* verify we found a space */
if (tmp == NULL)
return ISC_R_FAILURE;
/* change the space to a null (string terminator) */
tmp[0] = '\0';
/* make sure it is safe to increment pointer */
if (++tmp > lastchar)
return ISC_R_FAILURE;
/* save pointer to host */
pd->host = tmp;
/* find space after type and change it to a '\0' */
tmp = strchr(tmp, ' ');
/* verify we found a space */
if (tmp == NULL)
return ISC_R_FAILURE;
/* change the space to a null (string terminator) */
tmp[0] = '\0';
/* make sure it is safe to increment pointer */
if (++tmp > lastchar)
return ISC_R_FAILURE;
/* save pointer to dns type */
pd->type = tmp;
/* find space after type and change it to a '\0' */
tmp = strchr(tmp, ' ');
/* verify we found a space */
if (tmp == NULL)
return ISC_R_FAILURE;
/* change the space to a null (string terminator) */
tmp[0] = '\0';
/* make sure it is safe to increment pointer */
if (++tmp > lastchar)
return ISC_R_FAILURE;
/* save pointer to dns ttl */
ttlStr = tmp;
/* find space after ttl and change it to a '\0' */
tmp = strchr(tmp, ' ');
/* verify we found a space */
if (tmp == NULL)
return ISC_R_FAILURE;
/* change the space to a null (string terminator) */
tmp[0] = '\0';
/* make sure it is safe to increment pointer */
if (++tmp > lastchar)
return ISC_R_FAILURE;
/* save pointer to remainder of DNS data */
pd->data = tmp;
/* convert ttl string to integer */
pd->ttl = strtol(ttlStr, &endp, 10);
if (*endp != '\0' || pd->ttl < 0) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"BDB driver ttl must be a postive number");
return ISC_R_FAILURE;
}
/* if we get this far everything should have worked. */
return ISC_R_SUCCESS;
}
/*
* DLZ methods
*/
static isc_result_t
bdb_allowzonexfr(void *driverarg, void *dbdata, const char *name,
const char *client)
{
isc_result_t result;
bdb_instance_t *db = (bdb_instance_t *) dbdata;
DBC *client_cursor = NULL;
DBT key, data;
/* check to see if we are authoritative for the zone first. */
result = bdb_findzone(driverarg, dbdata, name);
if (result != ISC_R_SUCCESS)
return (ISC_R_NOTFOUND);
memset(&key, 0, sizeof(DBT));
key.flags = DB_DBT_MALLOC;
key.data = strdup(name);
if (key.data == NULL) {
result = ISC_R_NOMEMORY;
goto xfr_cleanup;
}
key.size = strlen(key.data);
memset(&data, 0, sizeof(DBT));
data.flags = DB_DBT_MALLOC;
data.data = strdup(client);
if (data.data == NULL) {
result = ISC_R_NOMEMORY;
goto xfr_cleanup;
}
data.size = strlen(data.data);
/* get a cursor to loop through zone data */
if (db->client->cursor(db->client, NULL, &client_cursor, 0) != 0) {
result = ISC_R_FAILURE;
goto xfr_cleanup;
}
switch(client_cursor->c_get(client_cursor, &key, &data, DB_GET_BOTH)) {
case DB_NOTFOUND:
case DB_SECONDARY_BAD:
result = ISC_R_NOTFOUND;
break;
case 0:
result = ISC_R_SUCCESS;
break;
default:
result = ISC_R_FAILURE;
}
xfr_cleanup:
/* free any memory duplicate string in the key field */
if (key.data != NULL)
free(key.data);
/* free any memory allocated to the data field. */
if (data.data != NULL)
free(data.data);
/* get rid of zone_cursor */
if (client_cursor != NULL)
client_cursor->c_close(client_cursor);
return result;
}
static isc_result_t
bdb_allnodes(const char *zone, void *driverarg, void *dbdata,
dns_sdlzallnodes_t *allnodes)
{
isc_result_t result = ISC_R_NOTFOUND;
bdb_instance_t *db = (bdb_instance_t *) dbdata;
DBC *zone_cursor = NULL;
DBT key, data;
int flags;
int bdbres;
parsed_data_t pd;
char *tmp = NULL, *tmp_zone;
UNUSED(driverarg);
memset(&key, 0, sizeof(DBT));
memset(&data, 0, sizeof(DBT));
key.data = tmp_zone = strdup(zone);
if (key.data == NULL)
return (ISC_R_NOMEMORY);
key.size = strlen(key.data);
/* get a cursor to loop through zone data */
if (db->zone->cursor(db->zone, NULL, &zone_cursor, 0) != 0) {
result = ISC_R_FAILURE;
goto allnodes_cleanup;
}
flags = DB_SET;
while ((bdbres = zone_cursor->c_get(zone_cursor, &key, &data,
flags)) == 0) {
flags = DB_NEXT_DUP;
tmp = realloc(tmp, data.size + 1);
if (tmp == NULL)
goto allnodes_cleanup;
strncpy(tmp, data.data, data.size);
tmp[data.size] = '\0';
if (bdb_parse_data(tmp, &pd) != ISC_R_SUCCESS)
goto allnodes_cleanup;
result = dns_sdlz_putnamedrr(allnodes, pd.host, pd.type,
pd.ttl, pd.data);
if (result != ISC_R_SUCCESS)
goto allnodes_cleanup;
} /* end while loop */
allnodes_cleanup:
if (tmp != NULL)
free(tmp);
/* free any memory duplicate string in the key field */
if (tmp_zone != NULL)
free(tmp_zone);
/* get rid of zone_cursor */
if (zone_cursor != NULL)
zone_cursor->c_close(zone_cursor);
return result;
}
/*%
* Performs BDB cleanup.
* Used by bdb_create if there is an error starting up.
* Used by bdb_destroy when the driver is shutting down.
*/
static void
bdb_cleanup(bdb_instance_t *db) {
isc_mem_t *mctx;
/* close databases */
if (db->data != NULL)
db->data->close(db->data, 0);
if (db->host != NULL)
db->host->close(db->host, 0);
if (db->zone != NULL)
db->zone->close(db->zone, 0);
if (db->client != NULL)
db->client->close(db->client, 0);
/* close environment */
if (db->dbenv != NULL)
db->dbenv->close(db->dbenv, 0);
/* cleanup memory */
if (db->mctx != NULL) {
/* save mctx for later */
mctx = db->mctx;
/* return, and detach the memory */
isc_mem_put(mctx, db, sizeof(bdb_instance_t));
isc_mem_detach(&mctx);
}
}
static isc_result_t
bdb_findzone(void *driverarg, void *dbdata, const char *name)
{
isc_result_t result;
bdb_instance_t *db = (bdb_instance_t *) dbdata;
DBC *zone_cursor = NULL;
DBT key, data;
UNUSED(driverarg);
memset(&key, 0, sizeof(DBT));
memset(&data, 0, sizeof(DBT));
data.flags = DB_DBT_MALLOC;
key.data = strdup(name);
if (key.data == NULL)
return (ISC_R_NOMEMORY);
key.size = strlen(key.data);
/* get a cursor to loop through zone data */
if (db->zone->cursor(db->zone, NULL, &zone_cursor, 0) != 0) {
result = ISC_R_NOTFOUND;
goto findzone_cleanup;
}
switch(zone_cursor->c_get(zone_cursor, &key, &data, DB_SET)) {
case DB_NOTFOUND:
case DB_SECONDARY_BAD:
result = ISC_R_NOTFOUND;
break;
case 0:
result = ISC_R_SUCCESS;
break;
default:
result = ISC_R_FAILURE;
}
findzone_cleanup:
/* free any memory duplicate string in the key field */
if (key.data != NULL)
free(key.data);
/* free any memory allocated to the data field. */
if (data.data != NULL)
free(data.data);
/* get rid of zone_cursor */
if (zone_cursor != NULL)
zone_cursor->c_close(zone_cursor);
return result;
}
static isc_result_t
bdb_lookup(const char *zone, const char *name, void *driverarg,
void *dbdata, dns_sdlzlookup_t *lookup)
{
isc_result_t result = ISC_R_NOTFOUND;
bdb_instance_t *db = (bdb_instance_t *) dbdata;
DBC *zone_cursor = NULL;
DBC *host_cursor = NULL;
DBC *join_cursor = NULL;
DBT key, data;
DBC *cur_arr[3];
int bdbres;
parsed_data_t pd;
char *tmp_zone, *tmp_host = NULL;
char *tmp = NULL;
UNUSED(driverarg);
memset(&key, 0, sizeof(DBT));
memset(&data, 0, sizeof(DBT));
/* set zone key */
key.data = tmp_zone = strdup(zone);
if (key.data == NULL) {
result = ISC_R_NOMEMORY;
goto lookup_cleanup;
}
key.size = strlen(key.data);
/* get a cursor to loop through zone data */
if (db->zone->cursor(db->zone, NULL, &zone_cursor, 0) != 0) {
result = ISC_R_FAILURE;
goto lookup_cleanup;
}
/* initialize zone_cursor with zone_key */
if (zone_cursor->c_get(zone_cursor, &key, &data, DB_SET) != 0) {
result = ISC_R_NOTFOUND;
goto lookup_cleanup;
}
/* set host key */
key.data = tmp_host = strdup(name);
if (key.data == NULL) {
result = ISC_R_NOMEMORY;
goto lookup_cleanup;
}
key.size = strlen(key.data);
/* get a cursor to loop through host data */
if (db->host->cursor(db->host, NULL, &host_cursor, 0) != 0) {
result = ISC_R_FAILURE;
goto lookup_cleanup;
}
/* initialize host_cursor with host_key */
if (host_cursor->c_get(host_cursor, &key, &data, DB_SET) != 0) {
result = ISC_R_NOTFOUND;
goto lookup_cleanup;
}
cur_arr[0] = zone_cursor;
cur_arr[1] = host_cursor;
cur_arr[2] = NULL;
db->data->join(db->data, cur_arr, &join_cursor, 0);
while ((bdbres = join_cursor->c_get(join_cursor, &key,
&data, 0)) == 0) {
tmp = realloc(tmp, data.size + 1);
if (tmp == NULL)
goto lookup_cleanup;
strncpy(tmp, data.data, data.size);
tmp[data.size] = '\0';
if (bdb_parse_data(tmp, &pd) != ISC_R_SUCCESS)
goto lookup_cleanup;
result = dns_sdlz_putrr(lookup, pd.type, pd.ttl, pd.data);
if (result != ISC_R_SUCCESS)
goto lookup_cleanup;
} /* end while loop */
lookup_cleanup:
if (tmp != NULL)
free(tmp);
if (tmp_zone != NULL)
free(tmp_zone);
if (tmp_host != NULL)
free(tmp_host);
/* get rid of the joined cusor */
if (join_cursor != NULL)
join_cursor->c_close(join_cursor);
/* get rid of zone_cursor */
if (zone_cursor != NULL)
zone_cursor->c_close(zone_cursor);
/* get rid of host_cursor */
if (host_cursor != NULL)
host_cursor->c_close(host_cursor);
return result;
return ISC_R_NOTFOUND;
}
/*% Initializes, sets flags and then opens Berkeley databases. */
static isc_result_t
bdb_opendb(DB_ENV *db_env, DBTYPE db_type, DB **db, const char *db_name,
char *db_file, int flags) {
int result;
/* Initialize the database. */
if ((result = db_create(db, db_env, 0)) != 0) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"BDB could not initialize %s database. "
"BDB error: %s",
db_name, db_strerror(result));
return ISC_R_FAILURE;
}
/* set database flags. */
if ((result = (*db)->set_flags(*db, flags)) != 0) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"BDB could not set flags for %s database. "
"BDB error: %s",
db_name, db_strerror(result));
return ISC_R_FAILURE;
}
/* open the database. */
if ((result = (*db)->open(*db, NULL, db_file, db_name, db_type,
DB_RDONLY | bdb_threads, 0)) != 0) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"BDB could not open %s database in %s. "
"BDB error: %s",
db_name, db_file, db_strerror(result));
return ISC_R_FAILURE;
}
return ISC_R_SUCCESS;
}
static isc_result_t
bdb_create(const char *dlzname, unsigned int argc, char *argv[],
void *driverarg, void **dbdata)
{
isc_result_t result;
int bdbres;
bdb_instance_t *db = NULL;
UNUSED(dlzname);
UNUSED(driverarg);
/* verify we have 3 arg's passed to the driver */
if (argc != 3) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"Berkeley DB driver requires at least "
"2 command line args.");
return (ISC_R_FAILURE);
}
/* allocate and zero memory for driver structure */
db = isc_mem_get(ns_g_mctx, sizeof(bdb_instance_t));
if (db == NULL) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"Could not allocate memory for "
"database instance object.");
return (ISC_R_NOMEMORY);
}
memset(db, 0, sizeof(bdb_instance_t));
/* attach to the memory context */
isc_mem_attach(ns_g_mctx, &db->mctx);
/* create BDB environment
* Basically BDB allocates and assigns memory to db->dbenv
*/
bdbres = db_env_create(&db->dbenv, 0);
if (bdbres != 0) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"BDB environment could not be created. "
"BDB error: %s",
db_strerror(bdbres));
result = ISC_R_FAILURE;
goto init_cleanup;
}
/* open BDB environment */
bdbres = db->dbenv->open(db->dbenv, argv[1],
DB_INIT_CDB | DB_INIT_MPOOL |
bdb_threads | DB_CREATE,
0);
if (bdbres != 0) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"BDB environment at '%s' could not be opened. "
"BDB error: %s",
argv[1], db_strerror(bdbres));
result = ISC_R_FAILURE;
goto init_cleanup;
}
/* open dlz_data database. */
result = bdb_opendb(db->dbenv, DB_UNKNOWN, &db->data,
dlz_data, argv[2], 0);
if (result != ISC_R_SUCCESS)
goto init_cleanup;
/* open dlz_host database. */
result = bdb_opendb(db->dbenv, DB_UNKNOWN, &db->host,
dlz_host, argv[2],
DB_DUP | DB_DUPSORT);
if (result != ISC_R_SUCCESS)
goto init_cleanup;
/* open dlz_zone database. */
result = bdb_opendb(db->dbenv, DB_UNKNOWN, &db->zone,
dlz_zone, argv[2],
DB_DUP | DB_DUPSORT);
if (result != ISC_R_SUCCESS)
goto init_cleanup;
/* open dlz_client database. */
result = bdb_opendb(db->dbenv, DB_UNKNOWN, &db->client,
dlz_client, argv[2], DB_DUP | DB_DUPSORT);
if (result != ISC_R_SUCCESS)
goto init_cleanup;
/* associate the host secondary database with the primary database */
bdbres = db->data->associate(db->data, NULL, db->host, NULL, 0);
if (bdbres != 0) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"BDB could not associate %s database with %s. "
"BDB error: %s",
dlz_host, dlz_data, db_strerror(bdbres));
result = ISC_R_FAILURE;
goto init_cleanup;
}
/* associate the zone secondary database with the primary database */
bdbres = db->data->associate(db->data, NULL, db->zone, NULL, 0);
if (bdbres != 0) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"BDB could not associate %s database with %s. "
"BDB error: %s",
dlz_zone, dlz_data, db_strerror(bdbres));
result = ISC_R_FAILURE;
goto init_cleanup;
}
*dbdata = db;
return(ISC_R_SUCCESS);
init_cleanup:
bdb_cleanup(db);
return result;
}
static void
bdb_destroy(void *driverarg, void *dbdata)
{
UNUSED(driverarg);
bdb_cleanup((bdb_instance_t *) dbdata);
}
/* bdb_authority not needed as authority data is returned by lookup */
static dns_sdlzmethods_t dlz_bdb_methods = {
bdb_create,
bdb_destroy,
bdb_findzone,
bdb_lookup,
NULL,
bdb_allnodes,
bdb_allowzonexfr
};
/*%
* Wrapper around dns_sdlzregister().
*/
isc_result_t
dlz_bdb_init(void) {
isc_result_t result;
/*
* Write debugging message to log
*/
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
"Registering DLZ bdb driver.");
result = dns_sdlzregister("bdb", &dlz_bdb_methods, NULL,
DNS_SDLZFLAG_RELATIVEOWNER |
DNS_SDLZFLAG_RELATIVERDATA |
DNS_SDLZFLAG_THREADSAFE,
ns_g_mctx, &dlz_bdb);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"dns_sdlzregister() failed: %s",
isc_result_totext(result));
result = ISC_R_UNEXPECTED;
}
return result;
}
/*%
* Wrapper around dns_sdlzunregister().
*/
void
dlz_bdb_clear(void) {
/*
* Write debugging message to log
*/
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
"Unregistering DLZ bdb driver.");
if (dlz_bdb != NULL)
dns_sdlzunregister(&dlz_bdb);
}
#endif

View File

@@ -0,0 +1,860 @@
/*
* Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
*
* 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 STICHTING NLNET
* 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.
*/
/*
* 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 INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM 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_BDB
#include <config.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.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_bdbhpt_driver.h>
#include <db.h>
static dns_sdlzimplementation_t *dlz_bdbhpt = NULL;
/* should the bdb driver use threads. */
#ifdef ISC_PLATFORM_USETHREADS
#define bdbhpt_threads DB_THREAD
#else
#define bdbhpt_threads 0
#endif
/* bdbhpt database names */
#define dlz_data "dns_data"
#define dlz_zone "dns_zone"
#define dlz_xfr "dns_xfr"
#define dlz_client "dns_client"
/* This structure contains all the Berkeley DB handles
* for this instance of the bdbhpt driver.
*/
typedef struct bdbhpt_instance {
DB_ENV *dbenv; /*%< bdbhpt environment */
DB *data; /*%< dns_data database handle */
DB *zone; /*%< zone database handle */
DB *xfr; /*%< zone xfr database handle */
DB *client; /*%< client database handle */
isc_mem_t *mctx; /*%< memory context */
} bdbhpt_instance_t;
typedef struct bdbhpt_parsed_data {
char *host;
char *type;
int ttl;
char *data;
} bdbhpt_parsed_data_t;
/* forward reference */
static isc_result_t
bdbhpt_findzone(void *driverarg, void *dbdata, const char *name);
/*%
* Reverses a string in place.
*/
static char *bdbhpt_strrev(char *str)
{
char *p1, *p2;
if (! str || ! *str)
return str;
for (p1 = str, p2 = str + strlen(str) - 1; p2 > p1; ++p1, --p2)
{
*p1 ^= *p2;
*p2 ^= *p1;
*p1 ^= *p2;
}
return str;
}
/*%
* Parses the DBT from the Berkeley DB into a parsed_data record
* The parsed_data record should be allocated before and passed into the
* bdbhpt_parse_data function. The char (type & data) fields should not
* be "free"d as that memory is part of the DBT data field. It will be
* "free"d when the DBT is freed.
*/
static isc_result_t
bdbhpt_parse_data(char *in, bdbhpt_parsed_data_t *pd) {
char *endp, *ttlStr;
char *tmp = in;
char *lastchar = (char *) &tmp[strlen(tmp)];
/*%
* String should be formated as:
* replication_id
* (a space)
* host_name
* (a space)
* ttl
* (a space)
* type
* (a space)
* remaining data
*
* examples:
*
* 9191 host 10 A 127.0.0.1
* server1_212 host 10 A 127.0.0.2
* {xxxx-xxxx-xxxx-xxxx-xxxx} host 10 MX 20 mail.example.com
*/
/*
* we don't need the replication id, so don't
* bother saving a pointer to it.
*/
/* find space after replication id */
tmp = strchr(tmp, ' ');
/* verify we found a space */
if (tmp == NULL)
return ISC_R_FAILURE;
/* make sure it is safe to increment pointer */
if (++tmp > lastchar)
return ISC_R_FAILURE;
/* save pointer to host */
pd->host = tmp;
/* find space after host and change it to a '\0' */
tmp = strchr(tmp, ' ');
/* verify we found a space */
if (tmp == NULL)
return ISC_R_FAILURE;
/* change the space to a null (string terminator) */
tmp[0] = '\0';
/* make sure it is safe to increment pointer */
if (++tmp > lastchar)
return ISC_R_FAILURE;
/* save pointer to ttl string */
ttlStr = tmp;
/* find space after ttl and change it to a '\0' */
tmp = strchr(tmp, ' ');
/* verify we found a space */
if (tmp == NULL)
return ISC_R_FAILURE;
/* change the space to a null (string terminator) */
tmp[0] = '\0';
/* make sure it is safe to increment pointer */
if (++tmp > lastchar)
return ISC_R_FAILURE;
/* save pointer to dns type */
pd->type = tmp;
/* find space after type and change it to a '\0' */
tmp = strchr(tmp, ' ');
/* verify we found a space */
if (tmp == NULL)
return ISC_R_FAILURE;
/* change the space to a null (string terminator) */
tmp[0] = '\0';
/* make sure it is safe to increment pointer */
if (++tmp > lastchar)
return ISC_R_FAILURE;
/* save pointer to remainder of DNS data */
pd->data = tmp;
/* convert ttl string to integer */
pd->ttl = strtol(ttlStr, &endp, 10);
if (*endp != '\0' || pd->ttl < 0) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"bdbhpt driver ttl must be a postive number");
return ISC_R_FAILURE;
}
/* if we get this far everything should have worked. */
return ISC_R_SUCCESS;
}
/*
* DLZ methods
*/
static isc_result_t
bdbhpt_allowzonexfr(void *driverarg, void *dbdata, const char *name,
const char *client)
{
isc_result_t result;
bdbhpt_instance_t *db = (bdbhpt_instance_t *) dbdata;
DBT key, data;
/* check to see if we are authoritative for the zone first. */
result = bdbhpt_findzone(driverarg, dbdata, name);
if (result != ISC_R_SUCCESS)
return (ISC_R_NOTFOUND);
memset(&key, 0, sizeof(DBT));
key.flags = DB_DBT_MALLOC;
key.data = strdup(name);
if (key.data == NULL) {
result = ISC_R_NOMEMORY;
goto xfr_cleanup;
}
key.size = strlen(key.data);
memset(&data, 0, sizeof(DBT));
data.flags = DB_DBT_MALLOC;
data.data = strdup(client);
if (data.data == NULL) {
result = ISC_R_NOMEMORY;
goto xfr_cleanup;
}
data.size = strlen(data.data);
switch(db->client->get(db->client, NULL, &key, &data, DB_GET_BOTH)) {
case DB_NOTFOUND:
result = ISC_R_NOTFOUND;
break;
case 0:
result = ISC_R_SUCCESS;
break;
default:
result = ISC_R_FAILURE;
}
xfr_cleanup:
/* free any memory duplicate string in the key field */
if (key.data != NULL)
free(key.data);
/* free any memory allocated to the data field. */
if (data.data != NULL)
free(data.data);
return result;
}
/*%
* BDB does not allow a secondary index on a database that allows
* duplicates. We have a few options:
*
* 1) kill speed by having lookup method use a secondary db which
* is associated to the primary DB with the DNS data. Then have
* another secondary db for zone transfer which also points to
* the dns_data primary. NO - The point of this driver is
* lookup performance.
*
* 2) Blow up database size by storing DNS data twice. Once for
* the lookup (dns_data) database, and a second time for the zone
* transfer (dns_xfr) database. NO - That would probably require
* a larger cache to provide good performance. Also, that would
* make the DB larger on disk potentially slowing it as well.
*
* 3) Loop through the dns_xfr database with a cursor to get
* all the different hosts in a zone. Then use the zone & host
* together to lookup the data in the dns_data database. YES -
* This may slow down zone xfr's a little, but that's ok they
* don't happen as often and don't need to be as fast. We can
* also use this table when deleting a zone (The BDB driver
* is read only - the delete would be used during replication
* updates by a separate process).
*/
static isc_result_t
bdbhpt_allnodes(const char *zone, void *driverarg, void *dbdata,
dns_sdlzallnodes_t *allnodes)
{
isc_result_t result = ISC_R_NOTFOUND;
bdbhpt_instance_t *db = (bdbhpt_instance_t *) dbdata;
DBC *xfr_cursor = NULL;
DBC *dns_cursor = NULL;
DBT xfr_key, xfr_data, dns_key, dns_data;
int xfr_flags;
int dns_flags;
int bdbhptres;
bdbhpt_parsed_data_t pd;
char *tmp = NULL, *tmp_zone, *tmp_zone_host = NULL;
UNUSED(driverarg);
memset(&xfr_key, 0, sizeof(DBT));
memset(&xfr_data, 0, sizeof(DBT));
memset(&dns_key, 0, sizeof(DBT));
memset(&dns_data, 0, sizeof(DBT));
xfr_key.data = tmp_zone = strdup(zone);
if (xfr_key.data == NULL)
return (ISC_R_NOMEMORY);
xfr_key.size = strlen(xfr_key.data);
/* get a cursor to loop through dns_xfr table */
if (db->xfr->cursor(db->xfr, NULL, &xfr_cursor, 0) != 0) {
result = ISC_R_FAILURE;
goto allnodes_cleanup;
}
/* get a cursor to loop through dns_data table */
if (db->data->cursor(db->data, NULL, &dns_cursor, 0) != 0) {
result = ISC_R_FAILURE;
goto allnodes_cleanup;
}
xfr_flags = DB_SET;
/* loop through xfr table for specified zone. */
while ((bdbhptres = xfr_cursor->c_get(xfr_cursor, &xfr_key, &xfr_data,
xfr_flags)) == 0) {
xfr_flags = DB_NEXT_DUP;
/* +1 to allow for space between zone and host names */
dns_key.size = xfr_data.size + xfr_key.size + 1;
/* +1 to allow for null term at end of string. */
dns_key.data = tmp_zone_host = malloc(dns_key.size + 1);
if (dns_key.data == NULL)
goto allnodes_cleanup;
/*
* construct search key for dns_data.
* zone_name(a space)host_name
*/
strcpy(dns_key.data, zone);
strcat(dns_key.data, " ");
strncat(dns_key.data, xfr_data.data, xfr_data.size);
dns_flags = DB_SET;
while ((bdbhptres = dns_cursor->c_get(dns_cursor, &dns_key,
&dns_data,
dns_flags)) == 0) {
dns_flags = DB_NEXT_DUP;
/* +1 to allow for null term at end of string. */
tmp = realloc(tmp, dns_data.size + 1);
if (tmp == NULL)
goto allnodes_cleanup;
/* copy data to tmp string, and append null term. */
strncpy(tmp, dns_data.data, dns_data.size);
tmp[dns_data.size] = '\0';
/* split string into dns data parts. */
if (bdbhpt_parse_data(tmp, &pd) != ISC_R_SUCCESS)
goto allnodes_cleanup;
result = dns_sdlz_putnamedrr(allnodes, pd.host,
pd.type, pd.ttl, pd.data);
if (result != ISC_R_SUCCESS)
goto allnodes_cleanup;
} /* end inner while loop */
/* clean up memory */
if (tmp_zone_host != NULL) {
free(tmp_zone_host);
tmp_zone_host = NULL;
}
} /* end outer while loop */
allnodes_cleanup:
/* free any memory */
if (tmp != NULL)
free(tmp);
if (tmp_zone_host != NULL)
free(tmp_zone_host);
if (tmp_zone != NULL)
free(tmp_zone);
/* get rid of cursors */
if (xfr_cursor != NULL)
xfr_cursor->c_close(xfr_cursor);
if (dns_cursor != NULL)
dns_cursor->c_close(xfr_cursor);
return result;
}
/*%
* Performs bdbhpt cleanup.
* Used by bdbhpt_create if there is an error starting up.
* Used by bdbhpt_destroy when the driver is shutting down.
*/
static void
bdbhpt_cleanup(bdbhpt_instance_t *db) {
isc_mem_t *mctx;
/* close databases */
if (db->data != NULL)
db->data->close(db->data, 0);
if (db->xfr != NULL)
db->xfr->close(db->xfr, 0);
if (db->zone != NULL)
db->zone->close(db->zone, 0);
if (db->client != NULL)
db->client->close(db->client, 0);
/* close environment */
if (db->dbenv != NULL)
db->dbenv->close(db->dbenv, 0);
/* cleanup memory */
if (db->mctx != NULL) {
/* save mctx for later */
mctx = db->mctx;
/* return, and detach the memory */
isc_mem_put(mctx, db, sizeof(bdbhpt_instance_t));
isc_mem_detach(&mctx);
}
}
static isc_result_t
bdbhpt_findzone(void *driverarg, void *dbdata, const char *name)
{
isc_result_t result;
bdbhpt_instance_t *db = (bdbhpt_instance_t *) dbdata;
DBT key, data;
UNUSED(driverarg);
memset(&key, 0, sizeof(DBT));
memset(&data, 0, sizeof(DBT));
data.flags = DB_DBT_MALLOC;
key.data = strdup(name);
if (key.data == NULL)
return (ISC_R_NOMEMORY);
/*
* reverse string to take advantage of BDB locality of reference
* if we need futher lookups because the zone doesn't match the
* first time.
*/
key.data = bdbhpt_strrev(key.data);
key.size = strlen(key.data);
switch(db->zone->get(db->zone, NULL, &key, &data, 0)) {
case DB_NOTFOUND:
result = ISC_R_NOTFOUND;
break;
case 0:
result = ISC_R_SUCCESS;
break;
default:
result = ISC_R_FAILURE;
}
/* free any memory duplicate string in the key field */
if (key.data != NULL)
free(key.data);
/* free any memory allocated to the data field. */
if (data.data != NULL)
free(data.data);
return result;
}
static isc_result_t
bdbhpt_lookup(const char *zone, const char *name, void *driverarg,
void *dbdata, dns_sdlzlookup_t *lookup)
{
isc_result_t result = ISC_R_NOTFOUND;
bdbhpt_instance_t *db = (bdbhpt_instance_t *) dbdata;
DBC *data_cursor = NULL;
DBT key, data;
int bdbhptres;
int flags;
bdbhpt_parsed_data_t pd;
char *tmp = NULL;
char *keyStr = NULL;
UNUSED(driverarg);
memset(&key, 0, sizeof(DBT));
memset(&data, 0, sizeof(DBT));
key.size = strlen(zone) + strlen(name) + 1;
/* allocate mem for key */
key.data = keyStr = malloc((key.size + 1) * sizeof(char));
if (keyStr == NULL)
return ISC_R_NOMEMORY;
strcpy(keyStr, zone);
strcat(keyStr, " ");
strcat(keyStr, name);
/* get a cursor to loop through data */
if (db->data->cursor(db->data, NULL, &data_cursor, 0) != 0) {
result = ISC_R_FAILURE;
goto lookup_cleanup;
}
result = ISC_R_NOTFOUND;
flags = DB_SET;
while ((bdbhptres = data_cursor->c_get(data_cursor, &key, &data,
flags)) == 0) {
flags = DB_NEXT_DUP;
tmp = realloc(tmp, data.size + 1);
if (tmp == NULL)
goto lookup_cleanup;
strncpy(tmp, data.data, data.size);
tmp[data.size] = '\0';
if (bdbhpt_parse_data(tmp, &pd) != ISC_R_SUCCESS)
goto lookup_cleanup;
result = dns_sdlz_putrr(lookup, pd.type, pd.ttl, pd.data);
if (result != ISC_R_SUCCESS)
goto lookup_cleanup;
} /* end while loop */
lookup_cleanup:
/* get rid of cursor */
if (data_cursor != NULL)
data_cursor->c_close(data_cursor);
if (keyStr != NULL)
free(keyStr);
if (tmp != NULL)
free(tmp);
return result;
}
/*% Initializes, sets flags and then opens Berkeley databases. */
static isc_result_t
bdbhpt_opendb(DB_ENV *db_env, DBTYPE db_type, DB **db, const char *db_name,
char *db_file, int flags) {
int result;
/* Initialize the database. */
if ((result = db_create(db, db_env, 0)) != 0) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"bdbhpt could not initialize %s database. "
"bdbhpt error: %s",
db_name, db_strerror(result));
return ISC_R_FAILURE;
}
/* set database flags. */
if ((result = (*db)->set_flags(*db, flags)) != 0) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"bdbhpt could not set flags for %s database. "
"bdbhpt error: %s",
db_name, db_strerror(result));
return ISC_R_FAILURE;
}
/* open the database. */
if ((result = (*db)->open(*db, NULL, db_file, db_name, db_type,
DB_RDONLY | bdbhpt_threads, 0)) != 0) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"bdbhpt could not open %s database in %s. "
"bdbhpt error: %s",
db_name, db_file, db_strerror(result));
return ISC_R_FAILURE;
}
return ISC_R_SUCCESS;
}
static isc_result_t
bdbhpt_create(const char *dlzname, unsigned int argc, char *argv[],
void *driverarg, void **dbdata)
{
isc_result_t result;
int bdbhptres;
int bdbFlags = 0;
bdbhpt_instance_t *db = NULL;
UNUSED(dlzname);
UNUSED(driverarg);
/* verify we have 4 arg's passed to the driver */
if (argc != 4) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"bdbhpt driver requires at least "
"3 command line args.");
return (ISC_R_FAILURE);
}
switch((char) *argv[1]) {
/*
* Transactional mode. Highest safety - lowest speed.
*/
case 'T':
case 't':
bdbFlags = DB_INIT_MPOOL | DB_INIT_LOCK |
DB_INIT_LOG | DB_INIT_TXN;
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(1),
"bdbhpt driver using transactional mode.");
break;
/*
* Concurrent mode. Lower safety (no rollback) -
* higher speed.
*/
case 'C':
case 'c':
bdbFlags = DB_INIT_CDB | DB_INIT_MPOOL;
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(1),
"bdbhpt driver using concurrent mode.");
break;
/*
* Private mode. No inter-process communication & no locking.
* Lowest saftey - highest speed.
*/
case 'P':
case 'p':
bdbFlags = DB_PRIVATE | DB_INIT_MPOOL;
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(1),
"bdbhpt driver using private mode.");
break;
default:
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"bdbhpt driver requires the operating mode "
"be set to P or C or T. You specified '%s'",
argv[1]);
return (ISC_R_FAILURE);
}
/* allocate and zero memory for driver structure */
db = isc_mem_get(ns_g_mctx, sizeof(bdbhpt_instance_t));
if (db == NULL) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"Could not allocate memory for "
"database instance object.");
return (ISC_R_NOMEMORY);
}
memset(db, 0, sizeof(bdbhpt_instance_t));
/* attach to the memory context */
isc_mem_attach(ns_g_mctx, &db->mctx);
/*
* create bdbhpt environment
* Basically bdbhpt allocates and assigns memory to db->dbenv
*/
bdbhptres = db_env_create(&db->dbenv, 0);
if (bdbhptres != 0) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"bdbhpt environment could not be created. "
"bdbhpt error: %s",
db_strerror(bdbhptres));
result = ISC_R_FAILURE;
goto init_cleanup;
}
/* open bdbhpt environment */
bdbhptres = db->dbenv->open(db->dbenv, argv[2],
bdbFlags | bdbhpt_threads | DB_CREATE, 0);
if (bdbhptres != 0) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"bdbhpt environment at '%s' could not be opened."
" bdbhpt error: %s",
argv[2], db_strerror(bdbhptres));
result = ISC_R_FAILURE;
goto init_cleanup;
}
/* open dlz_data database. */
result = bdbhpt_opendb(db->dbenv, DB_UNKNOWN, &db->data,
dlz_data, argv[3], DB_DUP | DB_DUPSORT);
if (result != ISC_R_SUCCESS)
goto init_cleanup;
/* open dlz_xfr database. */
result = bdbhpt_opendb(db->dbenv, DB_UNKNOWN, &db->xfr,
dlz_xfr, argv[3], DB_DUP | DB_DUPSORT);
if (result != ISC_R_SUCCESS)
goto init_cleanup;
/* open dlz_zone database. */
result = bdbhpt_opendb(db->dbenv, DB_UNKNOWN, &db->zone,
dlz_zone, argv[3], 0);
if (result != ISC_R_SUCCESS)
goto init_cleanup;
/* open dlz_client database. */
result = bdbhpt_opendb(db->dbenv, DB_UNKNOWN, &db->client,
dlz_client, argv[3], DB_DUP | DB_DUPSORT);
if (result != ISC_R_SUCCESS)
goto init_cleanup;
*dbdata = db;
return(ISC_R_SUCCESS);
init_cleanup:
bdbhpt_cleanup(db);
return result;
}
static void
bdbhpt_destroy(void *driverarg, void *dbdata)
{
UNUSED(driverarg);
bdbhpt_cleanup((bdbhpt_instance_t *) dbdata);
}
/*
* bdbhpt_authority not needed as authority data is returned by lookup
*/
static dns_sdlzmethods_t dlz_bdbhpt_methods = {
bdbhpt_create,
bdbhpt_destroy,
bdbhpt_findzone,
bdbhpt_lookup,
NULL,
bdbhpt_allnodes,
bdbhpt_allowzonexfr
};
/*%
* Wrapper around dns_sdlzregister().
*/
isc_result_t
dlz_bdbhpt_init(void) {
isc_result_t result;
/*
* Write debugging message to log
*/
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
"Registering DLZ bdbhpt driver.");
result = dns_sdlzregister("bdbhpt", &dlz_bdbhpt_methods, NULL,
DNS_SDLZFLAG_RELATIVEOWNER |
DNS_SDLZFLAG_RELATIVERDATA |
DNS_SDLZFLAG_THREADSAFE,
ns_g_mctx, &dlz_bdbhpt);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"dns_sdlzregister() failed: %s",
isc_result_totext(result));
result = ISC_R_UNEXPECTED;
}
return result;
}
/*%
* Wrapper around dns_sdlzunregister().
*/
void
dlz_bdbhpt_clear(void) {
/*
* Write debugging message to log
*/
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
"Unregistering DLZ bdbhpt driver.");
if (dlz_bdbhpt != NULL)
dns_sdlzunregister(&dlz_bdbhpt);
}
#endif

View File

@@ -0,0 +1,157 @@
/*
* Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dlz_drivers.c,v 1.2 2005/09/05 00:10:55 marka Exp $ */
/*! \file */
#include <config.h>
#include <isc/result.h>
/*
* Pull in declarations for this module's functions.
*/
#include <dlz/dlz_drivers.h>
/*
* Pull in driver-specific stuff.
*/
#ifdef DLZ_STUB
#include <dlz/dlz_stub_driver.h>
#endif
#ifdef DLZ_POSTGRES
#include <dlz/dlz_postgres_driver.h>
#endif
#ifdef DLZ_MYSQL
#include <dlz/dlz_mysql_driver.h>
#endif
#ifdef DLZ_FILESYSTEM
#include <dlz/dlz_filesystem_driver.h>
#endif
#ifdef DLZ_BDB
#include <dlz/dlz_bdb_driver.h>
#include <dlz/dlz_bdbhpt_driver.h>
#endif
#ifdef DLZ_LDAP
#include <dlz/dlz_ldap_driver.h>
#endif
#ifdef DLZ_ODBC
#include <dlz/dlz_odbc_driver.h>
#endif
/*%
* Call init functions for all relevant DLZ drivers.
*/
isc_result_t
dlz_drivers_init(void) {
isc_result_t result = ISC_R_SUCCESS;
#ifdef DLZ_STUB
result = dlz_stub_init();
if (result != ISC_R_SUCCESS)
return (result);
#endif
#ifdef DLZ_POSTGRES
result = dlz_postgres_init();
if (result != ISC_R_SUCCESS)
return (result);
#endif
#ifdef DLZ_MYSQL
result = dlz_mysql_init();
if (result != ISC_R_SUCCESS)
return (result);
#endif
#ifdef DLZ_FILESYSTEM
result = dlz_fs_init();
if (result != ISC_R_SUCCESS)
return (result);
#endif
#ifdef DLZ_BDB
result = dlz_bdb_init();
if (result != ISC_R_SUCCESS)
return (result);
result = dlz_bdbhpt_init();
if (result != ISC_R_SUCCESS)
return (result);
#endif
#ifdef DLZ_LDAP
result = dlz_ldap_init();
if (result != ISC_R_SUCCESS)
return (result);
#endif
#ifdef DLZ_ODBC
result = dlz_odbc_init();
if (result != ISC_R_SUCCESS)
return (result);
#endif
return (result);
}
/*%
* Call shutdown functions for all relevant DLZ drivers.
*/
void
dlz_drivers_clear(void) {
#ifdef DLZ_STUB
dlz_stub_clear();
#endif
#ifdef DLZ_POSTGRES
dlz_postgres_clear();
#endif
#ifdef DLZ_MYSQL
dlz_mysql_clear();
#endif
#ifdef DLZ_FILESYSTEM
dlz_fs_clear();
#endif
#ifdef DLZ_BDB
dlz_bdb_clear();
dlz_bdbhpt_clear();
#endif
#ifdef DLZ_LDAP
dlz_ldap_clear();
#endif
#ifdef DLZ_ODBC
dlz_odbc_clear();
#endif
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,331 @@
/*
* Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
*
* 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 STICHTING NLNET
* 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.
*/
/*
* 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 INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM 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_STUB
#include <config.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.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_stub_driver.h>
static dns_sdlzimplementation_t *dlz_stub = NULL;
typedef struct config_data {
char *myzone;
char *myname;
char *myip;
isc_mem_t *mctx;
} config_data_t;
/*
* SDLZ methods
*/
static isc_result_t
stub_dlz_allnodes(const char *zone, void *driverarg, void *dbdata,
dns_sdlzallnodes_t *allnodes)
{
config_data_t *cd;
isc_result_t result;
UNUSED(zone);
UNUSED(driverarg);
cd = (config_data_t *) dbdata;
result = dns_sdlz_putnamedrr(allnodes, cd->myname, "soa", 86400,
"web root.localhost. "
"0 28800 7200 604800 86400");
if (result != ISC_R_SUCCESS)
return (ISC_R_FAILURE);
result = dns_sdlz_putnamedrr(allnodes, "ns", "ns", 86400, cd->myname);
if (result != ISC_R_SUCCESS)
return (ISC_R_FAILURE);
result = dns_sdlz_putnamedrr(allnodes, cd->myname, "a", 1, cd->myip);
if (result != ISC_R_SUCCESS)
return (ISC_R_FAILURE);
return (ISC_R_SUCCESS);
}
static isc_result_t
stub_dlz_allowzonexfr(void *driverarg, void *dbdata, const char *name,
const char *client)
{
UNUSED(driverarg);
UNUSED(dbdata);
UNUSED(name);
UNUSED(client);
return ISC_R_SUCCESS;
}
static isc_result_t
stub_dlz_authority(const char *zone, void *driverarg, void *dbdata,
dns_sdlzlookup_t *lookup)
{
isc_result_t result;
config_data_t *cd;
UNUSED(driverarg);
cd = (config_data_t *) dbdata;
if (strcmp(zone, cd->myzone) == 0) {
result = dns_sdlz_putsoa(lookup, cd->myname,
"root.localhost.", 0);
if (result != ISC_R_SUCCESS)
return (ISC_R_FAILURE);
result = dns_sdlz_putrr(lookup, "ns", 86400, cd->myname);
if (result != ISC_R_SUCCESS)
return (ISC_R_FAILURE);
return (ISC_R_SUCCESS);
}
return (ISC_R_NOTFOUND);
}
static isc_result_t
stub_dlz_findzonedb(void *driverarg, void *dbdata, const char *name)
{
config_data_t *cd;
UNUSED(driverarg);
cd = (config_data_t *) dbdata;
/* Write info message to log */
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
"dlz_stub findzone looking for '%s'", name);
if (strcmp(cd->myzone, name) == 0)
return (ISC_R_SUCCESS);
else
return (ISC_R_SUCCESS);
}
static isc_result_t
stub_dlz_lookup(const char *zone, const char *name, void *driverarg,
void *dbdata, dns_sdlzlookup_t *lookup)
{
isc_result_t result;
config_data_t *cd;
UNUSED(zone);
UNUSED(driverarg);
cd = (config_data_t *) dbdata;
if (strcmp(name, cd->myname) == 0) {
result = dns_sdlz_putrr(lookup, "a", 1, cd->myip);
if (result != ISC_R_SUCCESS)
return (ISC_R_FAILURE);
return (ISC_R_SUCCESS);
}
return (ISC_R_FAILURE);
}
static isc_result_t
stub_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
void *driverarg, void **dbdata)
{
config_data_t *cd;
UNUSED(driverarg);
if (argc < 4)
return (ISC_R_FAILURE);
/*
* Write info message to log
*/
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_INFO,
"Loading '%s' using DLZ_stub driver. "
"Zone: %s, Name: %s IP: %s",
dlzname, argv[1], argv[2], argv[3]);
cd = isc_mem_get(ns_g_mctx, sizeof(config_data_t));
if ((cd) == NULL) {
return (ISC_R_NOMEMORY);
}
memset(cd, 0, sizeof(config_data_t));
cd->myzone = isc_mem_strdup(ns_g_mctx, argv[1]);
if (cd->myzone == NULL) {
isc_mem_put(ns_g_mctx, cd, sizeof(config_data_t));
return (ISC_R_NOMEMORY);
}
cd->myname = isc_mem_strdup(ns_g_mctx, argv[2]);
if (cd->myname == NULL) {
isc_mem_put(ns_g_mctx, cd, sizeof(config_data_t));
isc_mem_free(ns_g_mctx, cd->myzone);
return (ISC_R_NOMEMORY);
}
cd->myip = isc_mem_strdup(ns_g_mctx, argv[3]);
if (cd->myip == NULL) {
isc_mem_put(ns_g_mctx, cd, sizeof(config_data_t));
isc_mem_free(ns_g_mctx, cd->myname);
isc_mem_free(ns_g_mctx, cd->myzone);
return (ISC_R_NOMEMORY);
}
isc_mem_attach(ns_g_mctx, &cd->mctx);
*dbdata = cd;
return(ISC_R_SUCCESS);
}
static void
stub_dlz_destroy(void *driverarg, void *dbdata)
{
config_data_t *cd;
isc_mem_t *mctx;
UNUSED(driverarg);
cd = (config_data_t *) dbdata;
/*
* Write debugging message to log
*/
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
"Unloading DLZ_stub driver.");
isc_mem_free(ns_g_mctx, cd->myzone);
isc_mem_free(ns_g_mctx, cd->myname);
isc_mem_free(ns_g_mctx, cd->myip);
mctx = cd->mctx;
isc_mem_put(mctx, cd, sizeof(config_data_t));
isc_mem_detach(&mctx);
}
static dns_sdlzmethods_t dlz_stub_methods = {
stub_dlz_create,
stub_dlz_destroy,
stub_dlz_findzonedb,
stub_dlz_lookup,
stub_dlz_authority,
stub_dlz_allnodes,
stub_dlz_allowzonexfr
};
/*%
* Wrapper around dns_sdlzregister().
*/
isc_result_t
dlz_stub_init(void) {
isc_result_t result;
/*
* Write debugging message to log
*/
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
"Registering DLZ_stub driver.");
result = dns_sdlzregister("dlz_stub", &dlz_stub_methods, NULL,
DNS_SDLZFLAG_RELATIVEOWNER |
DNS_SDLZFLAG_RELATIVERDATA,
ns_g_mctx, &dlz_stub);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"dns_sdlzregister() failed: %s",
isc_result_totext(result));
result = ISC_R_UNEXPECTED;
}
return result;
}
/*
* Wrapper around dns_sdlzunregister().
*/
void
dlz_stub_clear(void) {
/*
* Write debugging message to log
*/
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
"Unregistering DLZ_stub driver.");
if (dlz_stub != NULL)
dns_sdlzunregister(&dlz_stub);
}
#endif

View File

@@ -0,0 +1,45 @@
/*
* Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
*
* 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 STICHTING NLNET
* 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_BDB_DRIVER_H
#define DLZ_BDB_DRIVER_H
isc_result_t
dlz_bdb_init(void);
void
dlz_bdb_clear(void);
#endif

View File

@@ -0,0 +1,45 @@
/*
* Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
*
* 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 STICHTING NLNET
* 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_BDBHPT_DRIVER_H
#define DLZ_BDBHPT_DRIVER_H
isc_result_t
dlz_bdbhpt_init(void);
void
dlz_bdbhpt_clear(void);
#endif

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dlz_drivers.h,v 1.2 2005/09/05 00:10:58 marka Exp $ */
#ifndef DLZ_DRIVERS_H
#define DLZ_DRIVERS_H 1
/*! \file */
isc_result_t
dlz_drivers_init(void);
void
dlz_drivers_clear(void);
#endif /* DLZ_DRIVERS_H */

View File

@@ -0,0 +1,45 @@
/*
* Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
*
* 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 STICHTING NLNET
* 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_FILESYSTEM_DRIVER_H
#define DLZ_FILESYSTEM_DRIVER_H
isc_result_t
dlz_fs_init(void);
void
dlz_fs_clear(void);
#endif

View File

@@ -0,0 +1,45 @@
/*
* Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
*
* 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 STICHTING NLNET
* 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_LDAP_DRIVER_H
#define DLZ_LDAP_DRIVER_H
isc_result_t
dlz_ldap_init(void);
void
dlz_ldap_clear(void);
#endif

View File

@@ -0,0 +1,45 @@
/*
* Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
*
* 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 STICHTING NLNET
* 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_MYSQL_DRIVER_H
#define DLZ_MYSQL_DRIVER_H
isc_result_t
dlz_mysql_init(void);
void
dlz_mysql_clear(void);
#endif

View File

@@ -0,0 +1,45 @@
/*
* Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
*
* 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 STICHTING NLNET
* 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_ODBC_DRIVER_H
#define DLZ_ODBC_DRIVER_H
isc_result_t
dlz_odbc_init(void);
void
dlz_odbc_clear(void);
#endif

View File

@@ -0,0 +1,45 @@
/*
* Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
*
* 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 STICHTING NLNET
* 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_POSTGRES_DRIVER_H
#define DLZ_POSTGRES_DRIVER_H
isc_result_t
dlz_postgres_init(void);
void
dlz_postgres_clear(void);
#endif

View File

@@ -0,0 +1,45 @@
/*
* Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
*
* 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 STICHTING NLNET
* 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_STUB_DRIVER_H
#define DLZ_STUB_DRIVER_H
isc_result_t
dlz_stub_init(void);
void
dlz_stub_clear(void);
#endif

View File

@@ -0,0 +1,117 @@
/*
* Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
*
* 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 STICHTING NLNET
* 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 SDLZHELPER_H
#define SDLZHELPER_H
/*
* Types
*/
#define SDLZH_REQUIRE_CLIENT 0x01
#define SDLZH_REQUIRE_QUERY 0x02
#define SDLZH_REQUIRE_RECORD 0x04
#define SDLZH_REQUIRE_ZONE 0x08
typedef struct query_segment query_segment_t;
typedef ISC_LIST(query_segment_t) query_list_t;
typedef struct dbinstance dbinstance_t;
typedef ISC_LIST(dbinstance_t) db_list_t;
typedef struct driverinstance driverinstance_t;
/*%
* a query segment is all the text between our special tokens
* special tokens are %zone%, %record%, %client%
*/
struct query_segment {
void *sql;
unsigned int strlen;
isc_boolean_t direct;
ISC_LINK(query_segment_t) link;
};
/*%
* a database instance contains everything we need for running
* a query against the database. Using it each separate thread
* can dynamically construct a query and execute it against the
* database. The "instance_lock" and locking code in the driver's
* make sure no two threads try to use the same DBI at a time.
*/
struct dbinstance {
void *dbconn;
query_list_t *allnodes_q;
query_list_t *allowxfr_q;
query_list_t *authority_q;
query_list_t *findzone_q;
query_list_t *lookup_q;
query_list_t *countzone_q;
char *query_buf;
char *zone;
char *record;
char *client;
isc_mem_t *mctx;
isc_mutex_t instance_lock;
ISC_LINK(dbinstance_t) link;
};
/*
* Method declarations
*/
/* see the code in sdlz_helper.c for more information on these methods */
char *
sdlzh_build_querystring(isc_mem_t *mctx, query_list_t *querylist);
isc_result_t
sdlzh_build_sqldbinstance(isc_mem_t *mctx, const char *allnodes_str,
const char *allowxfr_str, const char *authority_str,
const char *findzone_str, const char *lookup_str,
const char *countzone_str, dbinstance_t **dbi);
void
sdlzh_destroy_sqldbinstance(dbinstance_t *dbi);
char *
sdlzh_get_parameter_value(isc_mem_t *mctx, const char *input, const char* key);
/* Compatability with existing DLZ drivers */
#define build_querystring sdlzh_build_querystring
#define build_sqldbinstance sdlzh_build_sqldbinstance
#define destroy_sqldbinstance sdlzh_destroy_sqldbinstance
#define getParameterValue(x,y) sdlzh_get_parameter_value(ns_g_mctx, (x), (y))
#endif /* SDLZHELPER_H */

View File

@@ -0,0 +1,47 @@
# Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC")
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: rules.in,v 1.2 2005/09/05 00:10:57 marka Exp $
dlz_drivers.@O@: ${DLZ_DRIVER_DIR}/dlz_drivers.c ${DLZ_DRIVER_DIR}/include/dlz/dlz_drivers.h
${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c ${DLZ_DRIVER_DIR}/dlz_drivers.c
sdlz_helper.@O@: ${DLZ_DRIVER_DIR}/sdlz_helper.c ${DLZ_DRIVER_DIR}/include/dlz/sdlz_helper.h
${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c ${DLZ_DRIVER_DIR}/sdlz_helper.c
dlz_bdb_driver.@O@: ${DLZ_DRIVER_DIR}/dlz_bdb_driver.c ${DLZ_DRIVER_DIR}/include/dlz/dlz_bdb_driver.h
${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c ${DLZ_DRIVER_DIR}/dlz_bdb_driver.c
dlz_bdbhpt_driver.@O@: ${DLZ_DRIVER_DIR}/dlz_bdbhpt_driver.c ${DLZ_DRIVER_DIR}/include/dlz/dlz_bdbhpt_driver.h
${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c ${DLZ_DRIVER_DIR}/dlz_bdbhpt_driver.c
dlz_filesystem_driver.@O@: ${DLZ_DRIVER_DIR}/dlz_filesystem_driver.c ${DLZ_DRIVER_DIR}/include/dlz/dlz_filesystem_driver.h
${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c ${DLZ_DRIVER_DIR}/dlz_filesystem_driver.c
dlz_ldap_driver.@O@: ${DLZ_DRIVER_DIR}/dlz_ldap_driver.c ${DLZ_DRIVER_DIR}/include/dlz/dlz_ldap_driver.h
${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c ${DLZ_DRIVER_DIR}/dlz_ldap_driver.c
dlz_mysql_driver.@O@: ${DLZ_DRIVER_DIR}/dlz_mysql_driver.c ${DLZ_DRIVER_DIR}/include/dlz/dlz_mysql_driver.h
${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c ${DLZ_DRIVER_DIR}/dlz_mysql_driver.c
dlz_odbc_driver.@O@: ${DLZ_DRIVER_DIR}/dlz_odbc_driver.c ${DLZ_DRIVER_DIR}/include/dlz/dlz_odbc_driver.h
${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c ${DLZ_DRIVER_DIR}/dlz_odbc_driver.c
dlz_postgres_driver.@O@: ${DLZ_DRIVER_DIR}/dlz_postgres_driver.c ${DLZ_DRIVER_DIR}/include/dlz/dlz_postgres_driver.h
${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c ${DLZ_DRIVER_DIR}/dlz_postgres_driver.c
dlz_stub_driver.@O@: ${DLZ_DRIVER_DIR}/dlz_stub_driver.c ${DLZ_DRIVER_DIR}/include/dlz/dlz_stub_driver.h
${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c ${DLZ_DRIVER_DIR}/dlz_stub_driver.c

View File

@@ -0,0 +1,531 @@
/*
* Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
*
* 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 STICHTING NLNET
* 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.
*/
/*
* 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 INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM 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
#include <config.h>
#include <dns/log.h>
#include <dns/result.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/util.h>
#include <dlz/sdlz_helper.h>
/*
* sdlz helper methods
*/
/*%
* properly destroys a querylist by de-allocating the
* memory for each query segment, and then the list itself
*/
static void
destroy_querylist(isc_mem_t *mctx, query_list_t **querylist)
{
query_segment_t *tseg = NULL;
query_segment_t *nseg = NULL;
REQUIRE(mctx != NULL);
/* if query list is null, nothing to do */
if (*querylist == NULL)
return;
/* start at the top of the list */
nseg = ISC_LIST_HEAD(**querylist);
while (nseg != NULL) { /* loop, until end of list */
tseg = nseg;
/*
* free the query segment's text string but only if it
* was really a query segment, and not a pointer to
* %zone%, or %record%, or %client%
*/
if (tseg->sql != NULL && tseg->direct == isc_boolean_true)
isc_mem_free(mctx, tseg->sql);
/* get the next query segment, before we destroy this one. */
nseg = ISC_LIST_NEXT(nseg, link);
/* deallocate this query segment. */
isc_mem_put(mctx, tseg, sizeof(query_segment_t));
}
/* deallocate the query segment list */
isc_mem_put(mctx, *querylist, sizeof(query_list_t));
}
/*% constructs a query list by parsing a string into query segments */
static isc_result_t
build_querylist(isc_mem_t *mctx, const char *query_str, char **zone,
char **record, char **client, query_list_t **querylist,
unsigned int flags)
{
isc_result_t result;
isc_boolean_t foundzone = isc_boolean_false;
isc_boolean_t foundrecord = isc_boolean_false;
isc_boolean_t foundclient = isc_boolean_false;
char *temp_str = NULL;
char *right_str = NULL;
query_list_t *tql;
query_segment_t *tseg = NULL;
REQUIRE(querylist != NULL && *querylist == NULL);
REQUIRE(mctx != NULL);
/* if query string is null, or zero length */
if (query_str == NULL || strlen(query_str) < 1) {
if ((flags & SDLZH_REQUIRE_QUERY) == 0)
/* we don't need it were ok. */
return (ISC_R_SUCCESS);
else
/* we did need it, PROBLEM!!! */
return (ISC_R_FAILURE);
}
/* allocate memory for query list */
tql = isc_mem_get(mctx, sizeof(query_list_t));
/* couldn't allocate memory. Problem!! */
if (tql == NULL)
return (ISC_R_NOMEMORY);
/* initialize the query segment list */
ISC_LIST_INIT(*tql);
/* make a copy of query_str so we can chop it up */
temp_str = right_str = isc_mem_strdup(mctx, query_str);
/* couldn't make a copy, problem!! */
if (right_str == NULL) {
result = ISC_R_NOMEMORY;
goto cleanup;
}
/* loop through the string and chop it up */
while (right_str != NULL) {
/* allocate memory for tseg */
tseg = isc_mem_get(mctx, sizeof(query_segment_t));
if (tseg == NULL) { /* no memory, clean everything up. */
result = ISC_R_NOMEMORY;
goto cleanup;
}
tseg->sql = NULL;
tseg->direct = isc_boolean_false;
/* initialize the query segment link */
ISC_LINK_INIT(tseg, link);
/* append the query segment to the list */
ISC_LIST_APPEND(*tql, tseg, link);
/*
* split string at the first "%". set query segment to
* left portion
*/
tseg->sql = isc_mem_strdup(mctx,
isc_string_separate(&right_str,
"%"));
if (tseg->sql == NULL) {
/* no memory, clean everything up. */
result = ISC_R_NOMEMORY;
goto cleanup;
}
/* tseg->sql points directly to a string. */
tseg->direct = isc_boolean_true;
tseg->strlen = strlen(tseg->sql);
/* check if we encountered "%zone%" token */
if (strcasecmp(tseg->sql, "zone") == 0) {
/*
* we don't really need, or want the "zone"
* text, so get rid of it.
*/
isc_mem_free(mctx, tseg->sql);
/* set tseg->sql to in-direct zone string */
tseg->sql = (char**) zone;
tseg->strlen = 0;
/* tseg->sql points in-directly to a string */
tseg->direct = isc_boolean_false;
foundzone = isc_boolean_true;
/* check if we encountered "%record%" token */
} else if (strcasecmp(tseg->sql, "record") == 0) {
/*
* we don't really need, or want the "record"
* text, so get rid of it.
*/
isc_mem_free(mctx, tseg->sql);
/* set tseg->sql to in-direct record string */
tseg->sql = (char**) record;
tseg->strlen = 0;
/* tseg->sql points in-directly poinsts to a string */
tseg->direct = isc_boolean_false;
foundrecord = isc_boolean_true;
/* check if we encountered "%client%" token */
} else if (strcasecmp(tseg->sql, "client") == 0) {
/*
* we don't really need, or want the "client"
* text, so get rid of it.
*/
isc_mem_free(mctx, tseg->sql);
/* set tseg->sql to in-direct record string */
tseg->sql = (char**) client;
tseg->strlen = 0;
/* tseg->sql points in-directly poinsts to a string */
tseg->direct = isc_boolean_false;
foundclient = isc_boolean_true;
}
}
/* we don't need temp_str any more */
isc_mem_free(mctx, temp_str);
/*
* add checks later to verify zone and record are found if
* necessary.
*/
/* if this query requires %client%, make sure we found it */
if (((flags & SDLZH_REQUIRE_CLIENT) != 0) && (!foundclient) ) {
/* Write error message to log */
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"Required token %%client%% not found.");
result = ISC_R_FAILURE;
goto flag_fail;
}
/* if this query requires %record%, make sure we found it */
if (((flags & SDLZH_REQUIRE_RECORD) != 0) && (!foundrecord) ) {
/* Write error message to log */
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"Required token %%record%% not found.");
result = ISC_R_FAILURE;
goto flag_fail;
}
/* if this query requires %zone%, make sure we found it */
if (((flags & SDLZH_REQUIRE_ZONE) != 0) && (!foundzone) ) {
/* Write error message to log */
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"Required token %%zone%% not found.");
result = ISC_R_FAILURE;
goto flag_fail;
}
/* pass back the query list */
*querylist = (query_list_t *) tql;
/* return success */
return (ISC_R_SUCCESS);
cleanup:
/* get rid of temp_str */
if (temp_str != NULL)
isc_mem_free(mctx, temp_str);
flag_fail:
/* get rid of what was build of the query list */
if (tql != NULL)
destroy_querylist(mctx, &tql);
return result;
}
/*%
* build a query string from query segments, and dynamic segments
* dynamic segments replace where the tokens %zone%, %record%, %client%
* used to be in our queries from named.conf
*/
char *
sdlzh_build_querystring(isc_mem_t *mctx, query_list_t *querylist)
{
query_segment_t *tseg = NULL;
unsigned int length = 0;
char *qs = NULL;
REQUIRE(mctx != NULL);
REQUIRE(querylist != NULL);
/* start at the top of the list */
tseg = ISC_LIST_HEAD(*querylist);
while (tseg != NULL) {
/*
* if this is a query segment, use the
* precalculated string length
*/
if (tseg->direct == isc_boolean_true)
length += tseg->strlen;
else /* calculate string length for dynamic segments. */
length += strlen(* (char**) tseg->sql);
/* get the next segment */
tseg = ISC_LIST_NEXT(tseg, link);
}
/* allocate memory for the string */
qs = isc_mem_allocate(mctx, length + 1);
/* couldn't allocate memory, We need more ram! */
if (qs == NULL)
return NULL;
/* start at the top of the list again */
tseg = ISC_LIST_HEAD(*querylist);
/* copy the first item in the list to the query string */
if (tseg->direct == isc_boolean_true) /* query segment */
strcpy(qs, tseg->sql);
else
strcpy(qs, * (char**) tseg->sql); /* dynamic segment */
/* concatonate the rest of the segments */
while ((tseg = ISC_LIST_NEXT(tseg, link)) != NULL) {
if (tseg->direct == isc_boolean_true)
/* query segments */
strcat(qs, tseg->sql);
else
/* dynamic segments */
strcat(qs, * (char**) tseg->sql);
}
return qs;
}
/*% constructs a sql dbinstance (DBI) */
isc_result_t
sdlzh_build_sqldbinstance(isc_mem_t *mctx, const char *allnodes_str,
const char *allowxfr_str, const char *authority_str,
const char *findzone_str, const char *lookup_str,
const char *countzone_str, dbinstance_t **dbi)
{
isc_result_t result;
dbinstance_t *db = NULL;
REQUIRE(dbi != NULL && *dbi == NULL);
REQUIRE(mctx != NULL);
/* allocate and zero memory for driver structure */
db = isc_mem_get(mctx, sizeof(dbinstance_t));
if (db == NULL) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"Could not allocate memory for "
"database instance object.");
return (ISC_R_NOMEMORY);
}
memset(db, 0, sizeof(dbinstance_t));
db->dbconn = NULL;
db->client = NULL;
db->record = NULL;
db->zone = NULL;
db->mctx = NULL;
db->query_buf = NULL;
db->allnodes_q = NULL;
db->allowxfr_q = NULL;
db->authority_q = NULL;
db->findzone_q = NULL;
db->countzone_q = NULL;
db->lookup_q = NULL;
/* attach to the memory context */
isc_mem_attach(mctx, &db->mctx);
/* initialize the reference count mutex */
result = isc_mutex_init(&db->instance_lock);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"isc_mutex_init() failed: %s",
isc_result_totext(result));
goto cleanup;
}
/* build the all nodes query list */
result = build_querylist(mctx, allnodes_str, &db->zone,
&db->record, &db->client,
&db->allnodes_q, SDLZH_REQUIRE_ZONE);
/* if unsuccessful, log err msg and cleanup */
if (result != ISC_R_SUCCESS) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"Could not build all nodes query list");
goto cleanup;
}
/* build the allow zone transfer query list */
result = build_querylist(mctx, allowxfr_str, &db->zone,
&db->record, &db->client,
&db->allowxfr_q,
SDLZH_REQUIRE_ZONE | SDLZH_REQUIRE_CLIENT);
/* if unsuccessful, log err msg and cleanup */
if (result != ISC_R_SUCCESS) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"Could not build allow xfr query list");
goto cleanup;
}
/* build the authority query, query list */
result = build_querylist(mctx, authority_str, &db->zone,
&db->record, &db->client,
&db->authority_q, SDLZH_REQUIRE_ZONE);
/* if unsuccessful, log err msg and cleanup */
if (result != ISC_R_SUCCESS) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"Could not build authority query list");
goto cleanup;
}
/* build findzone query, query list */
result = build_querylist(mctx, findzone_str, &db->zone,
&db->record, &db->client,
&db->findzone_q, SDLZH_REQUIRE_ZONE);
/* if unsuccessful, log err msg and cleanup */
if (result != ISC_R_SUCCESS) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"Could not build find zone query list");
goto cleanup;
}
/* build countzone query, query list */
result = build_querylist(mctx, countzone_str, &db->zone,
&db->record, &db->client,
&db->countzone_q, SDLZH_REQUIRE_ZONE);
/* if unsuccessful, log err msg and cleanup */
if (result != ISC_R_SUCCESS) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"Could not build count zone query list");
goto cleanup;
}
/* build lookup query, query list */
result = build_querylist(mctx, lookup_str, &db->zone,
&db->record, &db->client,
&db->lookup_q, SDLZH_REQUIRE_RECORD);
/* if unsuccessful, log err msg and cleanup */
if (result != ISC_R_SUCCESS) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"Could not build lookup query list");
goto cleanup;
}
/* pass back the db instance */
*dbi = (dbinstance_t *) db;
/* return success */
return (ISC_R_SUCCESS);
cleanup:
/* destroy whatever was build of the db instance */
destroy_sqldbinstance(db);
/* return failure */
return (ISC_R_FAILURE);
}
void
sdlzh_destroy_sqldbinstance(dbinstance_t *dbi)
{
isc_mem_t *mctx;
/* save mctx for later */
mctx = dbi->mctx;
/* destroy any query lists we created */
destroy_querylist(mctx, &dbi->allnodes_q);
destroy_querylist(mctx, &dbi->allowxfr_q);
destroy_querylist(mctx, &dbi->authority_q);
destroy_querylist(mctx, &dbi->findzone_q);
destroy_querylist(mctx, &dbi->countzone_q);
destroy_querylist(mctx, &dbi->lookup_q);
/* get rid of the mutex */
isc_mutex_destroy(&dbi->instance_lock);
/* return, and detach the memory */
isc_mem_put(mctx, dbi, sizeof(dbinstance_t));
isc_mem_detach(&mctx);
}
char *
sdlzh_get_parameter_value(isc_mem_t *mctx, const char *input, const char* key)
{
int keylen;
char *keystart;
char value[255];
int i;
if (key == NULL || input == NULL || strlen(input) < 1)
return NULL;
keylen = strlen(key);
if (keylen < 1)
return NULL;
keystart = strstr(input, key);
if (keystart == NULL)
return NULL;
REQUIRE(mctx != NULL);
for (i = 0; i < 255; i++) {
value[i] = keystart[keylen + i];
if (value[i] == ' ' || value[i] == '\0') {
value[i] = '\0';
break;
}
}
return isc_mem_strdup(mctx, value);
}
#endif

View File

@@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE. # PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.151 2005/07/18 23:59:36 marka Exp $ # $Id: Makefile.in,v 1.152 2005/09/05 00:11:01 marka Exp $
srcdir = @srcdir@ srcdir = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
@@ -52,14 +52,15 @@ DSTOBJS = dst_api.@O@ dst_lib.@O@ dst_parse.@O@ dst_result.@O@ \
DNSOBJS = acache.@O@ acl.@O@ adb.@O@ byaddr.@O@ \ DNSOBJS = acache.@O@ acl.@O@ adb.@O@ byaddr.@O@ \
cache.@O@ callbacks.@O@ compress.@O@ \ cache.@O@ callbacks.@O@ compress.@O@ \
db.@O@ dbiterator.@O@ dbtable.@O@ diff.@O@ dispatch.@O@ \ db.@O@ dbiterator.@O@ dbtable.@O@ diff.@O@ dispatch.@O@ \
dnssec.@O@ ds.@O@ forward.@O@ journal.@O@ keytable.@O@ \ dlz.@O@ dnssec.@O@ ds.@O@ forward.@O@ journal.@O@ keytable.@O@ \
lib.@O@ log.@O@ lookup.@O@ \ lib.@O@ log.@O@ lookup.@O@ \
master.@O@ masterdump.@O@ message.@O@ \ master.@O@ masterdump.@O@ message.@O@ \
name.@O@ ncache.@O@ nsec.@O@ order.@O@ peer.@O@ portlist.@O@ \ name.@O@ ncache.@O@ nsec.@O@ order.@O@ peer.@O@ portlist.@O@ \
rbt.@O@ rbtdb.@O@ rbtdb64.@O@ rcode.@O@ rdata.@O@ \ rbt.@O@ rbtdb.@O@ rbtdb64.@O@ rcode.@O@ rdata.@O@ \
rdatalist.@O@ \ rdatalist.@O@ \
rdataset.@O@ rdatasetiter.@O@ rdataslab.@O@ request.@O@ \ rdataset.@O@ rdatasetiter.@O@ rdataslab.@O@ request.@O@ \
resolver.@O@ result.@O@ rootns.@O@ sdb.@O@ soa.@O@ ssu.@O@ \ resolver.@O@ result.@O@ rootns.@O@ sdb.@O@ sdlz.@O@ \
soa.@O@ ssu.@O@ \
stats.@O@ tcpmsg.@O@ time.@O@ timer.@O@ tkey.@O@ \ stats.@O@ tcpmsg.@O@ time.@O@ timer.@O@ tkey.@O@ \
tsig.@O@ ttl.@O@ validator.@O@ \ tsig.@O@ ttl.@O@ validator.@O@ \
version.@O@ view.@O@ xfrin.@O@ zone.@O@ zonekey.@O@ zt.@O@ version.@O@ view.@O@ xfrin.@O@ zone.@O@ zonekey.@O@ zt.@O@
@@ -76,14 +77,15 @@ DSTSRCS = dst_api.c dst_lib.c dst_parse.c \
DNSSRCS = acache.c acl.c adb.c byaddr.c \ DNSSRCS = acache.c acl.c adb.c byaddr.c \
cache.c callbacks.c compress.c \ cache.c callbacks.c compress.c \
db.c dbiterator.c dbtable.c diff.c dispatch.c \ db.c dbiterator.c dbtable.c diff.c dispatch.c \
dnssec.c ds.c forward.c journal.c keytable.c \ dlz.c dnssec.c ds.c forward.c journal.c keytable.c \
lib.c log.c lookup.c \ lib.c log.c lookup.c \
master.c masterdump.c message.c \ master.c masterdump.c message.c \
name.c ncache.c nsec.c order.c peer.c portlist.c \ name.c ncache.c nsec.c order.c peer.c portlist.c \
rbt.c rbtdb.c rbtdb64.c rcode.c rdata.c \ rbt.c rbtdb.c rbtdb64.c rcode.c rdata.c \
rdatalist.c \ rdatalist.c \
rdataset.c rdatasetiter.c rdataslab.c request.c \ rdataset.c rdatasetiter.c rdataslab.c request.c \
resolver.c result.c rootns.c sdb.c soa.c ssu.c \ resolver.c result.c rootns.c sdb.c sdlz.c \
soa.c ssu.c \
stats.c tcpmsg.c time.c timer.c tkey.c \ stats.c tcpmsg.c time.c timer.c tkey.c \
tsig.c ttl.c validator.c \ tsig.c ttl.c validator.c \
version.c view.c xfrin.c zone.c zonekey.c zt.c ${OTHERSRCS} version.c view.c xfrin.c zone.c zonekey.c zt.c ${OTHERSRCS}

510
lib/dns/dlz.c Normal file
View File

@@ -0,0 +1,510 @@
/*
* Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
*
* 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 STICHTING NLNET
* 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.
*/
/*
* 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 INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM 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: dlz.c,v 1.2 2005/09/05 00:11:01 marka Exp $ */
/*! \file */
/***
*** Imports
***/
#include <config.h>
#include <dns/fixedname.h>
#include <dns/log.h>
#include <dns/master.h>
#include <dns/dlz.h>
#include <isc/buffer.h>
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/once.h>
#include <isc/rwlock.h>
#include <isc/string.h>
#include <isc/util.h>
/***
*** Supported DLZ DB Implementations Registry
***/
static ISC_LIST(dns_dlzimplementation_t) dlz_implementations;
static isc_rwlock_t dlz_implock;
static isc_once_t once = ISC_ONCE_INIT;
static void
dlz_initialize(void) {
RUNTIME_CHECK(isc_rwlock_init(&dlz_implock, 0, 0) == ISC_R_SUCCESS);
ISC_LIST_INIT(dlz_implementations);
}
/*%
* Searches the dlz_implementations list for a driver matching name.
*/
static inline dns_dlzimplementation_t *
dlz_impfind(const char *name) {
dns_dlzimplementation_t *imp;
for (imp = ISC_LIST_HEAD(dlz_implementations);
imp != NULL;
imp = ISC_LIST_NEXT(imp, link))
if (strcasecmp(name, imp->name) == 0)
return (imp);
return (NULL);
}
/***
*** Basic DLZ Methods
***/
isc_result_t
dns_dlzallowzonexfr(dns_view_t *view, dns_name_t *name,
isc_sockaddr_t *clientaddr, dns_db_t **dbp)
{
isc_result_t result;
dns_dlzallowzonexfr_t allowzonexfr;
dns_dlzdb_t *dlzdatabase;
/*
* Performs checks to make sure data is as we expect it to be.
*/
REQUIRE(DNS_DLZ_VALID(view->dlzdatabase));
REQUIRE(name != NULL);
REQUIRE(dbp != NULL && *dbp == NULL);
/* ask driver if the zone is supported */
dlzdatabase = view->dlzdatabase;
allowzonexfr = dlzdatabase->implementation->methods->allowzonexfr;
result = (*allowzonexfr)(dlzdatabase->implementation->driverarg,
dlzdatabase->dbdata, dlzdatabase->mctx,
view->rdclass, name, clientaddr, dbp);
if (result == ISC_R_NOTIMPLEMENTED)
return (ISC_R_NOTFOUND);
return (result);
}
isc_result_t
dns_dlzcreate(isc_mem_t *mctx, const char *dlzname, const char *drivername,
unsigned int argc, char *argv[], dns_dlzdb_t **dbp)
{
dns_dlzimplementation_t *impinfo;
isc_result_t result;
/*
* initialize the dlz_implementations list, this is guaranteed
* to only really happen once.
*/
RUNTIME_CHECK(isc_once_do(&once, dlz_initialize) == ISC_R_SUCCESS);
/*
* Performs checks to make sure data is as we expect it to be.
*/
REQUIRE(dbp != NULL && *dbp == NULL);
REQUIRE(dlzname != NULL);
REQUIRE(drivername != NULL);
REQUIRE(mctx != NULL);
/* write log message */
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_INFO,
"Loading '%s' using driver %s", dlzname, drivername);
/* lock the dlz_implementations list so we can search it. */
RWLOCK(&dlz_implock, isc_rwlocktype_read);
/* search for the driver implementation */
impinfo = dlz_impfind(drivername);
if (impinfo == NULL) {
RWUNLOCK(&dlz_implock, isc_rwlocktype_read);
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"unsupported DLZ database driver '%s'."
" %s not loaded.",
drivername, dlzname);
return (ISC_R_NOTFOUND);
}
/* Allocate memory to hold the DLZ database driver */
(*dbp) = isc_mem_get(mctx, sizeof(dns_dlzdb_t));
if ((*dbp) == NULL) {
RWUNLOCK(&dlz_implock, isc_rwlocktype_read);
return (ISC_R_NOMEMORY);
}
/* Make sure memory region is set to all 0's */
memset((*dbp), 0, sizeof(dns_dlzdb_t));
(*dbp)->implementation = impinfo;
/* Create a new database using implementation 'drivername'. */
result = ((impinfo->methods->create)(mctx, dlzname, argc, argv,
impinfo->driverarg,
&(*dbp)->dbdata));
/* mark the DLZ driver as valid */
if (result == ISC_R_SUCCESS) {
RWUNLOCK(&dlz_implock, isc_rwlocktype_read);
(*dbp)->magic = DNS_DLZ_MAGIC;
isc_mem_attach(mctx, &(*dbp)->mctx);
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
"DLZ driver loaded successfully.");
return (ISC_R_SUCCESS);
} else {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
"DLZ driver failed to load.");
}
/* impinfo->methods->create failed. */
RWUNLOCK(&dlz_implock, isc_rwlocktype_read);
isc_mem_put(mctx, (*dbp), sizeof(dns_dlzdb_t));
return (result);
}
void
dns_dlzdestroy(dns_dlzdb_t **dbp) {
isc_mem_t *mctx;
dns_dlzdestroy_t destroy;
/* Write debugging message to log */
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
"Unloading DLZ driver.");
/*
* Perform checks to make sure data is as we expect it to be.
*/
REQUIRE(dbp != NULL && DNS_DLZ_VALID(*dbp));
/* call the drivers destroy method */
if ((*dbp) != NULL) {
mctx = (*dbp)->mctx;
destroy = (*dbp)->implementation->methods->destroy;
(*destroy)((*dbp)->implementation->driverarg,(*dbp)->dbdata);
/* return memory */
isc_mem_put(mctx, (*dbp), sizeof(dns_dlzdb_t));
isc_mem_detach(&mctx);
}
*dbp = NULL;
}
isc_result_t
dns_dlzfindzone(dns_view_t *view, dns_name_t *name, unsigned int minlabels,
dns_db_t **dbp)
{
dns_fixedname_t fname;
dns_name_t *zonename;
unsigned int namelabels;
unsigned int i;
isc_result_t result;
dns_dlzfindzone_t findzone;
dns_dlzdb_t *dlzdatabase;
/*
* Performs checks to make sure data is as we expect it to be.
*/
REQUIRE(DNS_DLZ_VALID(view->dlzdatabase));
REQUIRE(name != NULL);
REQUIRE(dbp != NULL && *dbp == NULL);
/* setup a "fixed" dns name */
dns_fixedname_init(&fname);
zonename = dns_fixedname_name(&fname);
/* count the number of labels in the name */
namelabels = dns_name_countlabels(name);
/*
* loop through starting with the longest domain name and
* trying shorter names portions of the name until we find a
* match, have an error, or are below the 'minlabels'
* threshold. minlabels is 0, if the standard database didn't
* have a zone name match. Otherwise minlables is the number
* of labels in that name. We need to beat that for a
* "better" match for the DLZ database to be authoritative
* instead of the standard database.
*/
for (i = namelabels; i > minlabels && i > 1; i--) {
if (i == namelabels) {
result = dns_name_copy(name, zonename, NULL);
if (result != ISC_R_SUCCESS)
return (result);
} else
dns_name_split(name, i, NULL, zonename);
/* ask SDLZ driver if the zone is supported */
dlzdatabase = view->dlzdatabase;
findzone = dlzdatabase->implementation->methods->findzone;
result = (*findzone)(dlzdatabase->implementation->driverarg,
dlzdatabase->dbdata, dlzdatabase->mctx,
view->rdclass, zonename, dbp);
if (result != ISC_R_NOTFOUND)
return (result);
}
return (ISC_R_NOTFOUND);
}
/*%
* Registers a DLZ driver. This basically just adds the dlz
* driver to the list of available drivers in the dlz_implementations list.
*/
isc_result_t
dns_dlzregister(const char *drivername, const dns_dlzmethods_t *methods,
void *driverarg, isc_mem_t *mctx,
dns_dlzimplementation_t **dlzimp)
{
dns_dlzimplementation_t *dlz_imp;
/* Write debugging message to log */
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
"Registering DLZ driver '%s'", drivername);
/*
* Performs checks to make sure data is as we expect it to be.
*/
REQUIRE(drivername != NULL);
REQUIRE(methods != NULL);
REQUIRE(methods->create != NULL);
REQUIRE(methods->destroy != NULL);
REQUIRE(methods->findzone != NULL);
REQUIRE(mctx != NULL);
REQUIRE(dlzimp != NULL && *dlzimp == NULL);
/*
* initialize the dlz_implementations list, this is guaranteed
* to only really happen once.
*/
RUNTIME_CHECK(isc_once_do(&once, dlz_initialize) == ISC_R_SUCCESS);
/* lock the dlz_implementations list so we can modify it. */
RWLOCK(&dlz_implock, isc_rwlocktype_write);
/*
* check that another already registered driver isn't using
* the same name
*/
dlz_imp = dlz_impfind(drivername);
if (dlz_imp != NULL) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
"DLZ Driver '%s' already registered",
drivername);
RWUNLOCK(&dlz_implock, isc_rwlocktype_write);
return (ISC_R_EXISTS);
}
/*
* Allocate memory for a dlz_implementation object. Error if
* we cannot.
*/
dlz_imp = isc_mem_get(mctx, sizeof(dns_dlzimplementation_t));
if (dlz_imp == NULL) {
RWUNLOCK(&dlz_implock, isc_rwlocktype_write);
return (ISC_R_NOMEMORY);
}
/* Make sure memory region is set to all 0's */
memset(dlz_imp, 0, sizeof(dns_dlzimplementation_t));
/* Store the data passed into this method */
dlz_imp->name = drivername;
dlz_imp->methods = methods;
dlz_imp->mctx = NULL;
dlz_imp->driverarg = driverarg;
/* attach the new dlz_implementation object to a memory context */
isc_mem_attach(mctx, &dlz_imp->mctx);
/*
* prepare the dlz_implementation object to be put in a list,
* and append it to the list
*/
ISC_LINK_INIT(dlz_imp, link);
ISC_LIST_APPEND(dlz_implementations, dlz_imp, link);
/* Unlock the dlz_implementations list. */
RWUNLOCK(&dlz_implock, isc_rwlocktype_write);
/* Pass back the dlz_implementation that we created. */
*dlzimp = dlz_imp;
return (ISC_R_SUCCESS);
}
/*%
* Helper function for dns_dlzstrtoargv().
* Pardon the gratuitous recursion.
*/
static isc_result_t
dns_dlzstrtoargvsub(isc_mem_t *mctx, char *s, unsigned int *argcp,
char ***argvp, unsigned int n)
{
isc_result_t result;
restart:
/* Discard leading whitespace. */
while (*s == ' ' || *s == '\t')
s++;
if (*s == '\0') {
/* We have reached the end of the string. */
*argcp = n;
*argvp = isc_mem_get(mctx, n * sizeof(char *));
if (*argvp == NULL)
return (ISC_R_NOMEMORY);
} else {
char *p = s;
while (*p != ' ' && *p != '\t' && *p != '\0' && *p != '{') {
if (*p == '\n') {
*p = ' ';
goto restart;
}
p++;
}
/* do "grouping", items between { and } are one arg */
if (*p == '{') {
char *t = p;
/*
* shift all characters to left by 1 to get rid of '{'
*/
while (*t != '\0') {
t++;
*(t-1) = *t;
}
while (*p != '\0' && *p != '}') {
p++;
}
/* get rid of '}' character */
if (*p == '}') {
*p = '\0';
p++;
}
/* normal case, no "grouping" */
} else if (*p != '\0')
*p++ = '\0';
result = dns_dlzstrtoargvsub(mctx, p, argcp, argvp, n + 1);
if (result != ISC_R_SUCCESS)
return (result);
(*argvp)[n] = s;
}
return (ISC_R_SUCCESS);
}
/*%
* Tokenize the string "s" into whitespace-separated words,
* return the number of words in '*argcp' and an array
* of pointers to the words in '*argvp'. The caller
* must free the array using isc_mem_put(). The string
* is modified in-place.
*/
isc_result_t
dns_dlzstrtoargv(isc_mem_t *mctx, char *s,
unsigned int *argcp, char ***argvp)
{
return(dns_dlzstrtoargvsub(mctx, s, argcp, argvp, 0));
}
/*%
* Unregisters a DLZ driver. This basically just removes the dlz
* driver from the list of available drivers in the dlz_implementations list.
*/
void
dns_dlzunregister(dns_dlzimplementation_t **dlzimp) {
dns_dlzimplementation_t *dlz_imp;
isc_mem_t *mctx;
/* Write debugging message to log */
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
"Unregistering DLZ driver.");
/*
* Performs checks to make sure data is as we expect it to be.
*/
REQUIRE(dlzimp != NULL && *dlzimp != NULL);
/*
* initialize the dlz_implementations list, this is guaranteed
* to only really happen once.
*/
RUNTIME_CHECK(isc_once_do(&once, dlz_initialize) == ISC_R_SUCCESS);
dlz_imp = *dlzimp;
/* lock the dlz_implementations list so we can modify it. */
RWLOCK(&dlz_implock, isc_rwlocktype_write);
/* remove the dlz_implementation object from the list */
ISC_LIST_UNLINK(dlz_implementations, dlz_imp, link);
mctx = dlz_imp->mctx;
/*
* return the memory back to the available memory pool and
* remove it from the memory context.
*/
isc_mem_put(mctx, dlz_imp, sizeof(dns_dlzimplementation_t));
isc_mem_detach(&mctx);
/* Unlock the dlz_implementations list. */
RWUNLOCK(&dlz_implock, isc_rwlocktype_write);
}

290
lib/dns/include/dns/dlz.h Normal file
View File

@@ -0,0 +1,290 @@
/*
* Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
*
* 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 STICHTING NLNET
* 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.
*/
/*
* 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 INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM 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: dlz.h,v 1.2 2005/09/05 00:11:02 marka Exp $ */
/*! \file */
#ifndef DLZ_H
#define DLZ_H 1
/*****
***** Module Info
*****/
/*
* DLZ Interface
*
* The DLZ interface allows zones to be looked up using a driver instead of
* Bind's default in memory zone table.
*
*
* Reliability:
* No anticipated impact.
*
* Resources:
*
* Security:
* No anticipated impact.
*
* Standards:
* None.
*/
/*****
***** Imports
*****/
#include <dns/name.h>
#include <dns/types.h>
#include <dns/view.h>
#include <isc/lang.h>
ISC_LANG_BEGINDECLS
/***
*** Types
***/
#define DNS_DLZ_MAGIC ISC_MAGIC('D','L','Z','D')
#define DNS_DLZ_VALID(dlz) ISC_MAGIC_VALID(dlz, DNS_DLZ_MAGIC)
typedef isc_result_t
(*dns_dlzallowzonexfr_t)(void *driverarg, void *dbdata, isc_mem_t *mctx,
dns_rdataclass_t rdclass, dns_name_t *name,
isc_sockaddr_t *clientaddr,
dns_db_t **dbp);
/*%<
* Method prototype. Drivers implementing the DLZ interface MUST
* supply an allow zone transfer method. This method is called when
* the DNS server is performing a zone transfer query. The driver's
* method should return ISC_R_SUCCESS and a database pointer to the
* name server if the zone is supported by the database, and zone
* transfer is allowed. Otherwise it will return ISC_R_NOTFOUND if
* the zone is not supported by the database, or ISC_R_NOPERM if zone
* transfers are not allowed. If an error occurs it should return a
* result code indicating the type of error.
*/
typedef isc_result_t
(*dns_dlzcreate_t)(isc_mem_t *mctx, const char *dlzname, unsigned int argc,
char *argv[], void *driverarg, void **dbdata);
/*%<
* Method prototype. Drivers implementing the DLZ interface MUST
* supply a create method. This method is called when the DNS server
* is starting up and creating drivers for use later.
*/
typedef void
(*dns_dlzdestroy_t)(void *driverarg, void **dbdata);
/*%<
* Method prototype. Drivers implementing the DLZ interface MUST
* supply a destroy method. This method is called when the DNS server
* is shuting down and no longer needs the driver.
*/
typedef isc_result_t
(*dns_dlzfindzone_t)(void *driverarg, void *dbdata, isc_mem_t *mctx,
dns_rdataclass_t rdclass, dns_name_t *name,
dns_db_t **dbp);
/*%<
* Method prototype. Drivers implementing the DLZ interface MUST
* supply a find zone method. This method is called when the DNS
* server is performing a query. The find zone method will be called
* with the longest possible name first, and continue to be called
* with successively shorter domain names, until any of the following
* occur:
*
* \li 1) a match is found, and the function returns (ISC_R_SUCCESS)
*
* \li 2) a problem occurs, and the functions returns anything other
* than (ISC_R_NOTFOUND)
* \li 3) we run out of domain name labels. I.E. we have tried the
* shortest domain name
* \li 4) the number of labels in the domain name is less than
* min_lables for dns_dlzfindzone
*
* The driver's find zone method should return ISC_R_SUCCESS and a
* database pointer to the name server if the zone is supported by the
* database. Otherwise it will return ISC_R_NOTFOUND, and a null
* pointer if the zone is not supported. If an error occurs it should
* return a result code indicating the type of error.
*/
/*% the methods supplied by a DLZ driver */
typedef struct dns_dlzmethods {
dns_dlzcreate_t create;
dns_dlzdestroy_t destroy;
dns_dlzfindzone_t findzone;
dns_dlzallowzonexfr_t allowzonexfr;
} dns_dlzmethods_t;
/*% information about a DLZ driver */
struct dns_dlzimplementation {
const char *name;
const dns_dlzmethods_t *methods;
isc_mem_t *mctx;
void *driverarg;
ISC_LINK(dns_dlzimplementation_t) link;
};
/*% an instance of a DLZ driver */
struct dns_dlzdb {
unsigned int magic;
isc_mem_t *mctx;
dns_dlzimplementation_t *implementation;
void *dbdata;
};
/***
*** Method declarations
***/
isc_result_t
dns_dlzallowzonexfr(dns_view_t *view, dns_name_t *name,
isc_sockaddr_t *clientaddr, dns_db_t **dbp);
/*%<
* This method is called when the DNS server is performing a zone
* transfer query. It will call the DLZ driver's allow zone tranfer
* method.
*/
isc_result_t
dns_dlzcreate(isc_mem_t *mctx, const char *dlzname,
const char *drivername, unsigned int argc,
char *argv[], dns_dlzdb_t **dbp);
/*%<
* This method is called when the DNS server is starting up and
* creating drivers for use later. It will search the DLZ driver list
* for 'drivername' and return a DLZ driver via dbp if a match is
* found. If the DLZ driver supplies a create method, this function
* will call it.
*/
void
dns_dlzdestroy(dns_dlzdb_t **dbp);
/*%<
* This method is called when the DNS server is shuting down and no
* longer needs the driver. If the DLZ driver supplies a destroy
* methods, this function will call it.
*/
isc_result_t
dns_dlzfindzone(dns_view_t *view, dns_name_t *name,
unsigned int minlabels, dns_db_t **dbp);
/*%<
* This method is called when the DNS server is performing a query.
* It will call the DLZ driver's find zone method.
*/
isc_result_t
dns_dlzregister(const char *drivername, const dns_dlzmethods_t *methods,
void *driverarg, isc_mem_t *mctx,
dns_dlzimplementation_t **dlzimp);
/*%<
* Register a dynamically loadable zones (DLZ) driver for the database
* type 'drivername', implemented by the functions in '*methods'.
*
* dlzimp must point to a NULL dlz_implementation_t pointer. That is,
* dlzimp != NULL && *dlzimp == NULL. It will be assigned a value that
* will later be used to identify the driver when deregistering it.
*/
isc_result_t
dns_dlzstrtoargv(isc_mem_t *mctx, char *s, unsigned int *argcp, char ***argvp);
/*%<
* This method is called when the name server is starting up to parse
* the DLZ driver command line from named.conf. Basically it splits
* up a string into and argc / argv. The primary difference of this
* method is items between braces { } are considered only 1 word. for
* example the command line "this is { one grouped phrase } and this
* isn't" would be parsed into:
*
* \li argv[0]: "this"
* \li argv[1]: "is"
* \li argv{2]: " one grouped phrase "
* \li argv[3]: "and"
* \li argv[4]: "this"
* \li argv{5}: "isn't"
*
* braces should NOT be nested, more than one grouping in the command
* line is allowed. Notice, argv[2] has an extra space at the
* beginning and end. Extra spaces are not stripped between a
* grouping. You can do so in your driver if needed, or be sure not
* to put extra spaces before / after the braces.
*/
void
dns_dlzunregister(dns_dlzimplementation_t **dlzimp);
/*%<
* Removes the dlz driver from the list of registered dlz drivers.
* There must be no active dlz drivers of this type when this function
* is called.
*/
ISC_LANG_ENDDECLS
#endif /* DLZ_H */

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: log.h,v 1.36 2005/04/29 00:22:59 marka Exp $ */ /* $Id: log.h,v 1.37 2005/09/05 00:11:02 marka Exp $ */
/*! \file /*! \file
* \author Principal Authors: DCL */ * \author Principal Authors: DCL */
@@ -71,6 +71,7 @@ LIBDNS_EXTERNAL_DATA extern isc_logmodule_t dns_modules[];
#define DNS_LOGMODULE_DIFF (&dns_modules[23]) #define DNS_LOGMODULE_DIFF (&dns_modules[23])
#define DNS_LOGMODULE_HINTS (&dns_modules[24]) #define DNS_LOGMODULE_HINTS (&dns_modules[24])
#define DNS_LOGMODULE_ACACHE (&dns_modules[25]) #define DNS_LOGMODULE_ACACHE (&dns_modules[25])
#define DNS_LOGMODULE_DLZ (&dns_modules[26])
ISC_LANG_BEGINDECLS ISC_LANG_BEGINDECLS

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: name.h,v 1.116 2005/05/19 04:59:04 marka Exp $ */ /* $Id: name.h,v 1.117 2005/09/05 00:11:03 marka Exp $ */
#ifndef DNS_NAME_H #ifndef DNS_NAME_H
#define DNS_NAME_H 1 #define DNS_NAME_H 1
@@ -264,7 +264,6 @@ dns_name_hasbuffer(const dns_name_t *name);
* \li ISC_FALSE 'name' does not have a dedicated buffer. * \li ISC_FALSE 'name' does not have a dedicated buffer.
*/ */
/*** /***
*** Properties *** Properties
***/ ***/
@@ -958,9 +957,9 @@ dns_name_split(dns_name_t *name, unsigned int suffixlabels,
* Requires: * Requires:
*\li 'name' is a valid name. *\li 'name' is a valid name.
* *
* \li 'suffixlabels' cannot exceed the number of labels in 'name'. *\li 'suffixlabels' cannot exceed the number of labels in 'name'.
* *
*\li 'prefix' is a valid name or NULL, and cannot be read-only. * \li 'prefix' is a valid name or NULL, and cannot be read-only.
* *
*\li 'suffix' is a valid name or NULL, and cannot be read-only. *\li 'suffix' is a valid name or NULL, and cannot be read-only.
* *

266
lib/dns/include/dns/sdlz.h Normal file
View File

@@ -0,0 +1,266 @@
/*
* Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
*
* 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 STICHTING NLNET
* 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.
*/
/*
* 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 INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM 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: sdlz.h,v 1.2 2005/09/05 00:11:03 marka Exp $ */
/*! \file */
#ifndef SDLZ_H
#define SDLZ_H 1
#include <dns/dlz.h>
ISC_LANG_BEGINDECLS
#define DNS_SDLZFLAG_THREADSAFE 0x00000001U
#define DNS_SDLZFLAG_RELATIVEOWNER 0x00000002U
#define DNS_SDLZFLAG_RELATIVERDATA 0x00000004U
/* A simple DLZ database. */
typedef struct dns_sdlz_db dns_sdlz_db_t;
/* A simple DLZ database lookup in progress. */
typedef struct dns_sdlzlookup dns_sdlzlookup_t;
/* A simple DLZ database traversal in progress. */
typedef struct dns_sdlzallnodes dns_sdlzallnodes_t;
typedef isc_result_t
(*dns_sdlzallnodesfunc_t)(const char *zone, void *driverarg, void *dbdata,
dns_sdlzallnodes_t *allnodes);
/*%<
* Method prototype. Drivers implementing the SDLZ interface may
* supply an all nodes method. This method is called when the DNS
* server is performing a zone transfer query, after the allow zone
* transfer method has been called. This method is only called if the
* allow zone transfer method returned ISC_R_SUCCESS. This method and
* the allow zone transfer method are both required for zone transfers
* to be supported. If the driver generates data dynamically (instead
* of searching in a database for it) it should not implement this
* function as a zone transfer would be meaningless. A SDLZ driver
* does not have to implement an all nodes method.
*/
typedef isc_result_t
(*dns_sdlzallowzonexfr_t)(void *driverarg, void *dbdata, const char *name,
const char *client);
/*%<
* Method prototype. Drivers implementing the SDLZ interface may
* supply an allow zone transfer method. This method is called when
* the DNS server is performing a zone transfer query, before the all
* nodes method can be called. This method and the all node method
* are both required for zone transfers to be supported. If the
* driver generates data dynamically (instead of searching in a
* database for it) it should not implement this function as a zone
* transfer would be meaningless. A SDLZ driver does not have to
* implement an allow zone transfer method.
*
* This method should return ISC_R_SUCCESS if the zone is supported by
* the database and a zone transfer is allowed for the specified
* client. If the zone is supported by the database, but zone
* transfers are not allowed for the specified client this method
* should return ISC_R_NOPERM.. Lastly the method should return
* ISC_R_NOTFOUND if the zone is not supported by the database. If an
* error occurs it should return a result code indicating the type of
* error.
*/
typedef isc_result_t
(*dns_sdlzauthorityfunc_t)(const char *zone, void *driverarg, void *dbdata,
dns_sdlzlookup_t *lookup);
/*%<
* Method prototype. Drivers implementing the SDLZ interface may
* supply an authority method. This method is called when the DNS
* server is performing a query, after both the find zone and lookup
* methods have been called. This method is required if the lookup
* function does not supply authority information for the dns
* record. A SDLZ driver does not have to implement an authority
* method.
*/
typedef isc_result_t
(*dns_sdlzcreate_t)(const char *dlzname, unsigned int argc, char *argv[],
void *driverarg, void **dbdata);
/*%<
* Method prototype. Drivers implementing the SDLZ interface may
* supply a create method. This method is called when the DNS server
* is starting up and creating drivers for use later. A SDLZ driver
* does not have to implement a create method.
*/
typedef void
(*dns_sdlzdestroy_t)(void *driverarg, void *dbdata);
/*%<
* Method prototype. Drivers implementing the SDLZ interface may
* supply a destroy method. This method is called when the DNS server
* is shuting down and no longer needs the driver. A SDLZ driver does
* not have to implement a destroy method.
*/
typedef isc_result_t
(*dns_sdlzfindzone_t)(void *driverarg, void *dbdata, const char *name);
/*%<
* Method prototype. Drivers implementing the SDLZ interface MUST
* supply a find zone method. This method is called when the DNS
* server is performing a query to to determine if 'name' is a
* supported dns zone. The find zone method will be called with the
* longest possible name first, and continue to be called with
* successively shorter domain names, until any of the following
* occur:
*
* \li 1) the function returns (ISC_R_SUCCESS) indicating a zone name
* match.
*
* \li 2) a problem occurs, and the functions returns anything other than
* (ISC_R_NOTFOUND)
*
* \li 3) we run out of domain name labels. I.E. we have tried the
* shortest domain name
*
* \li 4) the number of labels in the domain name is less than min_lables
* for dns_dlzfindzone
*
* The driver's find zone method should return ISC_R_SUCCESS if the
* zone is supported by the database. Otherwise it should return
* ISC_R_NOTFOUND, if the zone is not supported. If an error occurs
* it should return a result code indicating the type of error.
*/
typedef isc_result_t
(*dns_sdlzlookupfunc_t)(const char *zone, const char *name, void *driverarg,
void *dbdata, dns_sdlzlookup_t *lookup);
/*%<
* Method prototype. Drivers implementing the SDLZ interface MUST
* supply a lookup method. This method is called when the DNS server
* is performing a query, after the find zone and before any other
* methods have been called. This function returns record DNS record
* information using the dns_sdlz_putrr and dns_sdlz_putsoa functions.
* If this function supplies authority information for the DNS record
* the authority method is not required. If it does not, the
* authority function is required. A SDLZ driver must implement a
* lookup method.
*/
typedef struct dns_sdlzmethods {
dns_sdlzcreate_t create;
dns_sdlzdestroy_t destroy;
dns_sdlzfindzone_t findzone;
dns_sdlzlookupfunc_t lookup;
dns_sdlzauthorityfunc_t authority;
dns_sdlzallnodesfunc_t allnodes;
dns_sdlzallowzonexfr_t allowzonexfr;
} dns_sdlzmethods_t;
isc_result_t
dns_sdlzregister(const char *drivername, const dns_sdlzmethods_t *methods,
void *driverarg, unsigned int flags, isc_mem_t *mctx,
dns_sdlzimplementation_t **sdlzimp);
/*%<
* Register a dynamically loadable zones (dlz) driver for the database
* type 'drivername', implemented by the functions in '*methods'.
*
* sdlzimp must point to a NULL dns_sdlzimplementation_t pointer.
* That is, sdlzimp != NULL && *sdlzimp == NULL. It will be assigned
* a value that will later be used to identify the driver when
* deregistering it.
*/
void
dns_sdlzunregister(dns_sdlzimplementation_t **sdlzimp);
/*%<
* Removes the sdlz driver from the list of registered sdlz drivers.
* There must be no active sdlz drivers of this type when this
* function is called.
*/
isc_result_t
dns_sdlz_putnamedrr(dns_sdlzallnodes_t *allnodes, const char *name,
const char *type, dns_ttl_t ttl, const char *data);
/*%<
* Add a single resource record to the allnodes structure to be later
* parsed into a zone transfer response.
*/
isc_result_t
dns_sdlz_putrr(dns_sdlzlookup_t *lookup, const char *type, dns_ttl_t ttl,
const char *data);
/*%<
* Add a single resource record to the lookup structure to be later
* parsed into a query response.
*/
isc_result_t
dns_sdlz_putsoa(dns_sdlzlookup_t *lookup, const char *mname, const char *rname,
isc_uint32_t serial);
/*%<
* This function may optionally be called from the 'authority'
* callback to simplify construction of the SOA record for 'zone'. It
* will provide a SOA listing 'mname' as as the master server and
* 'rname' as the responsible person mailbox. It is the
* responsibility of the driver to increment the serial number between
* responses if necessary. All other SOA fields will have reasonable
* default values.
*/
ISC_LANG_ENDDECLS
#endif /* SDLZ_H */

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: types.h,v 1.116 2005/06/20 01:03:54 marka Exp $ */ /* $Id: types.h,v 1.117 2005/09/05 00:11:03 marka Exp $ */
#ifndef DNS_TYPES_H #ifndef DNS_TYPES_H
#define DNS_TYPES_H 1 #define DNS_TYPES_H 1
@@ -53,6 +53,9 @@ typedef void dns_dbload_t;
typedef void dns_dbnode_t; typedef void dns_dbnode_t;
typedef struct dns_dbtable dns_dbtable_t; typedef struct dns_dbtable dns_dbtable_t;
typedef void dns_dbversion_t; typedef void dns_dbversion_t;
typedef struct dns_dlzimplementation dns_dlzimplementation_t;
typedef struct dns_dlzdb dns_dlzdb_t;
typedef struct dns_sdlzimplementation dns_sdlzimplementation_t;
typedef struct dns_decompress dns_decompress_t; typedef struct dns_decompress dns_decompress_t;
typedef struct dns_dispatch dns_dispatch_t; typedef struct dns_dispatch dns_dispatch_t;
typedef struct dns_dispatchevent dns_dispatchevent_t; typedef struct dns_dispatchevent dns_dispatchevent_t;

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: view.h,v 1.96 2005/07/18 05:58:59 marka Exp $ */ /* $Id: view.h,v 1.97 2005/09/05 00:11:04 marka Exp $ */
#ifndef DNS_VIEW_H #ifndef DNS_VIEW_H
#define DNS_VIEW_H 1 #define DNS_VIEW_H 1
@@ -84,6 +84,7 @@ struct dns_view {
dns_rdataclass_t rdclass; dns_rdataclass_t rdclass;
char * name; char * name;
dns_zt_t * zonetable; dns_zt_t * zonetable;
dns_dlzdb_t * dlzdatabase;
dns_resolver_t * resolver; dns_resolver_t * resolver;
dns_adb_t * adb; dns_adb_t * adb;
dns_requestmgr_t * requestmgr; dns_requestmgr_t * requestmgr;

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: log.c,v 1.39 2005/04/29 00:22:48 marka Exp $ */ /* $Id: log.c,v 1.40 2005/09/05 00:11:01 marka Exp $ */
/*! \file */ /*! \file */
@@ -77,6 +77,7 @@ LIBDNS_EXTERNAL_DATA isc_logmodule_t dns_modules[] = {
{ "dns/diff", 0 }, { "dns/diff", 0 },
{ "dns/hints", 0 }, { "dns/hints", 0 },
{ "dns/acache", 0 }, { "dns/acache", 0 },
{ "dns/dlz", 0 },
{ NULL, 0 } { NULL, 0 }
}; };

1781
lib/dns/sdlz.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: view.c,v 1.132 2005/07/12 01:00:16 marka Exp $ */ /* $Id: view.c,v 1.133 2005/09/05 00:11:02 marka Exp $ */
/*! \file */ /*! \file */
@@ -31,6 +31,7 @@
#include <dns/adb.h> #include <dns/adb.h>
#include <dns/cache.h> #include <dns/cache.h>
#include <dns/db.h> #include <dns/db.h>
#include <dns/dlz.h>
#include <dns/events.h> #include <dns/events.h>
#include <dns/forward.h> #include <dns/forward.h>
#include <dns/keytable.h> #include <dns/keytable.h>
@@ -122,6 +123,7 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
view->acache = NULL; view->acache = NULL;
view->cache = NULL; view->cache = NULL;
view->cachedb = NULL; view->cachedb = NULL;
view->dlzdatabase = NULL;
view->hints = NULL; view->hints = NULL;
view->resolver = NULL; view->resolver = NULL;
view->adb = NULL; view->adb = NULL;
@@ -269,6 +271,8 @@ destroy(dns_view_t *view) {
isc_task_detach(&view->task); isc_task_detach(&view->task);
if (view->hints != NULL) if (view->hints != NULL)
dns_db_detach(&view->hints); dns_db_detach(&view->hints);
if (view->dlzdatabase != NULL)
dns_dlzdestroy(&view->dlzdatabase);
if (view->cachedb != NULL) if (view->cachedb != NULL)
dns_db_detach(&view->cachedb); dns_db_detach(&view->cachedb);
if (view->cache != NULL) if (view->cache != NULL)

View File

@@ -175,6 +175,13 @@ dns_dispatchmgr_destroy
dns_dispatchmgr_getblackhole dns_dispatchmgr_getblackhole
dns_dispatchmgr_setblackhole dns_dispatchmgr_setblackhole
dns_dispatchmgr_setblackportlist dns_dispatchmgr_setblackportlist
dns_dlzallowzonexfr
dns_dlzcreate
dns_dlzdestroy
dns_dlzfindzone
dns_dlzregister
dns_dlzstrtoargv
dns_dlzunregister
dns_dnssec_findzonekeys dns_dnssec_findzonekeys
dns_dnssec_findzonekeys2 dns_dnssec_findzonekeys2
dns_dnssec_keyfromrdata dns_dnssec_keyfromrdata
@@ -504,6 +511,11 @@ dns_sdb_putrr
dns_sdb_putsoa dns_sdb_putsoa
dns_sdb_register dns_sdb_register
dns_sdb_unregister dns_sdb_unregister
dns_sdlz_putnamedrr
dns_sdlz_putrr
dns_sdlz_putsoa
dns_sdlzregister
dns_sdlzunregister
dns_secalg_fromtext dns_secalg_fromtext
dns_secalg_totext dns_secalg_totext
dns_secproto_fromtext dns_secproto_fromtext

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: dir.c,v 1.22 2005/04/29 00:23:49 marka Exp $ */ /* $Id: dir.c,v 1.23 2005/09/05 00:11:04 marka Exp $ */
/*! \file /*! \file
* \author Principal Authors: DCL */ * \author Principal Authors: DCL */
@@ -57,11 +57,30 @@ isc_dir_init(isc_dir_t *dir) {
*/ */
isc_result_t isc_result_t
isc_dir_open(isc_dir_t *dir, const char *dirname) { isc_dir_open(isc_dir_t *dir, const char *dirname) {
char *p;
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
REQUIRE(VALID_DIR(dir)); REQUIRE(VALID_DIR(dir));
REQUIRE(dirname != NULL); REQUIRE(dirname != NULL);
/*
* Copy directory name. Need to have enough space for the name,
* a possible path separator, the wildcard, and the final NUL.
*/
if (strlen(dirname) + 3 > sizeof(dir->dirname))
/* XXXDCL ? */
return (ISC_R_NOSPACE);
strcpy(dir->dirname, dirname);
/*
* Append path separator, if needed, and "*".
*/
p = dir->dirname + strlen(dir->dirname);
if (dir->dirname < p && *(p - 1) != '/')
*p++ = '/';
*p++ = '*';
*p++ = '\0';
/* /*
* Open stream. * Open stream.
*/ */

View File

@@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE. # PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.15 2005/01/12 01:56:12 marka Exp $ # $Id: Makefile.in,v 1.16 2005/09/05 00:11:04 marka Exp $
srcdir = @srcdir@ srcdir = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
@@ -27,7 +27,7 @@ top_srcdir = @top_srcdir@
CINCLUDES = -I. ${DNS_INCLUDES} ${ISC_INCLUDES} ${ISCCFG_INCLUDES} CINCLUDES = -I. ${DNS_INCLUDES} ${ISC_INCLUDES} ${ISCCFG_INCLUDES}
CDEFINES = CDEFINES = @USE_DLZ@
CWARNINGS = CWARNINGS =
ISCLIBS = ../../lib/isc/libisc.@A@ ISCLIBS = ../../lib/isc/libisc.@A@

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: namedconf.c,v 1.56 2005/08/24 23:54:04 marka Exp $ */ /* $Id: namedconf.c,v 1.57 2005/09/05 00:11:05 marka Exp $ */
/*! \file */ /*! \file */
@@ -108,6 +108,33 @@ static cfg_type_t cfg_type_view;
static cfg_type_t cfg_type_viewopts; static cfg_type_t cfg_type_viewopts;
static cfg_type_t cfg_type_zone; static cfg_type_t cfg_type_zone;
static cfg_type_t cfg_type_zoneopts; static cfg_type_t cfg_type_zoneopts;
static cfg_type_t cfg_type_dynamically_loadable_zones;
static cfg_type_t cfg_type_dynamically_loadable_zones_opts;
/*
* Clauses that can be found in a 'dynamically loadable zones' statement
*/
static cfg_clausedef_t
dynamically_loadable_zones_clauses[] = {
{ "database", &cfg_type_astring, 0 },
{ NULL, NULL, 0 }
};
/*
* A dynamically loadable zones statement.
*/
static cfg_tuplefielddef_t dynamically_loadable_zones_fields[] = {
{ "name", &cfg_type_astring, 0 },
{ "options", &cfg_type_dynamically_loadable_zones_opts, 0 },
{ NULL, NULL, 0 }
};
static cfg_type_t cfg_type_dynamically_loadable_zones = {
"dlz", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple,
&cfg_rep_tuple,
dynamically_loadable_zones_fields
};
/*% tkey-dhkey */ /*% tkey-dhkey */
@@ -567,6 +594,8 @@ static cfg_clausedef_t
namedconf_or_view_clauses[] = { namedconf_or_view_clauses[] = {
{ "key", &cfg_type_key, CFG_CLAUSEFLAG_MULTI }, { "key", &cfg_type_key, CFG_CLAUSEFLAG_MULTI },
{ "zone", &cfg_type_zone, CFG_CLAUSEFLAG_MULTI }, { "zone", &cfg_type_zone, CFG_CLAUSEFLAG_MULTI },
/* only 1 DLZ per view allowed */
{ "dlz", &cfg_type_dynamically_loadable_zones, 0 },
{ "server", &cfg_type_server, CFG_CLAUSEFLAG_MULTI }, { "server", &cfg_type_server, CFG_CLAUSEFLAG_MULTI },
{ "trusted-keys", &cfg_type_trustedkeys, CFG_CLAUSEFLAG_MULTI }, { "trusted-keys", &cfg_type_trustedkeys, CFG_CLAUSEFLAG_MULTI },
{ NULL, NULL, 0 } { NULL, NULL, 0 }
@@ -873,6 +902,7 @@ view_clausesets[] = {
namedconf_or_view_clauses, namedconf_or_view_clauses,
view_clauses, view_clauses,
zone_clauses, zone_clauses,
dynamically_loadable_zones_clauses,
NULL NULL
}; };
static cfg_type_t cfg_type_viewopts = { static cfg_type_t cfg_type_viewopts = {
@@ -887,8 +917,22 @@ zone_clausesets[] = {
NULL NULL
}; };
static cfg_type_t cfg_type_zoneopts = { static cfg_type_t cfg_type_zoneopts = {
"zoneopts", cfg_parse_map, cfg_print_map, cfg_doc_map, &cfg_rep_map, zone_clausesets }; "zoneopts", cfg_parse_map, cfg_print_map,
cfg_doc_map, &cfg_rep_map, zone_clausesets };
/*% The "dynamically loadable zones" statement syntax. */
static cfg_clausedef_t *
dynamically_loadable_zones_clausesets[] = {
dynamically_loadable_zones_clauses,
NULL
};
static cfg_type_t cfg_type_dynamically_loadable_zones_opts = {
"dynamically_loadable_zones_opts", cfg_parse_map,
cfg_print_map, cfg_doc_map, &cfg_rep_map,
dynamically_loadable_zones_clausesets
};
/*% /*%
* Clauses that can be found within the 'key' statement. * Clauses that can be found within the 'key' statement.
*/ */
@@ -905,7 +949,9 @@ key_clausesets[] = {
NULL NULL
}; };
static cfg_type_t cfg_type_key = { static cfg_type_t cfg_type_key = {
"key", cfg_parse_named_map, cfg_print_map, cfg_doc_map, &cfg_rep_map, key_clausesets }; "key", cfg_parse_named_map, cfg_print_map,
cfg_doc_map, &cfg_rep_map, key_clausesets
};
/*% /*%

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: parser.c,v 1.118 2005/08/23 02:36:10 marka Exp $ */ /* $Id: parser.c,v 1.119 2005/09/05 00:11:05 marka Exp $ */
/*! \file */ /*! \file */
@@ -1087,7 +1087,6 @@ cfg_print_spacelist(cfg_printer_t *pctx, cfg_obj_t *obj) {
} }
} }
isc_boolean_t isc_boolean_t
cfg_obj_islist(cfg_obj_t *obj) { cfg_obj_islist(cfg_obj_t *obj) {
REQUIRE(obj != NULL); REQUIRE(obj != NULL);