dlz.c revision ca103999e64da0b16bb8b30589408f1556264dce
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd * Portions Copyright (C) 2005, 2007, 2009, 2010 Internet Systems Consortium, Inc. ("ISC")
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd * Portions Copyright (C) 1999-2001 Internet Software Consortium.
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd * Permission to use, copy, modify, and/or distribute this software for any
a3d2b657dd7ca66251b562b6a82c2335135b9172nd * purpose with or without fee is hereby granted, provided that the above
031b91a62d25106ae69d4693475c79618dd5e884fielding * copyright notice and this permission notice appear in all copies.
031b91a62d25106ae69d4693475c79618dd5e884fielding * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
031b91a62d25106ae69d4693475c79618dd5e884fielding * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
031b91a62d25106ae69d4693475c79618dd5e884fielding * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
031b91a62d25106ae69d4693475c79618dd5e884fielding * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
a3d2b657dd7ca66251b562b6a82c2335135b9172nd * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
a3d2b657dd7ca66251b562b6a82c2335135b9172nd * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
a3d2b657dd7ca66251b562b6a82c2335135b9172nd * PERFORMANCE OF THIS SOFTWARE.
a3d2b657dd7ca66251b562b6a82c2335135b9172nd * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
a3d2b657dd7ca66251b562b6a82c2335135b9172nd * Permission to use, copy, modify, and distribute this software for any
a3d2b657dd7ca66251b562b6a82c2335135b9172nd * purpose with or without fee is hereby granted, provided that the
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd * above copyright notice and this permission notice appear in all
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd * THE SOFTWARE IS PROVIDED "AS IS" AND STICHTING NLNET
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
5718d2b6ea423b4eb2d45f64bbc4c8eb61e0400fnd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd * USE OR PERFORMANCE OF THIS SOFTWARE.
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd * conceived and contributed by Rob Butler.
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd * Permission to use, copy, modify, and distribute this software for any
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd * purpose with or without fee is hereby granted, provided that the
5718d2b6ea423b4eb2d45f64bbc4c8eb61e0400fnd * above copyright notice and this permission notice appear in all
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
5718d2b6ea423b4eb2d45f64bbc4c8eb61e0400fnd * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd * USE OR PERFORMANCE OF THIS SOFTWARE.
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd/* $Id: dlz.c,v 1.10 2010/12/20 23:47:20 tbox Exp $ */
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd/*! \file */
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd *** Imports
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd *** Supported DLZ DB Implementations Registry
d78d735dbf7c5ce5ae545eecd8ee2c052224db77ndstatic ISC_LIST(dns_dlzimplementation_t) dlz_implementations;
d78d735dbf7c5ce5ae545eecd8ee2c052224db77ndstatic void
5718d2b6ea423b4eb2d45f64bbc4c8eb61e0400fnd RUNTIME_CHECK(isc_rwlock_init(&dlz_implock, 0, 0) == ISC_R_SUCCESS);
5718d2b6ea423b4eb2d45f64bbc4c8eb61e0400fnd * Searches the dlz_implementations list for a driver matching name.
5718d2b6ea423b4eb2d45f64bbc4c8eb61e0400fnd *** Basic DLZ Methods
5718d2b6ea423b4eb2d45f64bbc4c8eb61e0400fnd * Performs checks to make sure data is as we expect it to be.
5718d2b6ea423b4eb2d45f64bbc4c8eb61e0400fnd /* ask driver if the zone is supported */
5718d2b6ea423b4eb2d45f64bbc4c8eb61e0400fnd allowzonexfr = dlzdatabase->implementation->methods->allowzonexfr;
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd result = (*allowzonexfr)(dlzdatabase->implementation->driverarg,
5718d2b6ea423b4eb2d45f64bbc4c8eb61e0400fnddns_dlzcreate(isc_mem_t *mctx, const char *dlzname, const char *drivername,
5718d2b6ea423b4eb2d45f64bbc4c8eb61e0400fnd * initialize the dlz_implementations list, this is guaranteed
5718d2b6ea423b4eb2d45f64bbc4c8eb61e0400fnd * to only really happen once.
5718d2b6ea423b4eb2d45f64bbc4c8eb61e0400fnd RUNTIME_CHECK(isc_once_do(&once, dlz_initialize) == ISC_R_SUCCESS);
5718d2b6ea423b4eb2d45f64bbc4c8eb61e0400fnd * Performs checks to make sure data is as we expect it to be.
5718d2b6ea423b4eb2d45f64bbc4c8eb61e0400fnd /* write log message */
5718d2b6ea423b4eb2d45f64bbc4c8eb61e0400fnd /* lock the dlz_implementations list so we can search it. */
5718d2b6ea423b4eb2d45f64bbc4c8eb61e0400fnd /* search for the driver implementation */
5718d2b6ea423b4eb2d45f64bbc4c8eb61e0400fnd "unsupported DLZ database driver '%s'."
5718d2b6ea423b4eb2d45f64bbc4c8eb61e0400fnd " %s not loaded.",
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd /* Allocate memory to hold the DLZ database driver */
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd /* Make sure memory region is set to all 0's */
5718d2b6ea423b4eb2d45f64bbc4c8eb61e0400fnd /* Create a new database using implementation 'drivername'. */
5718d2b6ea423b4eb2d45f64bbc4c8eb61e0400fnd result = ((impinfo->methods->create)(mctx, dlzname, argc, argv,
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd /* mark the DLZ driver as valid */
5718d2b6ea423b4eb2d45f64bbc4c8eb61e0400fnd "DLZ driver loaded successfully.");
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd "DLZ driver failed to load.");
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd /* impinfo->methods->create failed. */
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd /* Write debugging message to log */
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd "Unloading DLZ driver.");
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd * Perform checks to make sure data is as we expect it to be.
5718d2b6ea423b4eb2d45f64bbc4c8eb61e0400fnd /* call the drivers destroy method */
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd (*destroy)((*dbp)->implementation->driverarg,(*dbp)->dbdata);
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd /* return memory */
5718d2b6ea423b4eb2d45f64bbc4c8eb61e0400fnddns_dlzfindzone(dns_view_t *view, dns_name_t *name, unsigned int minlabels,
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd unsigned int namelabels;
d78d735dbf7c5ce5ae545eecd8ee2c052224db77nd unsigned int i;
if (i == namelabels) {
return (result);
return (result);
return (ISC_R_NOTFOUND);
return (ISC_R_EXISTS);
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
static isc_result_t
char ***argvp, unsigned int n)
*argcp = n;
return (ISC_R_NOMEMORY);
goto restart;
return (result);
(*argvp)[n] = s;
return (ISC_R_SUCCESS);
#ifdef BIND9
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
return (result);
dns_zone_t *))
return (ISC_R_SUCCESS);
return (result);
return (ISC_FALSE);