dlz_ldap_driver.c revision f02b5d87a561ba669bd368a8a6422f364f7702ec
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * Permission to use, copy, modify, and distribute this software for any
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * purpose with or without fee is hereby granted, provided that the
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * above copyright notice and this permission notice appear in all
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * THE SOFTWARE IS PROVIDED "AS IS" AND STICHTING NLNET
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * USE OR PERFORMANCE OF THIS SOFTWARE.
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * conceived and contributed by Rob Butler.
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * Permission to use, copy, modify, and distribute this software for any
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * purpose with or without fee is hereby granted, provided that the
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * above copyright notice and this permission notice appear in all
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
0b14ebe3132846e91bea02992493e3d506233e76Michael Graff * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * USE OR PERFORMANCE OF THIS SOFTWARE.
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * Copyright (C) 1999-2001 Internet Software Consortium.
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff * Permission to use, copy, modify, and distribute this software for any
7f1bd55920715d872389194c4201ea95b71378efMichael Graff * purpose with or without fee is hereby granted, provided that the above
7f1bd55920715d872389194c4201ea95b71378efMichael Graff * copyright notice and this permission notice appear in all copies.
7f1bd55920715d872389194c4201ea95b71378efMichael Graff * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
7f1bd55920715d872389194c4201ea95b71378efMichael Graff * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
ab0e5066083abcbec62513a3cc041d1f1eb9098aMichael Graff * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
ab0e5066083abcbec62513a3cc041d1f1eb9098aMichael Graff * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * Need older API functions from ldap.h.
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graffstatic dns_sdlzimplementation_t *dlz_ldap = NULL;
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff * Structure to hold everthing needed by this "instance" of the LDAP
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff * driver remember, the driver code is only loaded once, but may have
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff * many separate instances.
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Grafftypedef struct {
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff int method; /*%< security authentication method */
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff char *cred; /*%< password for simple authentication method */
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff int protocol; /*%< LDAP communication protocol version */
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff/* forward references */
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graffdlz_ldap_findzone(void *driverarg, void *dbdata, const char *name);
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graffdlz_ldap_destroy(void *driverarg, void *dbdata);
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff * Private methods
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff/*% checks that the LDAP URL parameters make sense */
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graffdlz_ldap_checkURL(char *URL, int attrCnt, const char *msg) {
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff if (ldap_result != LDAP_SUCCESS || ldap_url == NULL) {
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff if (ldap_count_values(ldap_url->lud_attrs) < attrCnt) {
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff "%s query must specify at least "
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff "%d attributes to return",
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff if (ldap_url->lud_dn == NULL || strlen (ldap_url->lud_dn) < 1) {
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff if (ldap_url->lud_exts != NULL || ldap_url->lud_crit_exts != 0) {
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff "%s uses extensions. "
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff "The driver does not support LDAP extensions.",
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff/*% Connects / reconnects to LDAP server */
c16cc434ef385a870bea53eb7ecfea7da8eb562dMichael Graffdlz_ldap_connect(ldap_instance_t *dbi, dbinstance_t *dbc) {
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff /* if we have a connection, get ride of it. */
c16cc434ef385a870bea53eb7ecfea7da8eb562dMichael Graff /* now connect / reconnect. */
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff /* initialize. */
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff dbc->dbconn = ldap_init(dbi->hosts, LDAP_PORT);
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff /* set protocol version. */
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff ldap_result = ldap_set_option((LDAP *) dbc->dbconn,
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff /* "bind" to server. i.e. send username / pass */
11e2a221f173f6bebb1cb4bc634efd40054ed7deMichael Graff ldap_result = ldap_bind_s((LDAP *) dbc->dbconn, dbi->user,
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff /* cleanup if failure. */
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff * Properly cleans up a list of database instances.
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff * This function is only used when the driver is compiled for
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff * multithreaded operation.
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff /* get the first DBI in the list */
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff /* loop through the list */
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff /* get the next DBI in the list */
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff /* release DB connection */
7f1bd55920715d872389194c4201ea95b71378efMichael Graff /* release all memory that comprised a DBI */
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff /* release memory for the list structure */
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff isc_mem_put(ns_g_mctx, dblist, sizeof(db_list_t));
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff * Loops through the list of DB instances, attempting to lock
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff * on the mutex. If successful, the DBI is reserved for use
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff * and the thread can perform queries against the database.
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff * If the lock fails, the next one in the list is tried.
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff * looping continues until a lock is obtained, or until
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff * the list has been searched dbc_search_limit times.
6f1422b81ed2c5142092e2ced8e3faf0e61f3ba0Michael Graff * This function is only used when the driver is compiled for
6fe411037dafd168a9f65e6b254c50f3db616688Michael Graff * multithreaded operation.
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff /* get top of list */
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff /* loop through list */
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff /* try to lock on the mutex */
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff if (isc_mutex_trylock(&dbi->instance_lock) == ISC_R_SUCCESS)
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff return dbi; /* success, return the DBI for use. */
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff /* not successful, keep trying */
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff /* check to see if we have gone to the top of the list. */
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff "LDAP driver unable to find available connection "
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff "after searching %d times",
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff#endif /* ISC_PLATFORM_USETHREADS */
6fe411037dafd168a9f65e6b254c50f3db616688Michael Graffldap_process_results(LDAP *dbc, LDAPMessage *msg, char ** attrs,
6f1422b81ed2c5142092e2ced8e3faf0e61f3ba0Michael Graff /* make sure there are at least some attributes to process. */
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff /* get the first entry to process */
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff "LDAP no entries to process.");
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff /* loop through all entries returned */
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff /* reset for this loop */
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff /* determine how much space we need for data string */
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff /* get the list of values for this attribute. */
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff /* skip empty attributes. */
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff if (vals == NULL || ldap_count_values(vals) < 1)
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff * we only use the first value. this driver
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff * does not support multi-valued attributes.
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff /* free vals for next loop */
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff } /* end for (j=0; attrs[j] != NULL, j++) loop */
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff /* allocate memory for data string */
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff "LDAP driver unable to allocate memory "
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff "while processing results");
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff * Make sure data is null termed at the beginning so
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff * we can check if any data was stored to it later.
58efc48a9623797187726360efb57cbabd916f0dMichael Graff /* reset j to re-use below */
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff /* loop through the attributes in the order specified. */
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff /* get the list of values for this attribute. */
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff vals = ldap_get_values(dbc, entry, attribute);
6f1422b81ed2c5142092e2ced8e3faf0e61f3ba0Michael Graff /* skip empty attributes. */
0b14ebe3132846e91bea02992493e3d506233e76Michael Graff /* increment attibute pointer */
0b14ebe3132846e91bea02992493e3d506233e76Michael Graff /* start loop over */
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff * j initially = 0. Increment j each time we
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff * set a field that way next loop will set
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff * next field.
d1ba6e9180c7d7458656a6e53e52fde056fd244cMichael Graff * convert text to int, make sure it
d1ba6e9180c7d7458656a6e53e52fde056fd244cMichael Graff * worked right
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff "LDAP driver ttl must "
ab0e5066083abcbec62513a3cc041d1f1eb9098aMichael Graff "be a postive number");
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff } /* end switch(j) */
58efc48a9623797187726360efb57cbabd916f0dMichael Graff /* free values */
58efc48a9623797187726360efb57cbabd916f0dMichael Graff /* increment attibute pointer */
58efc48a9623797187726360efb57cbabd916f0dMichael Graff } /* end while (attribute != NULL) */
58efc48a9623797187726360efb57cbabd916f0dMichael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff "LDAP driver unable "
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff "to retrieve dns type");
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff "LDAP driver unable "
7f1bd55920715d872389194c4201ea95b71378efMichael Graff "to retrieve dns data");
0b14ebe3132846e91bea02992493e3d506233e76Michael Graff "dlz-ldap: putnamedrr failed "
0b14ebe3132846e91bea02992493e3d506233e76Michael Graff "for \"%s %s %u %s\", %s",
0b14ebe3132846e91bea02992493e3d506233e76Michael Graff result = dns_sdlz_putrr((dns_sdlzlookup_t *) ptr,
58efc48a9623797187726360efb57cbabd916f0dMichael Graff "dlz-ldap: putrr failed "
58efc48a9623797187726360efb57cbabd916f0dMichael Graff "for \"%s %u %s\", %s",
6f1422b81ed2c5142092e2ced8e3faf0e61f3ba0Michael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
271d5bfc5ca8d746b535d1522f2aa9389ece2a7eBob Halley "LDAP driver failed "
58efc48a9623797187726360efb57cbabd916f0dMichael Graff "while sending data to BIND.");
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff /* free memory for type, data and host for next loop */
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff /* get the next entry to process */
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff } /* end while (entry != NULL) */
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff /* de-allocate memory */
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff * This function is the real core of the driver. Zone, record
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff * and client strings are passed in (or NULL is passed if the
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff * string is not available). The type of query we want to run
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff * is indicated by the query flag, and the dbdata object is passed
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff * passed in to. dbdata really holds either:
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff * 1) a list of database instances (in multithreaded mode) OR
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff * 2) a single database instance (in single threaded mode)
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff * The function will construct the query and obtain an available
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff * database instance (DBI). It will then run the query and hopefully
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff * obtain a result set.
6f1422b81ed2c5142092e2ced8e3faf0e61f3ba0Michael Graffldap_get_results(const char *zone, const char *record,
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff /* get db instance / connection */
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff /* find an available DBI from the list */
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff#else /* ISC_PLATFORM_USETHREADS */
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff * only 1 DBI - no need to lock instance lock either
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff * only 1 thread in the whole process, no possible contention.
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff dbi = (dbinstance_t *) ((ldap_instance_t *)dbdata)->db;
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff#endif /* ISC_PLATFORM_USETHREADS */
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff /* if DBI is null, can't do anything else */
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff /* set fields */
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff dbi->client = isc_mem_strdup(ns_g_mctx, client);
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff /* what type of query are we going to run? */
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff * if the query was not passed in from the config file
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff * then we can't run it. return not_implemented, so
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff * it's like the code for that operation was never
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff * built into the driver.... AHHH flexibility!!!
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff /* same as comments as ALLNODES */
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff /* same as comments as ALLNODES */
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff /* this is required. It's the whole point of DLZ! */
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff "No query specified for findzone. "
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff "Findzone requires a query");
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff /* this is required. It's also a major point of DLZ! */
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff "No query specified for lookup. "
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff "Lookup requires a query");
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff * this should never happen. If it does, the code is
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff * screwed up!
6f1422b81ed2c5142092e2ced8e3faf0e61f3ba0Michael Graff "Incorrect query flag passed to "
6f1422b81ed2c5142092e2ced8e3faf0e61f3ba0Michael Graff "ldap_get_results");
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff /* if the querystring is null, Bummer, outta RAM. UPGRADE TIME!!! */
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff * output the full query string during debug so we can see
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff * what lame error the query has.
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff /* break URL down into it's component parts, if error cleanup */
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff ldap_result = ldap_url_parse(querystring, &ldap_url);
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff if (ldap_result != LDAP_SUCCESS || ldap_url == NULL) {
d1ba6e9180c7d7458656a6e53e52fde056fd244cMichael Graff for (i=0; i < 3; i++) {
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff * dbi->dbconn may be null if trying to reconnect on a
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff * previous query failed.
d1ba6e9180c7d7458656a6e53e52fde056fd244cMichael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
d1ba6e9180c7d7458656a6e53e52fde056fd244cMichael Graff "LDAP driver attempting to re-connect");
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff result = dlz_ldap_connect((ldap_instance_t *) dbdata,
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff /* perform ldap search syncronously */
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff ldap_result = ldap_search_s((LDAP *) dbi->dbconn,
7f1bd55920715d872389194c4201ea95b71378efMichael Graff * check return code. No such object is ok, just
7f1bd55920715d872389194c4201ea95b71378efMichael Graff * didn't find what we wanted
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff "No object found matching "
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff "query requirements");
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff case LDAP_SUCCESS: /* on success do nothing */
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff "LDAP driver attempting to re-connect");
6f1422b81ed2c5142092e2ced8e3faf0e61f3ba0Michael Graff result = dlz_ldap_connect((ldap_instance_t *) dbdata,
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff * other errors not ok. Log error message and
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff "LDAP error: %s",
54a64ec428cb9f783d62a044cbec3a72724a937cMichael Graff } /* close switch(ldap_result) */
04135883be6700d7c9f489e4db9cb6c147b064caMichael Graff } /* end for (int i=0 i < 3; i++) */
d1ba6e9180c7d7458656a6e53e52fde056fd244cMichael Graff result = ldap_process_results((LDAP *) dbi->dbconn, ldap_msg,
ab0e5066083abcbec62513a3cc041d1f1eb9098aMichael Graff result = ldap_process_results((LDAP *) dbi->dbconn, ldap_msg,
ef4b66d3557505af25fec8ce461f07ddd671ea1eBob Halley entries = ldap_count_entries((LDAP *) dbi->dbconn, ldap_msg);
54a64ec428cb9f783d62a044cbec3a72724a937cMichael Graff else if (entries > 0)
54a64ec428cb9f783d62a044cbec3a72724a937cMichael Graff entries = ldap_count_entries((LDAP *) dbi->dbconn, ldap_msg);
6fe411037dafd168a9f65e6b254c50f3db616688Michael Graff else if (entries > 0)
d1ba6e9180c7d7458656a6e53e52fde056fd244cMichael Graff * this should never happen. If it does, the code is
04135883be6700d7c9f489e4db9cb6c147b064caMichael Graff * screwed up!
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff "Incorrect query flag passed to "
d1ba6e9180c7d7458656a6e53e52fde056fd244cMichael Graff "ldap_get_results");
54a64ec428cb9f783d62a044cbec3a72724a937cMichael Graff /* it's always good to cleanup after yourself */
d1ba6e9180c7d7458656a6e53e52fde056fd244cMichael Graff /* if we retrieved results, free them */
d1ba6e9180c7d7458656a6e53e52fde056fd244cMichael Graff /* cleanup */
54a64ec428cb9f783d62a044cbec3a72724a937cMichael Graff /* release the lock so another thread can use this dbi */
54a64ec428cb9f783d62a044cbec3a72724a937cMichael Graff#endif /* ISC_PLATFORM_USETHREADS */
54a64ec428cb9f783d62a044cbec3a72724a937cMichael Graff /* release query string */
0b14ebe3132846e91bea02992493e3d506233e76Michael Graff /* return result */
54a64ec428cb9f783d62a044cbec3a72724a937cMichael Graff * DLZ methods
0b14ebe3132846e91bea02992493e3d506233e76Michael Graffdlz_ldap_allowzonexfr(void *driverarg, void *dbdata, const char *name,
54a64ec428cb9f783d62a044cbec3a72724a937cMichael Graff /* check to see if we are authoritative for the zone first */
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff result = dlz_ldap_findzone(driverarg, dbdata, name);
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff /* get all the zone data */
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff return ldap_get_results(name, NULL, client, ALLOWXFR, dbdata, NULL);
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graffdlz_ldap_allnodes(const char *zone, void *driverarg, void *dbdata,
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff return ldap_get_results(zone, NULL, NULL, ALLNODES, dbdata, allnodes);
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graffdlz_ldap_authority(const char *zone, void *driverarg, void *dbdata,
54a64ec428cb9f783d62a044cbec3a72724a937cMichael Graff return ldap_get_results(zone, NULL, NULL, AUTHORITY, dbdata, lookup);
54a64ec428cb9f783d62a044cbec3a72724a937cMichael Graffdlz_ldap_findzone(void *driverarg, void *dbdata, const char *name)
d1ba6e9180c7d7458656a6e53e52fde056fd244cMichael Graff return ldap_get_results(name, NULL, NULL, FINDZONE, dbdata, NULL);
54a64ec428cb9f783d62a044cbec3a72724a937cMichael Graffdlz_ldap_lookup(const char *zone, const char *name, void *driverarg,
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graffdlz_ldap_create(const char *dlzname, unsigned int argc, char *argv[],
54a64ec428cb9f783d62a044cbec3a72724a937cMichael Graff /* if multi-threaded, we need a few extra variables. */
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff/* db_list_t *dblist = NULL; */
2743e0ce08d1decc963908f024007078d4a553acMichael Graff#endif /* ISC_PLATFORM_USETHREADS */
2743e0ce08d1decc963908f024007078d4a553acMichael Graff /* if debugging, let user know we are multithreaded. */
2743e0ce08d1decc963908f024007078d4a553acMichael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
2743e0ce08d1decc963908f024007078d4a553acMichael Graff "LDAP driver running multithreaded");
2743e0ce08d1decc963908f024007078d4a553acMichael Graff#else /* ISC_PLATFORM_USETHREADS */
2743e0ce08d1decc963908f024007078d4a553acMichael Graff /* if debugging, let user know we are single threaded. */
54a64ec428cb9f783d62a044cbec3a72724a937cMichael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
54a64ec428cb9f783d62a044cbec3a72724a937cMichael Graff "LDAP driver running single threaded");
54a64ec428cb9f783d62a044cbec3a72724a937cMichael Graff#endif /* ISC_PLATFORM_USETHREADS */
54a64ec428cb9f783d62a044cbec3a72724a937cMichael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
54a64ec428cb9f783d62a044cbec3a72724a937cMichael Graff "LDAP driver requires at least "
54a64ec428cb9f783d62a044cbec3a72724a937cMichael Graff "8 command line args.");
d1ba6e9180c7d7458656a6e53e52fde056fd244cMichael Graff /* no more than 13 arg's should be passed to the driver */
d1ba6e9180c7d7458656a6e53e52fde056fd244cMichael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
d1ba6e9180c7d7458656a6e53e52fde056fd244cMichael Graff "LDAP driver cannot accept more than "
d1ba6e9180c7d7458656a6e53e52fde056fd244cMichael Graff "11 command line args.");
3cd4668988c5bccd59cca899459df4cfa985be67Bob Halley /* determine protocol version. */
54a64ec428cb9f783d62a044cbec3a72724a937cMichael Graff if (strncasecmp(argv[2], V2, strlen(V2)) == 0) {
54a64ec428cb9f783d62a044cbec3a72724a937cMichael Graff } else if (strncasecmp(argv[2], V3, strlen(V3)) == 0) {
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
6f1422b81ed2c5142092e2ced8e3faf0e61f3ba0Michael Graff "LDAP driver protocol must be either %s or %s",
ab0e5066083abcbec62513a3cc041d1f1eb9098aMichael Graff /* determine connection method. */
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff if (strncasecmp(argv[3], SIMPLE, strlen(SIMPLE)) == 0) {
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff } else if (strncasecmp(argv[3], KRB41, strlen(KRB41)) == 0) {
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff } else if (strncasecmp(argv[3], KRB42, strlen(KRB42)) == 0) {
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff "LDAP driver authentication method must be "
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff "one of %s, %s or %s",
3446e5e9327ed3595f7a9403f9944666f4820f2aMichael Graff /* multithreaded build can have multiple DB connections */
6fe411037dafd168a9f65e6b254c50f3db616688Michael Graff /* check how many db connections we should create */
6fe411037dafd168a9f65e6b254c50f3db616688Michael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff "LDAP driver database connection count "
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff "must be positive.");
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff /* check that LDAP URL parameters make sense */
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff result = dlz_ldap_checkURL(argv[11], 0, "allow zone transfer");
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff result = dlz_ldap_checkURL(argv[10], 3, "all nodes");
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff result = dlz_ldap_checkURL(argv[9], 3, "authority");
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff result = dlz_ldap_checkURL(argv[8], 3, "lookup");
d1ba6e9180c7d7458656a6e53e52fde056fd244cMichael Graff result = dlz_ldap_checkURL(argv[7], 0, "find zone");
11e2a221f173f6bebb1cb4bc634efd40054ed7deMichael Graff /* not really needed, should shut up compiler. */
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff /* allocate memory for LDAP instance */
ab0e5066083abcbec62513a3cc041d1f1eb9098aMichael Graff ldap_inst = isc_mem_get(ns_g_mctx, sizeof(ldap_instance_t));
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff memset(ldap_inst, 0, sizeof(ldap_instance_t));
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff /* store info needed to automatically re-connect. */
7f1bd55920715d872389194c4201ea95b71378efMichael Graff ldap_inst->hosts = isc_mem_strdup(ns_g_mctx, argv[6]);
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff ldap_inst->user = isc_mem_strdup(ns_g_mctx, argv[4]);
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff ldap_inst->cred = isc_mem_strdup(ns_g_mctx, argv[5]);
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff /* allocate memory for database connection list */
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff ldap_inst->db = isc_mem_get(ns_g_mctx, sizeof(db_list_t));
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff /* initialize DB connection list */
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff * create the appropriate number of database instances (DBI)
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff * append each new DBI to the end of the list
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff for (i = 0; i < dbcount; i++) {
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff#endif /* ISC_PLATFORM_USETHREADS */
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff /* how many queries were passed in from config file? */
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff result = build_sqldbinstance(ns_g_mctx, NULL, NULL,
54a64ec428cb9f783d62a044cbec3a72724a937cMichael Graff result = build_sqldbinstance(ns_g_mctx, NULL, NULL,
d1ba6e9180c7d7458656a6e53e52fde056fd244cMichael Graff result = build_sqldbinstance(ns_g_mctx, argv[10], NULL,
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff result = build_sqldbinstance(ns_g_mctx, argv[10],
6d58c9b95ec40eb38533061eefab6cb256e870e6Bob Halley /* not really needed, should shut up compiler. */
6d58c9b95ec40eb38533061eefab6cb256e870e6Bob Halley isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
6d58c9b95ec40eb38533061eefab6cb256e870e6Bob Halley "LDAP driver created "
6d58c9b95ec40eb38533061eefab6cb256e870e6Bob Halley "database instance object.");
6d58c9b95ec40eb38533061eefab6cb256e870e6Bob Halley } else { /* unsuccessful?, log err msg and cleanup. */
6d58c9b95ec40eb38533061eefab6cb256e870e6Bob Halley isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
6d58c9b95ec40eb38533061eefab6cb256e870e6Bob Halley "LDAP driver could not create "
d1ba6e9180c7d7458656a6e53e52fde056fd244cMichael Graff "database instance object.");
6f1422b81ed2c5142092e2ced8e3faf0e61f3ba0Michael Graff /* when multithreaded, build a list of DBI's */
6d58c9b95ec40eb38533061eefab6cb256e870e6Bob Halley * when single threaded, hold onto the one connection
6f1422b81ed2c5142092e2ced8e3faf0e61f3ba0Michael Graff /* attempt to connect */
6f1422b81ed2c5142092e2ced8e3faf0e61f3ba0Michael Graff * if db connection cannot be created, log err msg and
6fe411037dafd168a9f65e6b254c50f3db616688Michael Graff /* success, do nothing */
6f1422b81ed2c5142092e2ced8e3faf0e61f3ba0Michael Graff * no memory means ldap_init could not
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff * allocate memory
54a64ec428cb9f783d62a044cbec3a72724a937cMichael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff "LDAP driver could not allocate memory "
6f1422b81ed2c5142092e2ced8e3faf0e61f3ba0Michael Graff "for connection number %u",
ab0e5066083abcbec62513a3cc041d1f1eb9098aMichael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
ab0e5066083abcbec62513a3cc041d1f1eb9098aMichael Graff "LDAP driver could not allocate memory "
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff "for connection");
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff * no perm means ldap_set_option could not set
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff * protocol version
3446e5e9327ed3595f7a9403f9944666f4820f2aMichael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
3446e5e9327ed3595f7a9403f9944666f4820f2aMichael Graff "LDAP driver could not "
6fe411037dafd168a9f65e6b254c50f3db616688Michael Graff "set protocol version.");
6fe411037dafd168a9f65e6b254c50f3db616688Michael Graff /* failure means couldn't connect to ldap server */
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff "LDAP driver could not "
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff "bind connection number %u to server.",
d1ba6e9180c7d7458656a6e53e52fde056fd244cMichael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
11e2a221f173f6bebb1cb4bc634efd40054ed7deMichael Graff "LDAP driver could not "
11e2a221f173f6bebb1cb4bc634efd40054ed7deMichael Graff "bind connection to server.");
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff * default should never happen. If it does,
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff * major errors.
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff "dlz_ldap_create() failed: %s",
58efc48a9623797187726360efb57cbabd916f0dMichael Graff } /* end switch(result) */
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff /* set DBI = null for next loop through. */
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff } /* end for loop */
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff#endif /* ISC_PLATFORM_USETHREADS */
ab0e5066083abcbec62513a3cc041d1f1eb9098aMichael Graff /* set dbdata to the ldap_instance we created. */
ab0e5066083abcbec62513a3cc041d1f1eb9098aMichael Graff /* hey, we got through all of that ok, return success. */
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graffdlz_ldap_destroy(void *driverarg, void *dbdata)
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff /* cleanup the list of DBI's */
d1ba6e9180c7d7458656a6e53e52fde056fd244cMichael Graff#else /* ISC_PLATFORM_USETHREADS */
54a64ec428cb9f783d62a044cbec3a72724a937cMichael Graff /* release connection */
d1ba6e9180c7d7458656a6e53e52fde056fd244cMichael Graff if (((ldap_instance_t *)dbdata)->db->dbconn != NULL)
d1ba6e9180c7d7458656a6e53e52fde056fd244cMichael Graff /* destroy single DB instance */
d1ba6e9180c7d7458656a6e53e52fde056fd244cMichael Graff destroy_sqldbinstance(((ldap_instance_t *)dbdata)->db);
d1ba6e9180c7d7458656a6e53e52fde056fd244cMichael Graff#endif /* ISC_PLATFORM_USETHREADS */
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff if (((ldap_instance_t *)dbdata)->hosts != NULL)
6d58c9b95ec40eb38533061eefab6cb256e870e6Bob Halley isc_mem_put(ns_g_mctx, dbdata, sizeof(ldap_instance_t));
6f1422b81ed2c5142092e2ced8e3faf0e61f3ba0Michael Graff * Wrapper around dns_sdlzregister().
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * Write debugging message to log
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff "Registering DLZ ldap driver.");
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff result = dns_sdlzregister("ldap", &dlz_ldap_methods, NULL,
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff "dns_sdlzregister() failed: %s",
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff * Wrapper around dns_sdlzunregister().
6f1422b81ed2c5142092e2ced8e3faf0e61f3ba0Michael Graff * Write debugging message to log
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff "Unregistering DLZ ldap driver.");