dlz.c

Go to the documentation of this file.
00001 /*
00002  * Portions Copyright (C) 2005, 2007, 2009-2013  Internet Systems Consortium, Inc. ("ISC")
00003  * Portions Copyright (C) 1999-2001  Internet Software Consortium.
00004  *
00005  * Permission to use, copy, modify, and/or distribute this software for any
00006  * purpose with or without fee is hereby granted, provided that the above
00007  * copyright notice and this permission notice appear in all copies.
00008  *
00009  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
00010  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
00011  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
00012  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
00013  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
00014  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00015  * PERFORMANCE OF THIS SOFTWARE.
00016  */
00017 
00018 /*
00019  * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
00020  *
00021  * Permission to use, copy, modify, and distribute this software for any
00022  * purpose with or without fee is hereby granted, provided that the
00023  * above copyright notice and this permission notice appear in all
00024  * copies.
00025  *
00026  * THE SOFTWARE IS PROVIDED "AS IS" AND STICHTING NLNET
00027  * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
00028  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
00029  * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
00030  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
00031  * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
00032  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
00033  * USE OR PERFORMANCE OF THIS SOFTWARE.
00034  *
00035  * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
00036  * conceived and contributed by Rob Butler.
00037  *
00038  * Permission to use, copy, modify, and distribute this software for any
00039  * purpose with or without fee is hereby granted, provided that the
00040  * above copyright notice and this permission notice appear in all
00041  * copies.
00042  *
00043  * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
00044  * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
00045  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
00046  * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
00047  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
00048  * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
00049  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
00050  * USE OR PERFORMANCE OF THIS SOFTWARE.
00051  */
00052 
00053 /* $Id$ */
00054 
00055 /*! \file */
00056 
00057 /***
00058  *** Imports
00059  ***/
00060 
00061 #include <config.h>
00062 
00063 #include <dns/db.h>
00064 #include <dns/dlz.h>
00065 #include <dns/fixedname.h>
00066 #include <dns/log.h>
00067 #include <dns/master.h>
00068 #include <dns/ssu.h>
00069 #include <dns/zone.h>
00070 
00071 
00072 #include <isc/buffer.h>
00073 #include <isc/magic.h>
00074 #include <isc/mem.h>
00075 #include <isc/once.h>
00076 #include <isc/rwlock.h>
00077 #include <isc/string.h>
00078 #include <isc/util.h>
00079 
00080 /***
00081  *** Supported DLZ DB Implementations Registry
00082  ***/
00083 
00084 static ISC_LIST(dns_dlzimplementation_t) dlz_implementations;
00085 static isc_rwlock_t dlz_implock;
00086 static isc_once_t once = ISC_ONCE_INIT;
00087 
00088 static void
00089 dlz_initialize(void) {
00090         RUNTIME_CHECK(isc_rwlock_init(&dlz_implock, 0, 0) == ISC_R_SUCCESS);
00091         ISC_LIST_INIT(dlz_implementations);
00092 }
00093 
00094 /*%
00095  * Searches the dlz_implementations list for a driver matching name.
00096  */
00097 static inline dns_dlzimplementation_t *
00098 dlz_impfind(const char *name) {
00099         dns_dlzimplementation_t *imp;
00100 
00101         for (imp = ISC_LIST_HEAD(dlz_implementations);
00102              imp != NULL;
00103              imp = ISC_LIST_NEXT(imp, link))
00104                 if (strcasecmp(name, imp->name) == 0)
00105                         return (imp);
00106         return (NULL);
00107 }
00108 
00109 /***
00110  *** Basic DLZ Methods
00111  ***/
00112 
00113 isc_result_t
00114 dns_dlzallowzonexfr(dns_view_t *view, dns_name_t *name,
00115                     isc_sockaddr_t *clientaddr, dns_db_t **dbp)
00116 {
00117         isc_result_t result = ISC_R_NOTFOUND;
00118         dns_dlzallowzonexfr_t allowzonexfr;
00119         dns_dlzdb_t *dlzdb;
00120 
00121         /*
00122          * Performs checks to make sure data is as we expect it to be.
00123          */
00124         REQUIRE(name != NULL);
00125         REQUIRE(dbp != NULL && *dbp == NULL);
00126 
00127         /*
00128          * Find a driver in which the zone exists and transfer is supported
00129          */
00130         for (dlzdb = ISC_LIST_HEAD(view->dlz_searched);
00131              dlzdb != NULL;
00132              dlzdb = ISC_LIST_NEXT(dlzdb, link))
00133         {
00134                 REQUIRE(DNS_DLZ_VALID(dlzdb));
00135 
00136                 allowzonexfr = dlzdb->implementation->methods->allowzonexfr;
00137                 result = (*allowzonexfr)(dlzdb->implementation->driverarg,
00138                                          dlzdb->dbdata, dlzdb->mctx,
00139                                          view->rdclass, name, clientaddr, dbp);
00140 
00141                 /*
00142                  * if ISC_R_NOPERM, we found the right database but
00143                  * the zone may not transfer.
00144                  */
00145                 if (result == ISC_R_SUCCESS || result == ISC_R_NOPERM)
00146                         return (result);
00147         }
00148 
00149         if (result == ISC_R_NOTIMPLEMENTED)
00150                 result = ISC_R_NOTFOUND;
00151 
00152         return (result);
00153 }
00154 
00155 isc_result_t
00156 dns_dlzcreate(isc_mem_t *mctx, const char *dlzname, const char *drivername,
00157               unsigned int argc, char *argv[], dns_dlzdb_t **dbp)
00158 {
00159         dns_dlzimplementation_t *impinfo;
00160         isc_result_t result;
00161         dns_dlzdb_t *db = NULL;
00162 
00163         /*
00164          * initialize the dlz_implementations list, this is guaranteed
00165          * to only really happen once.
00166          */
00167         RUNTIME_CHECK(isc_once_do(&once, dlz_initialize) == ISC_R_SUCCESS);
00168 
00169         /*
00170          * Performs checks to make sure data is as we expect it to be.
00171          */
00172         REQUIRE(dbp != NULL && *dbp == NULL);
00173         REQUIRE(dlzname != NULL);
00174         REQUIRE(drivername != NULL);
00175         REQUIRE(mctx != NULL);
00176 
00177         /* write log message */
00178         isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
00179                       DNS_LOGMODULE_DLZ, ISC_LOG_INFO,
00180                       "Loading '%s' using driver %s", dlzname, drivername);
00181 
00182         /* lock the dlz_implementations list so we can search it. */
00183         RWLOCK(&dlz_implock, isc_rwlocktype_read);
00184 
00185         /* search for the driver implementation  */
00186         impinfo = dlz_impfind(drivername);
00187         if (impinfo == NULL) {
00188                 RWUNLOCK(&dlz_implock, isc_rwlocktype_read);
00189 
00190                 isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
00191                               DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
00192                               "unsupported DLZ database driver '%s'."
00193                               "  %s not loaded.",
00194                               drivername, dlzname);
00195 
00196                 return (ISC_R_NOTFOUND);
00197         }
00198 
00199         /* Allocate memory to hold the DLZ database driver */
00200         db = isc_mem_get(mctx, sizeof(dns_dlzdb_t));
00201         if (db == NULL) {
00202                 RWUNLOCK(&dlz_implock, isc_rwlocktype_read);
00203                 return (ISC_R_NOMEMORY);
00204         }
00205 
00206         /* Make sure memory region is set to all 0's */
00207         memset(db, 0, sizeof(dns_dlzdb_t));
00208 
00209         ISC_LINK_INIT(db, link);
00210         db->implementation = impinfo;
00211         if (dlzname != NULL)
00212                 db->dlzname = isc_mem_strdup(mctx, dlzname);
00213 
00214         /* Create a new database using implementation 'drivername'. */
00215         result = ((impinfo->methods->create)(mctx, dlzname, argc, argv,
00216                                              impinfo->driverarg,
00217                                              &db->dbdata));
00218 
00219         /* mark the DLZ driver as valid */
00220         if (result == ISC_R_SUCCESS) {
00221                 RWUNLOCK(&dlz_implock, isc_rwlocktype_read);
00222                 db->magic = DNS_DLZ_MAGIC;
00223                 isc_mem_attach(mctx, &db->mctx);
00224                 isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
00225                               DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
00226                               "DLZ driver loaded successfully.");
00227                 *dbp = db;
00228                 return (ISC_R_SUCCESS);
00229         } else {
00230                 isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
00231                               DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
00232                               "DLZ driver failed to load.");
00233         }
00234 
00235         /* impinfo->methods->create failed. */
00236         RWUNLOCK(&dlz_implock, isc_rwlocktype_read);
00237         isc_mem_put(mctx, db, sizeof(dns_dlzdb_t));
00238         return (result);
00239 }
00240 
00241 void
00242 dns_dlzdestroy(dns_dlzdb_t **dbp) {
00243         isc_mem_t *mctx;
00244         dns_dlzdestroy_t destroy;
00245 
00246         /* Write debugging message to log */
00247         isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
00248                       DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
00249                       "Unloading DLZ driver.");
00250 
00251         /*
00252          * Perform checks to make sure data is as we expect it to be.
00253          */
00254         REQUIRE(dbp != NULL && DNS_DLZ_VALID(*dbp));
00255 
00256         if ((*dbp)->ssutable != NULL) {
00257                 dns_ssutable_detach(&(*dbp)->ssutable);
00258         }
00259 
00260         /* call the drivers destroy method */
00261         if ((*dbp) != NULL) {
00262                 mctx = (*dbp)->mctx;
00263                 if ((*dbp)->dlzname != NULL)
00264                         isc_mem_free(mctx, (*dbp)->dlzname);
00265                 destroy = (*dbp)->implementation->methods->destroy;
00266                 (*destroy)((*dbp)->implementation->driverarg,(*dbp)->dbdata);
00267                 /* return memory */
00268                 isc_mem_put(mctx, (*dbp), sizeof(dns_dlzdb_t));
00269                 isc_mem_detach(&mctx);
00270         }
00271 
00272         *dbp = NULL;
00273 }
00274 
00275 /*%
00276  * Registers a DLZ driver.  This basically just adds the dlz
00277  * driver to the list of available drivers in the dlz_implementations list.
00278  */
00279 isc_result_t
00280 dns_dlzregister(const char *drivername, const dns_dlzmethods_t *methods,
00281                 void *driverarg, isc_mem_t *mctx,
00282                 dns_dlzimplementation_t **dlzimp)
00283 {
00284 
00285         dns_dlzimplementation_t *dlz_imp;
00286 
00287         /* Write debugging message to log */
00288         isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
00289                       DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
00290                       "Registering DLZ driver '%s'", drivername);
00291 
00292         /*
00293          * Performs checks to make sure data is as we expect it to be.
00294          */
00295         REQUIRE(drivername != NULL);
00296         REQUIRE(methods != NULL);
00297         REQUIRE(methods->create != NULL);
00298         REQUIRE(methods->destroy != NULL);
00299         REQUIRE(methods->findzone != NULL);
00300         REQUIRE(mctx != NULL);
00301         REQUIRE(dlzimp != NULL && *dlzimp == NULL);
00302 
00303         /*
00304          * initialize the dlz_implementations list, this is guaranteed
00305          * to only really happen once.
00306          */
00307         RUNTIME_CHECK(isc_once_do(&once, dlz_initialize) == ISC_R_SUCCESS);
00308 
00309         /* lock the dlz_implementations list so we can modify it. */
00310         RWLOCK(&dlz_implock, isc_rwlocktype_write);
00311 
00312         /*
00313          * check that another already registered driver isn't using
00314          * the same name
00315          */
00316         dlz_imp = dlz_impfind(drivername);
00317         if (dlz_imp != NULL) {
00318                 isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
00319                               DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
00320                               "DLZ Driver '%s' already registered",
00321                               drivername);
00322                 RWUNLOCK(&dlz_implock, isc_rwlocktype_write);
00323                 return (ISC_R_EXISTS);
00324         }
00325 
00326         /*
00327          * Allocate memory for a dlz_implementation object.  Error if
00328          * we cannot.
00329          */
00330         dlz_imp = isc_mem_get(mctx, sizeof(dns_dlzimplementation_t));
00331         if (dlz_imp == NULL) {
00332                 RWUNLOCK(&dlz_implock, isc_rwlocktype_write);
00333                 return (ISC_R_NOMEMORY);
00334         }
00335 
00336         /* Make sure memory region is set to all 0's */
00337         memset(dlz_imp, 0, sizeof(dns_dlzimplementation_t));
00338 
00339         /* Store the data passed into this method */
00340         dlz_imp->name = drivername;
00341         dlz_imp->methods = methods;
00342         dlz_imp->mctx = NULL;
00343         dlz_imp->driverarg = driverarg;
00344 
00345         /* attach the new dlz_implementation object to a memory context */
00346         isc_mem_attach(mctx, &dlz_imp->mctx);
00347 
00348         /*
00349          * prepare the dlz_implementation object to be put in a list,
00350          * and append it to the list
00351          */
00352         ISC_LINK_INIT(dlz_imp, link);
00353         ISC_LIST_APPEND(dlz_implementations, dlz_imp, link);
00354 
00355         /* Unlock the dlz_implementations list.  */
00356         RWUNLOCK(&dlz_implock, isc_rwlocktype_write);
00357 
00358         /* Pass back the dlz_implementation that we created. */
00359         *dlzimp = dlz_imp;
00360 
00361         return (ISC_R_SUCCESS);
00362 }
00363 
00364 /*%
00365  * Helper function for dns_dlzstrtoargv().
00366  * Pardon the gratuitous recursion.
00367  */
00368 static isc_result_t
00369 dns_dlzstrtoargvsub(isc_mem_t *mctx, char *s, unsigned int *argcp,
00370                     char ***argvp, unsigned int n)
00371 {
00372         isc_result_t result;
00373 
00374  restart:
00375         /* Discard leading whitespace. */
00376         while (*s == ' ' || *s == '\t')
00377                 s++;
00378 
00379         if (*s == '\0') {
00380                 /* We have reached the end of the string. */
00381                 *argcp = n;
00382                 *argvp = isc_mem_get(mctx, n * sizeof(char *));
00383                 if (*argvp == NULL)
00384                         return (ISC_R_NOMEMORY);
00385         } else {
00386                 char *p = s;
00387                 while (*p != ' ' && *p != '\t' && *p != '\0' && *p != '{') {
00388                         if (*p == '\n') {
00389                                 *p = ' ';
00390                                 goto restart;
00391                         }
00392                         p++;
00393                 }
00394 
00395                 /* do "grouping", items between { and } are one arg */
00396                 if (*p == '{') {
00397                         char *t = p;
00398                         /*
00399                          * shift all characters to left by 1 to get rid of '{'
00400                          */
00401                         while (*t != '\0') {
00402                                 t++;
00403                                 *(t-1) = *t;
00404                         }
00405                         while (*p != '\0' && *p != '}') {
00406                                 p++;
00407                         }
00408                         /* get rid of '}' character */
00409                         if (*p == '}') {
00410                                 *p = '\0';
00411                                 p++;
00412                         }
00413                         /* normal case, no "grouping" */
00414                 } else if (*p != '\0')
00415                         *p++ = '\0';
00416 
00417                 result = dns_dlzstrtoargvsub(mctx, p, argcp, argvp, n + 1);
00418                 if (result != ISC_R_SUCCESS)
00419                         return (result);
00420                 (*argvp)[n] = s;
00421         }
00422         return (ISC_R_SUCCESS);
00423 }
00424 
00425 /*%
00426  * Tokenize the string "s" into whitespace-separated words,
00427  * return the number of words in '*argcp' and an array
00428  * of pointers to the words in '*argvp'.  The caller
00429  * must free the array using isc_mem_put().  The string
00430  * is modified in-place.
00431  */
00432 isc_result_t
00433 dns_dlzstrtoargv(isc_mem_t *mctx, char *s,
00434                  unsigned int *argcp, char ***argvp)
00435 {
00436         return(dns_dlzstrtoargvsub(mctx, s, argcp, argvp, 0));
00437 }
00438 
00439 /*%
00440  * Unregisters a DLZ driver.  This basically just removes the dlz
00441  * driver from the list of available drivers in the dlz_implementations list.
00442  */
00443 void
00444 dns_dlzunregister(dns_dlzimplementation_t **dlzimp) {
00445         dns_dlzimplementation_t *dlz_imp;
00446         isc_mem_t *mctx;
00447 
00448         /* Write debugging message to log */
00449         isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
00450                       DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
00451                       "Unregistering DLZ driver.");
00452 
00453         /*
00454          * Performs checks to make sure data is as we expect it to be.
00455          */
00456         REQUIRE(dlzimp != NULL && *dlzimp != NULL);
00457 
00458         /*
00459          * initialize the dlz_implementations list, this is guaranteed
00460          * to only really happen once.
00461          */
00462         RUNTIME_CHECK(isc_once_do(&once, dlz_initialize) == ISC_R_SUCCESS);
00463 
00464         dlz_imp = *dlzimp;
00465 
00466         /* lock the dlz_implementations list so we can modify it. */
00467         RWLOCK(&dlz_implock, isc_rwlocktype_write);
00468 
00469         /* remove the dlz_implementation object from the list */
00470         ISC_LIST_UNLINK(dlz_implementations, dlz_imp, link);
00471         mctx = dlz_imp->mctx;
00472 
00473         /*
00474          * Return the memory back to the available memory pool and
00475          * remove it from the memory context.
00476          */
00477         isc_mem_put(mctx, dlz_imp, sizeof(dns_dlzimplementation_t));
00478         isc_mem_detach(&mctx);
00479 
00480         /* Unlock the dlz_implementations list. */
00481         RWUNLOCK(&dlz_implock, isc_rwlocktype_write);
00482 }
00483 
00484 /*
00485  * Create a writeable DLZ zone. This can be called by DLZ drivers
00486  * during configure() to create a zone that can be updated. The zone
00487  * type is set to dns_zone_dlz, which is equivalent to a master zone
00488  *
00489  * This function uses a callback setup in dns_dlzconfigure() to call
00490  * into the server zone code to setup the remaining pieces of server
00491  * specific functionality on the zone
00492  */
00493 isc_result_t
00494 dns_dlz_writeablezone(dns_view_t *view, dns_dlzdb_t *dlzdb,
00495                       const char *zone_name)
00496 {
00497         dns_zone_t *zone = NULL;
00498         dns_zone_t *dupzone = NULL;
00499         isc_result_t result;
00500         isc_buffer_t buffer;
00501         dns_fixedname_t fixorigin;
00502         dns_name_t *origin;
00503 
00504         REQUIRE(DNS_DLZ_VALID(dlzdb));
00505 
00506         REQUIRE(dlzdb->configure_callback != NULL);
00507 
00508         isc_buffer_constinit(&buffer, zone_name, strlen(zone_name));
00509         isc_buffer_add(&buffer, strlen(zone_name));
00510         dns_fixedname_init(&fixorigin);
00511         result = dns_name_fromtext(dns_fixedname_name(&fixorigin),
00512                                    &buffer, dns_rootname, 0, NULL);
00513         if (result != ISC_R_SUCCESS)
00514                 goto cleanup;
00515         origin = dns_fixedname_name(&fixorigin);
00516 
00517         if (!dlzdb->search) {
00518                 isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
00519                               DNS_LOGMODULE_DLZ, ISC_LOG_WARNING,
00520                               "DLZ %s has 'search no;', but attempted to "
00521                               "register writeable zone %s.",
00522                               dlzdb->dlzname, zone_name);
00523                 result = ISC_R_SUCCESS;
00524                 goto cleanup;
00525         }
00526 
00527         /* See if the zone already exists */
00528         result = dns_view_findzone(view, origin, &dupzone);
00529         if (result == ISC_R_SUCCESS) {
00530                 dns_zone_detach(&dupzone);
00531                 result = ISC_R_EXISTS;
00532                 goto cleanup;
00533         }
00534         INSIST(dupzone == NULL);
00535 
00536         /* Create it */
00537         result = dns_zone_create(&zone, view->mctx);
00538         if (result != ISC_R_SUCCESS)
00539                 goto cleanup;
00540         result = dns_zone_setorigin(zone, origin);
00541         if (result != ISC_R_SUCCESS)
00542                 goto cleanup;
00543         dns_zone_setview(zone, view);
00544 
00545         dns_zone_setadded(zone, ISC_TRUE);
00546 
00547         if (dlzdb->ssutable == NULL) {
00548                 result = dns_ssutable_createdlz(dlzdb->mctx,
00549                                                 &dlzdb->ssutable, dlzdb);
00550                 if (result != ISC_R_SUCCESS)
00551                         goto cleanup;
00552         }
00553         dns_zone_setssutable(zone, dlzdb->ssutable);
00554 
00555         result = dlzdb->configure_callback(view, dlzdb, zone);
00556         if (result != ISC_R_SUCCESS)
00557                 goto cleanup;
00558 
00559         result = dns_view_addzone(view, zone);
00560 
00561 
00562  cleanup:
00563         if (zone != NULL)
00564                 dns_zone_detach(&zone);
00565 
00566         return (result);
00567 }
00568 
00569 /*%
00570  * Configure a DLZ driver. This is optional, and if supplied gives
00571  * the backend an opportunity to configure parameters related to DLZ.
00572  */
00573 isc_result_t
00574 dns_dlzconfigure(dns_view_t *view, dns_dlzdb_t *dlzdb,
00575                  dlzconfigure_callback_t callback)
00576 {
00577         dns_dlzimplementation_t *impl;
00578         isc_result_t result;
00579 
00580         REQUIRE(DNS_DLZ_VALID(dlzdb));
00581         REQUIRE(dlzdb->implementation != NULL);
00582 
00583         impl = dlzdb->implementation;
00584 
00585         if (impl->methods->configure == NULL)
00586                 return (ISC_R_SUCCESS);
00587 
00588         dlzdb->configure_callback = callback;
00589 
00590         result = impl->methods->configure(impl->driverarg, dlzdb->dbdata,
00591                                           view, dlzdb);
00592         return (result);
00593 }
00594 
00595 isc_boolean_t
00596 dns_dlz_ssumatch(dns_dlzdb_t *dlzdatabase, dns_name_t *signer,
00597                  dns_name_t *name, isc_netaddr_t *tcpaddr,
00598                  dns_rdatatype_t type, const dst_key_t *key)
00599 {
00600         dns_dlzimplementation_t *impl;
00601         isc_boolean_t r;
00602 
00603         REQUIRE(dlzdatabase != NULL);
00604         REQUIRE(dlzdatabase->implementation != NULL);
00605         REQUIRE(dlzdatabase->implementation->methods != NULL);
00606         impl = dlzdatabase->implementation;
00607 
00608         if (impl->methods->ssumatch == NULL) {
00609                 isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
00610                               DNS_LOGMODULE_DLZ, ISC_LOG_INFO,
00611                               "No ssumatch method for DLZ database");
00612                 return (ISC_FALSE);
00613         }
00614 
00615         r = impl->methods->ssumatch(signer, name, tcpaddr, type, key,
00616                                     impl->driverarg, dlzdatabase->dbdata);
00617         return (r);
00618 }

Generated on Tue Apr 28 17:40:56 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha