summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Nagy <mnagy@redhat.com>2009-04-27 19:11:49 +0200
committerMartin Nagy <mnagy@redhat.com>2009-04-27 20:45:38 +0200
commit29e5df821d523ede3f8815d1fe9d4b8a796168d3 (patch)
treee815b60e6ed0ea04f5ef4b9d16e65b24a94a3731
parent63a5f5fe2c2f83cd8a52328dd936f4a5969e6494 (diff)
downloadbind_dynamic-master.zip
bind_dynamic-master.tar.gz
bind_dynamic-master.tar.xz
Look into /usr/lib{,64}/bind/ for plugins.HEADmaster
-rw-r--r--lib/dns/Makefile.in5
-rw-r--r--lib/dns/dynamic_db.c25
2 files changed, 26 insertions, 4 deletions
diff --git a/lib/dns/Makefile.in b/lib/dns/Makefile.in
index 0f7abba..97cc9fa 100644
--- a/lib/dns/Makefile.in
+++ b/lib/dns/Makefile.in
@@ -115,6 +115,11 @@ version.@O@: version.c
-DLIBAGE=${LIBAGE} \
-c ${srcdir}/version.c
+dynamic_db.@O@: dynamic_db.c
+ ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} \
+ -DDYNDB_LIBDIR=\"@libdir@/bind/\" \
+ -c ${srcdir}/dynamic_db.c
+
libdns.@SA@: ${OBJS}
${AR} ${ARFLAGS} $@ ${OBJS}
${RANLIB} $@
diff --git a/lib/dns/dynamic_db.c b/lib/dns/dynamic_db.c
index de2daf7..25afaf5 100644
--- a/lib/dns/dynamic_db.c
+++ b/lib/dns/dynamic_db.c
@@ -17,10 +17,12 @@
#include <config.h>
+#include <isc/buffer.h>
#include <isc/mem.h>
#include <isc/mutex.h>
#include <isc/once.h>
#include <isc/result.h>
+#include <isc/region.h>
#include <isc/task.h>
#include <isc/types.h>
#include <isc/util.h>
@@ -37,6 +39,10 @@
#include <dlfcn.h>
#endif
+#ifndef DYNDB_LIBDIR
+#define DYNDB_LIBDIR ""
+#endif
+
#define CHECK(op) \
do { result = (op); \
if (result != ISC_R_SUCCESS) goto cleanup; \
@@ -109,6 +115,9 @@ static isc_result_t
load_library(isc_mem_t *mctx, const char *filename, dyndb_implementation_t **impp)
{
isc_result_t result;
+ size_t module_size;
+ isc_buffer_t *module_buf = NULL;
+ isc_region_t module_region;
void *handle;
dyndb_implementation_t *imp;
register_func_t register_function = NULL;
@@ -116,7 +125,15 @@ load_library(isc_mem_t *mctx, const char *filename, dyndb_implementation_t **imp
REQUIRE(impp != NULL && *impp == NULL);
- handle = dlopen(filename, RTLD_LAZY);
+ /* Build up the full path. */
+ module_size = strlen(DYNDB_LIBDIR) + strlen(filename) + 1;
+ CHECK(isc_buffer_allocate(mctx, &module_buf, module_size));
+ isc_buffer_putstr(module_buf, DYNDB_LIBDIR);
+ isc_buffer_putstr(module_buf, filename);
+ isc_buffer_putuint8(module_buf, 0);
+ isc_buffer_region(module_buf, &module_region);
+
+ handle = dlopen((char *)module_region.base, RTLD_LAZY);
if (handle == NULL) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DYNDB, ISC_LOG_ERROR,
@@ -147,11 +164,11 @@ load_library(isc_mem_t *mctx, const char *filename, dyndb_implementation_t **imp
*impp = imp;
- return ISC_R_SUCCESS;
-
cleanup:
- if (handle != NULL)
+ if (result != ISC_R_SUCCESS && handle != NULL)
dlclose(handle);
+ if (module_buf != NULL)
+ isc_buffer_free(&module_buf);
return result;
}