mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
Merge branch 'ondrej/use-libuv-instead-libltdl' into 'main'
Replace ltdl with libuv shared library handling interface See merge request isc-projects/bind9!4278
This commit is contained in:
commit
d0a988dcab
44 changed files with 164 additions and 291 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -39,7 +39,6 @@ __pycache__/
|
|||
/depcomp
|
||||
/install-sh
|
||||
/isc-config.sh
|
||||
/libltdl/*
|
||||
/libtool
|
||||
/ltmain.sh
|
||||
/m4/libtool.m4
|
||||
|
|
|
|||
|
|
@ -1527,9 +1527,9 @@ gcov:
|
|||
# Generate XML file in the Cobertura XML format suitable for use by GitLab
|
||||
# for the purpose of displaying code coverage information in the diff view
|
||||
# of a given merge request.
|
||||
- gcovr --root . --exclude-directories bin/tests --exclude-directories doc --exclude-directories libltdl --exclude-directories lib/samples --exclude 'lib/.*/tests/.*' --xml -o coverage.xml
|
||||
- gcovr --root . --exclude-directories bin/tests --exclude-directories doc --exclude-directories libltdl --exclude-directories lib/samples --exclude 'lib/.*/tests/.*' --html-details -o coverage.html
|
||||
- gcovr --root . --exclude-directories bin/tests --exclude-directories doc --exclude-directories libltdl --exclude-directories lib/samples --exclude 'lib/.*/tests/.*' -o coverage.txt
|
||||
- gcovr --root . --exclude-directories bin/tests --exclude-directories doc --exclude-directories lib/samples --exclude 'lib/.*/tests/.*' --xml -o coverage.xml
|
||||
- gcovr --root . --exclude-directories bin/tests --exclude-directories doc --exclude-directories lib/samples --exclude 'lib/.*/tests/.*' --html-details -o coverage.html
|
||||
- gcovr --root . --exclude-directories bin/tests --exclude-directories doc --exclude-directories lib/samples --exclude 'lib/.*/tests/.*' -o coverage.txt
|
||||
- tail -n 3 coverage.txt
|
||||
artifacts:
|
||||
paths:
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ path_classifiers:
|
|||
- "**/*.5"
|
||||
- "**/*.8"
|
||||
queries:
|
||||
- exclude: libltdl/
|
||||
- exclude: fuzz/
|
||||
- exclude: "bin/tests/system/*/ans*/*.py"
|
||||
- exclude: cpp/use-of-goto
|
||||
|
|
|
|||
3
CHANGES
3
CHANGES
|
|
@ -1,3 +1,6 @@
|
|||
5521. [func] All use of libltdl was dropped. libuv's shared library
|
||||
handling interface is now used instead. [GL !4278]
|
||||
|
||||
5520. [bug] Fixed a number of shutdown races, reference counting
|
||||
errors, and spurious log messages that could occur
|
||||
in the network manager. [GL #2221]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
include $(top_srcdir)/Makefile.top
|
||||
|
||||
SUBDIRS = . libltdl lib doc bin fuzz
|
||||
SUBDIRS = . lib doc bin fuzz
|
||||
|
||||
BUILT_SOURCES = bind.keys.h
|
||||
CLEANFILES = bind.keys.h
|
||||
|
|
|
|||
|
|
@ -93,9 +93,3 @@ LIBBIND9_CFLAGS = \
|
|||
|
||||
LIBBIND9_LIBS = \
|
||||
$(top_builddir)/lib/bind9/libbind9.la
|
||||
|
||||
LIBLTDL_CFLAGS = \
|
||||
-I$(top_srcdir)/libltdl
|
||||
|
||||
LIBLTDL_LIBS = \
|
||||
$(top_builddir)/libltdl/libltdlc.la
|
||||
|
|
|
|||
|
|
@ -201,7 +201,6 @@ installed:
|
|||
autoconf (includes autoreconf)
|
||||
automake
|
||||
libtool
|
||||
libltdl-dev (Debian) / libtool-ltdl-dev (Fedora/CentOS) / libltdl (FreeBSD)
|
||||
|
||||
#### <a name="opts"/> Compile-time options
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ AM_CPPFLAGS += \
|
|||
$(LIBISCCC_CFLAGS) \
|
||||
$(LIBISCCFG_CFLAGS) \
|
||||
$(LIBBIND9_CFLAGS) \
|
||||
$(LIBLTDL_CFLAGS) \
|
||||
$(OPENSSL_CFLAGS) \
|
||||
$(LIBCAP_CFLAGS) \
|
||||
$(LMDB_CFLAGS) \
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@
|
|||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <ltdl.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <uv.h>
|
||||
|
||||
#include <isc/mem.h>
|
||||
#include <isc/print.h>
|
||||
|
|
@ -34,7 +34,7 @@ typedef struct dlopen_data {
|
|||
isc_mem_t *mctx;
|
||||
char *dl_path;
|
||||
char *dlzname;
|
||||
void *dl_handle;
|
||||
uv_lib_t dl_handle;
|
||||
void *dbdata;
|
||||
unsigned int flags;
|
||||
isc_mutex_t lock;
|
||||
|
|
@ -180,9 +180,10 @@ dlopen_dlz_lookup(const char *zone, const char *name, void *driverarg,
|
|||
*/
|
||||
static void *
|
||||
dl_load_symbol(dlopen_data_t *cd, const char *symbol, bool mandatory) {
|
||||
void *ptr = lt_dlsym((lt_dlhandle)cd->dl_handle, symbol);
|
||||
if (ptr == NULL) {
|
||||
const char *errmsg = lt_dlerror();
|
||||
void *ptr = NULL;
|
||||
int r = uv_dlsym(&cd->dl_handle, symbol, &ptr);
|
||||
if (r != 0) {
|
||||
const char *errmsg = uv_dlerror(&cd->dl_handle);
|
||||
if (errmsg == NULL) {
|
||||
errmsg = "returned function pointer is NULL";
|
||||
}
|
||||
|
|
@ -193,11 +194,13 @@ dl_load_symbol(dlopen_data_t *cd, const char *symbol, bool mandatory) {
|
|||
cd->dl_path, symbol, errmsg);
|
||||
}
|
||||
}
|
||||
/* Cleanup any errors */
|
||||
(void)lt_dlerror();
|
||||
|
||||
return (ptr);
|
||||
}
|
||||
|
||||
static void
|
||||
dlopen_dlz_destroy(void *driverarg, void *dbdata);
|
||||
|
||||
/*
|
||||
* Called at startup for each dlopen zone in named.conf
|
||||
*/
|
||||
|
|
@ -207,6 +210,7 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
|
|||
dlopen_data_t *cd;
|
||||
isc_mem_t *mctx = NULL;
|
||||
isc_result_t result = ISC_R_FAILURE;
|
||||
int r;
|
||||
|
||||
UNUSED(driverarg);
|
||||
|
||||
|
|
@ -218,10 +222,6 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
|
|||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
if (lt_dlinit() != 0) {
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
isc_mem_create(&mctx);
|
||||
cd = isc_mem_get(mctx, sizeof(*cd));
|
||||
memset(cd, 0, sizeof(*cd));
|
||||
|
|
@ -234,17 +234,19 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
|
|||
/* Initialize the lock */
|
||||
isc_mutex_init(&cd->lock);
|
||||
|
||||
cd->dl_handle = lt_dlopenext(cd->dl_path);
|
||||
if (cd->dl_handle == NULL) {
|
||||
r = uv_dlopen(cd->dl_path, &cd->dl_handle);
|
||||
if (r != 0) {
|
||||
const char *errmsg = uv_dlerror(&cd->dl_handle);
|
||||
if (errmsg == NULL) {
|
||||
errmsg = "unknown error";
|
||||
}
|
||||
dlopen_log(ISC_LOG_ERROR,
|
||||
"dlz_dlopen failed to open library '%s': %s",
|
||||
cd->dl_path, lt_dlerror());
|
||||
cd->dl_path, errmsg);
|
||||
result = ISC_R_FAILURE;
|
||||
goto failed;
|
||||
}
|
||||
|
||||
(void)lt_dlerror();
|
||||
|
||||
/* Find the symbols */
|
||||
cd->dlz_version =
|
||||
(dlz_dlopen_version_t *)dl_load_symbol(cd, "dlz_version", true);
|
||||
|
|
@ -323,15 +325,8 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
|
|||
failed:
|
||||
dlopen_log(ISC_LOG_ERROR, "dlz_dlopen of '%s' failed", dlzname);
|
||||
|
||||
isc_mem_free(mctx, cd->dl_path);
|
||||
isc_mem_free(mctx, cd->dlzname);
|
||||
dlopen_dlz_destroy(NULL, cd);
|
||||
|
||||
isc_mutex_destroy(&cd->lock);
|
||||
if (cd->dl_handle) {
|
||||
(void)lt_dlclose(cd->dl_handle);
|
||||
}
|
||||
isc_mem_put(mctx, cd, sizeof(*cd));
|
||||
isc_mem_destroy(&mctx);
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
|
@ -341,32 +336,20 @@ failed:
|
|||
static void
|
||||
dlopen_dlz_destroy(void *driverarg, void *dbdata) {
|
||||
dlopen_data_t *cd = (dlopen_data_t *)dbdata;
|
||||
isc_mem_t *mctx;
|
||||
|
||||
UNUSED(driverarg);
|
||||
|
||||
if (cd->dlz_destroy) {
|
||||
if (cd->dlz_destroy && cd->dbdata) {
|
||||
MAYBE_LOCK(cd);
|
||||
cd->dlz_destroy(cd->dbdata);
|
||||
MAYBE_UNLOCK(cd);
|
||||
}
|
||||
|
||||
if (cd->dl_path) {
|
||||
isc_mem_free(cd->mctx, cd->dl_path);
|
||||
}
|
||||
if (cd->dlzname) {
|
||||
isc_mem_free(cd->mctx, cd->dlzname);
|
||||
}
|
||||
|
||||
if (cd->dl_handle) {
|
||||
lt_dlclose(cd->dl_handle);
|
||||
}
|
||||
|
||||
uv_dlclose(&cd->dl_handle);
|
||||
isc_mutex_destroy(&cd->lock);
|
||||
|
||||
mctx = cd->mctx;
|
||||
isc_mem_put(mctx, cd, sizeof(*cd));
|
||||
isc_mem_destroy(&mctx);
|
||||
isc_mem_free(cd->mctx, cd->dl_path);
|
||||
isc_mem_free(cd->mctx, cd->dlzname);
|
||||
isc_mem_putanddetach(&cd->mctx, cd, sizeof(*cd));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -13,11 +13,6 @@
|
|||
|
||||
/* aliases for the exported symbols */
|
||||
|
||||
#define plugin_destroy filter_aaaa_LTX_plugin_destroy
|
||||
#define plugin_register filter_aaaa_LTX_plugin_register
|
||||
#define plugin_version filter_aaaa_LTX_plugin_version
|
||||
#define plugin_check filter_aaaa_LTX_plugin_check
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
|
|
|||
|
|
@ -32,21 +32,6 @@
|
|||
|
||||
/* aliases for exported symbols */
|
||||
|
||||
#define dlz_version dlzexternal_LTX_dlz_version
|
||||
#define dlz_create dlzexternal_LTX_dlz_create
|
||||
#define dlz_destroy dlzexternal_LTX_dlz_destroy
|
||||
#define dlz_findzonedb dlzexternal_LTX_dlz_findzonedb
|
||||
#define dlz_lookup dlzexternal_LTX_dlz_lookup
|
||||
#define dlz_allowzonexfr dlzexternal_LTX_dlz_allowzonexfr
|
||||
#define dlz_allnodes dlzexternal_LTX_dlz_allnodes
|
||||
#define dlz_newversion dlzexternal_LTX_dlz_newversion
|
||||
#define dlz_closeversion dlzexternal_LTX_dlz_closeversion
|
||||
#define dlz_configure dlzexternal_LTX_dlz_configure
|
||||
#define dlz_ssumatch dlzexternal_LTX_dlz_ssumatch
|
||||
#define dlz_addrdataset dlzexternal_LTX_dlz_addrdataset
|
||||
#define dlz_sbrdataset dlzexternal_LTX_dlz_sbrdataset
|
||||
#define dlz_delrdataset dlzexternal_LTX_dlz_delrdataset
|
||||
|
||||
dlz_dlopen_version_t dlz_version;
|
||||
dlz_dlopen_create_t dlz_create;
|
||||
dlz_dlopen_destroy_t dlz_destroy;
|
||||
|
|
|
|||
|
|
@ -35,29 +35,29 @@ controls {
|
|||
};
|
||||
|
||||
dlz "example one" {
|
||||
database "dlopen ../driver/dlzexternal.la example.nil";
|
||||
database "dlopen ../driver/.libs/dlzexternal.so example.nil";
|
||||
};
|
||||
|
||||
dlz "example two" {
|
||||
database "dlopen ../driver/dlzexternal.la alternate.nil";
|
||||
database "dlopen ../driver/.libs/dlzexternal.so alternate.nil";
|
||||
};
|
||||
|
||||
dlz "example three" {
|
||||
database "dlopen ../driver/dlzexternal.la example.org";
|
||||
database "dlopen ../driver/.libs/dlzexternal.so example.org";
|
||||
};
|
||||
|
||||
dlz "unsearched1" {
|
||||
database "dlopen ../driver/dlzexternal.la other.nil";
|
||||
database "dlopen ../driver/.libs/dlzexternal.so other.nil";
|
||||
search no;
|
||||
};
|
||||
|
||||
dlz "unsearched2" {
|
||||
database "dlopen ../driver/dlzexternal.la zone.nil";
|
||||
database "dlopen ../driver/.libs/dlzexternal.so zone.nil";
|
||||
search no;
|
||||
};
|
||||
|
||||
dlz redzone {
|
||||
database "dlopen ../driver/dlzexternal.la .";
|
||||
database "dlopen ../driver/.libs/dlzexternal.so .";
|
||||
search no;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -33,10 +33,6 @@
|
|||
|
||||
/* aliases for the exported symbols */
|
||||
|
||||
#define dyndb_init sample_LTX_dyndb_init
|
||||
#define dyndb_destroy sample_LTX_dyndb_destroy
|
||||
#define dyndb_version sample_LTX_dyndb_version
|
||||
|
||||
dns_dyndb_destroy_t dyndb_destroy;
|
||||
dns_dyndb_register_t dyndb_init;
|
||||
dns_dyndb_version_t dyndb_version;
|
||||
|
|
|
|||
|
|
@ -33,5 +33,5 @@ controls {
|
|||
inet 10.53.0.1 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
|
||||
};
|
||||
|
||||
dyndb sample "../driver/sample.la" { ipv4.example.nil. in-addr.arpa. };
|
||||
dyndb sample2 "../driver/sample.la" { ipv6.example.nil. 8.b.d.0.1.0.0.2.ip6.arpa. };
|
||||
dyndb sample "../driver/.libs/sample.so" { ipv4.example.nil. in-addr.arpa. };
|
||||
dyndb sample2 "../driver/.libs/sample.so" { ipv6.example.nil. 8.b.d.0.1.0.0.2.ip6.arpa. };
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
plugin query "../../../plugins/filter-aaaa.la" {
|
||||
plugin query "../../../plugins/.libs/filter-aaaa.so" {
|
||||
filter-aaaa-on-v4 yes;
|
||||
filter-aaaa { none; };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
plugin query "../../../plugins/filter-aaaa.la" {
|
||||
plugin query "../../../plugins/.libs/filter-aaaa.so" {
|
||||
/*
|
||||
* While this matches the defaults, it is not a good configuration
|
||||
* to have in named.conf as the two options contradict each other
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
*/
|
||||
|
||||
view myview {
|
||||
plugin query "../../../plugins/filter-aaaa.la" {
|
||||
plugin query "../../../plugins/.libs/filter-aaaa.so" {
|
||||
filter-aaaa-on-v4 no;
|
||||
filter-aaaa { any; };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
*/
|
||||
|
||||
view myview {
|
||||
plugin query "../../../plugins/filter-aaaa.la" {
|
||||
plugin query "../../../plugins/.libs/filter-aaaa.so" {
|
||||
filter-aaaa-on-v4 yes;
|
||||
filter-aaaa { none; };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
plugin query "../../../plugins/filter-aaaa.la" {
|
||||
plugin query "../../../plugins/.libs/filter-aaaa.so" {
|
||||
filter-aaaa-on-v4 yes;
|
||||
filter-aaaa { 1.0.0.0/8; };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@
|
|||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
plugin query "../../../plugins/filter-aaaa.la" {
|
||||
plugin query "../../../plugins/.libs/filter-aaaa.so" {
|
||||
filter-aaaa-on-v4 yes;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@
|
|||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
plugin query "../../../plugins/filter-aaaa.la" {
|
||||
plugin query "../../../plugins/.libs/filter-aaaa.so" {
|
||||
filter-aaaa-on-v4 break-dnssec;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
plugin query "../../../plugins/filter-aaaa.la" {
|
||||
plugin query "../../../plugins/.libs/filter-aaaa.so" {
|
||||
filter-aaaa-on-v4 break-dnssec;
|
||||
filter-aaaa { 1.0.0.0/8; };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
plugin query "../../../plugins/filter-aaaa.la" {
|
||||
plugin query "../../../plugins/.libs/filter-aaaa.so" {
|
||||
filter-aaaa-on-v4 yes;
|
||||
filter-aaaa { 1.0.0.0/8; };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
*/
|
||||
|
||||
view myview {
|
||||
plugin query "../../../plugins/filter-aaaa.la" {
|
||||
plugin query "../../../plugins/.libs/filter-aaaa.so" {
|
||||
filter-aaaa-on-v4 yes;
|
||||
filter-aaaa { 1.0.0.0/8; };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ options {
|
|||
|
||||
acl filterees { 10.53.0.1; };
|
||||
|
||||
plugin query "../../../../plugins/filter-aaaa.la" {
|
||||
plugin query "../../../../plugins/.libs/filter-aaaa.so" {
|
||||
filter-aaaa-on-v4 yes;
|
||||
filter-aaaa { filterees; };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ options {
|
|||
minimal-responses no;
|
||||
};
|
||||
|
||||
plugin query "../../../../plugins/filter-aaaa.la" {
|
||||
plugin query "../../../../plugins/.libs/filter-aaaa.so" {
|
||||
filter-aaaa-on-v6 yes;
|
||||
filter-aaaa { fd92:7065:b8e:ffff::1; };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ options {
|
|||
minimal-responses no;
|
||||
};
|
||||
|
||||
plugin query "../../../../plugins/filter-aaaa.la" {
|
||||
plugin query "../../../../plugins/.libs/filter-aaaa.so" {
|
||||
filter-aaaa-on-v4 yes;
|
||||
filter-aaaa { 10.53.0.2; };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ options {
|
|||
minimal-responses no;
|
||||
};
|
||||
|
||||
plugin query "../../../../plugins/filter-aaaa.la" {
|
||||
plugin query "../../../../plugins/.libs/filter-aaaa.so" {
|
||||
filter-aaaa-on-v6 yes;
|
||||
filter-aaaa { fd92:7065:b8e:ffff::2; };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ options {
|
|||
minimal-responses no;
|
||||
};
|
||||
|
||||
plugin query "../../../../plugins/filter-aaaa.la" {
|
||||
plugin query "../../../../plugins/.libs/filter-aaaa.so" {
|
||||
filter-aaaa-on-v4 break-dnssec;
|
||||
filter-aaaa { 10.53.0.3; };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ options {
|
|||
minimal-responses no;
|
||||
};
|
||||
|
||||
plugin query "../../../../plugins/filter-aaaa.la" {
|
||||
plugin query "../../../../plugins/.libs/filter-aaaa.so" {
|
||||
filter-aaaa-on-v6 break-dnssec;
|
||||
filter-aaaa { fd92:7065:b8e:ffff::3; };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ options {
|
|||
minimal-responses no;
|
||||
};
|
||||
|
||||
plugin query "../../../../plugins/filter-aaaa.la" {
|
||||
plugin query "../../../../plugins/.libs/filter-aaaa.so" {
|
||||
filter-aaaa-on-v4 break-dnssec;
|
||||
filter-aaaa { 10.53.0.4; };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ options {
|
|||
minimal-responses no;
|
||||
};
|
||||
|
||||
plugin query "../../../../plugins/filter-aaaa.la" {
|
||||
plugin query "../../../../plugins/.libs/filter-aaaa.so" {
|
||||
filter-aaaa-on-v6 break-dnssec;
|
||||
filter-aaaa { fd92:7065:b8e:ffff::4; };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ options {
|
|||
minimal-responses no;
|
||||
};
|
||||
|
||||
plugin query "../../../../plugins/filter-aaaa.la" {
|
||||
plugin query "../../../../plugins/.libs/filter-aaaa.so" {
|
||||
filter-aaaa-on-v4 break-dnssec;
|
||||
filter-aaaa { any; };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -124,10 +124,6 @@ LT_INIT([disable-static dlopen pic-only])
|
|||
AS_IF([test "$enable_static" != "no" && test "$enable_developer" != "yes"],
|
||||
[AC_MSG_ERROR([Static linking is not supported as it disables dlopen() and certain security features (e.g. RELRO, ASLR)])])
|
||||
|
||||
LT_CONFIG_LTDL_DIR([libltdl])
|
||||
LTDL_INIT([recursive])
|
||||
AC_CONFIG_FILES([libltdl/Makefile])
|
||||
|
||||
#
|
||||
# Set the default CFLAGS and CPPFLAGS
|
||||
#
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ gen_SOURCES = gen.c gen-unix.h
|
|||
gen_CPPFLAGS = \
|
||||
$(AM_CPPFLAGS)
|
||||
|
||||
EXTRA_DIST = \
|
||||
EXTRA_DIST = \
|
||||
api \
|
||||
dnstap.proto \
|
||||
gen-win32.h \
|
||||
|
|
@ -277,10 +277,10 @@ endif
|
|||
|
||||
libdns_la_CPPFLAGS = \
|
||||
$(AM_CPPFLAGS) \
|
||||
$(LIBISC_CFLAGS) \
|
||||
$(LIBDNS_CFLAGS) \
|
||||
$(OPENSSL_CFLAGS) \
|
||||
$(LIBLTDL_CFLAGS)
|
||||
$(LIBISC_CFLAGS) \
|
||||
$(LIBUV_CFLAGS) \
|
||||
$(OPENSSL_CFLAGS)
|
||||
|
||||
libdns_la_LDFLAGS = \
|
||||
$(AM_LDFLAGS) \
|
||||
|
|
@ -288,6 +288,7 @@ libdns_la_LDFLAGS = \
|
|||
|
||||
libdns_la_LIBADD = \
|
||||
$(LIBISC_LIBS) \
|
||||
$(LIBUV_LIBS) \
|
||||
$(OPENSSL_LIBS)
|
||||
|
||||
if HAVE_JSON_C
|
||||
|
|
|
|||
105
lib/dns/dyndb.c
105
lib/dns/dyndb.c
|
|
@ -9,8 +9,8 @@
|
|||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#include <ltdl.h>
|
||||
#include <string.h>
|
||||
#include <uv.h>
|
||||
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/mem.h>
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
typedef struct dyndb_implementation dyndb_implementation_t;
|
||||
struct dyndb_implementation {
|
||||
isc_mem_t *mctx;
|
||||
void *handle;
|
||||
uv_lib_t handle;
|
||||
dns_dyndb_register_t *register_func;
|
||||
dns_dyndb_destroy_t *destroy_func;
|
||||
char *name;
|
||||
|
|
@ -79,43 +79,44 @@ impfind(const char *name) {
|
|||
}
|
||||
|
||||
static isc_result_t
|
||||
load_symbol(lt_dlhandle handle, const char *filename, const char *symbol_name,
|
||||
load_symbol(uv_lib_t *handle, const char *filename, const char *symbol_name,
|
||||
void **symbolp) {
|
||||
void *symbol;
|
||||
int r;
|
||||
|
||||
REQUIRE(handle != NULL);
|
||||
REQUIRE(symbolp != NULL && *symbolp == NULL);
|
||||
|
||||
symbol = lt_dlsym(handle, symbol_name);
|
||||
if (symbol == NULL) {
|
||||
const char *errmsg = lt_dlerror();
|
||||
r = uv_dlsym(handle, symbol_name, &symbol);
|
||||
if (r != 0) {
|
||||
const char *errmsg = uv_dlerror(handle);
|
||||
if (errmsg == NULL) {
|
||||
errmsg = "returned function pointer is NULL";
|
||||
}
|
||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
||||
DNS_LOGMODULE_DYNDB, ISC_LOG_ERROR,
|
||||
"failed to lookup symbol %s in "
|
||||
"dyndb module '%s': %s",
|
||||
"DynDB module '%s': %s",
|
||||
symbol_name, filename, errmsg);
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
(void)lt_dlerror();
|
||||
|
||||
*symbolp = symbol;
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static void
|
||||
unload_library(dyndb_implementation_t **impp);
|
||||
|
||||
static isc_result_t
|
||||
load_library(isc_mem_t *mctx, const char *filename, const char *instname,
|
||||
dyndb_implementation_t **impp) {
|
||||
isc_result_t result;
|
||||
lt_dlhandle handle = NULL;
|
||||
dyndb_implementation_t *imp = NULL;
|
||||
dns_dyndb_register_t *register_func = NULL;
|
||||
dns_dyndb_destroy_t *destroy_func = NULL;
|
||||
dns_dyndb_version_t *version_func = NULL;
|
||||
int version;
|
||||
int r;
|
||||
|
||||
REQUIRE(impp != NULL && *impp == NULL);
|
||||
|
||||
|
|
@ -123,19 +124,29 @@ load_library(isc_mem_t *mctx, const char *filename, const char *instname,
|
|||
ISC_LOG_INFO, "loading DynDB instance '%s' driver '%s'",
|
||||
instname, filename);
|
||||
|
||||
if (lt_dlinit() != 0) {
|
||||
imp = isc_mem_get(mctx, sizeof(*imp));
|
||||
memset(imp, 0, sizeof(*imp));
|
||||
isc_mem_attach(mctx, &imp->mctx);
|
||||
|
||||
imp->name = isc_mem_strdup(imp->mctx, instname);
|
||||
|
||||
INIT_LINK(imp, link);
|
||||
|
||||
r = uv_dlopen(filename, &imp->handle);
|
||||
if (r != 0) {
|
||||
const char *errmsg = uv_dlerror(&imp->handle);
|
||||
if (errmsg == NULL) {
|
||||
errmsg = "unknown error";
|
||||
}
|
||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
||||
DNS_LOGMODULE_DYNDB, ISC_LOG_ERROR,
|
||||
"failed to dlopen() DynDB instance '%s' driver "
|
||||
"'%s': %s",
|
||||
instname, filename, errmsg);
|
||||
CHECK(ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
handle = lt_dlopen(filename);
|
||||
if (handle == NULL) {
|
||||
CHECK(ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
/* Clear dlerror */
|
||||
(void)lt_dlerror();
|
||||
|
||||
CHECK(load_symbol(handle, filename, "dyndb_version",
|
||||
CHECK(load_symbol(&imp->handle, filename, "dyndb_version",
|
||||
(void **)&version_func));
|
||||
|
||||
version = version_func(NULL);
|
||||
|
|
@ -149,42 +160,23 @@ load_library(isc_mem_t *mctx, const char *filename, const char *instname,
|
|||
CHECK(ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
CHECK(load_symbol(handle, filename, "dyndb_init",
|
||||
(void **)®ister_func));
|
||||
CHECK(load_symbol(handle, filename, "dyndb_destroy",
|
||||
(void **)&destroy_func));
|
||||
|
||||
imp = isc_mem_get(mctx, sizeof(dyndb_implementation_t));
|
||||
|
||||
imp->mctx = NULL;
|
||||
isc_mem_attach(mctx, &imp->mctx);
|
||||
imp->handle = handle;
|
||||
imp->register_func = register_func;
|
||||
imp->destroy_func = destroy_func;
|
||||
imp->name = isc_mem_strdup(mctx, instname);
|
||||
|
||||
imp->inst = NULL;
|
||||
INIT_LINK(imp, link);
|
||||
CHECK(load_symbol(&imp->handle, filename, "dyndb_init",
|
||||
(void **)&imp->register_func));
|
||||
CHECK(load_symbol(&imp->handle, filename, "dyndb_destroy",
|
||||
(void **)&imp->destroy_func));
|
||||
|
||||
*impp = imp;
|
||||
imp = NULL;
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
cleanup:
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
||||
DNS_LOGMODULE_DYNDB, ISC_LOG_ERROR,
|
||||
"failed to dynamically load instance '%s' "
|
||||
"driver '%s': %s (%s)",
|
||||
instname, filename, lt_dlerror(),
|
||||
isc_result_totext(result));
|
||||
}
|
||||
if (imp != NULL) {
|
||||
isc_mem_putanddetach(&imp->mctx, imp,
|
||||
sizeof(dyndb_implementation_t));
|
||||
}
|
||||
if (result != ISC_R_SUCCESS && handle != NULL) {
|
||||
(void)lt_dlclose(handle);
|
||||
}
|
||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_DYNDB,
|
||||
ISC_LOG_ERROR,
|
||||
"failed to dynamically load DynDB instance '%s' driver "
|
||||
"'%s': %s",
|
||||
instname, filename, isc_result_totext(result));
|
||||
|
||||
unload_library(&imp);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
|
@ -198,8 +190,13 @@ unload_library(dyndb_implementation_t **impp) {
|
|||
imp = *impp;
|
||||
*impp = NULL;
|
||||
|
||||
/*
|
||||
* This is a resource leak, but there is nothing we can currently do
|
||||
* about it due to how configuration loading/reloading is designed.
|
||||
*/
|
||||
/* uv_dlclose(&imp->handle); */
|
||||
isc_mem_free(imp->mctx, imp->name);
|
||||
isc_mem_putanddetach(&imp->mctx, imp, sizeof(dyndb_implementation_t));
|
||||
isc_mem_putanddetach(&imp->mctx, imp, sizeof(*imp));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@
|
|||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>BIND9;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBDNS_EXPORTS;%(PreprocessorDefinitions);%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ForcedIncludeFiles>..\..\..\config.h</ForcedIncludeFiles>
|
||||
<AdditionalIncludeDirectories>.\;..\..\..\;include;..\include;..\..\isc;..\..\isc\win32;..\..\isc\win32\include;..\..\isc\include;@LIBXML2_INC@@OPENSSL_INC@@GSSAPI_INC@@GEOIP_INC@%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>.\;..\..\..\;include;..\include;..\..\isc;..\..\isc\win32;..\..\isc\win32\include;..\..\isc\include;@LIBXML2_INC@@LIBUV_INC@@OPENSSL_INC@@GSSAPI_INC@@GEOIP_INC@%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeaderOutputFile>.\$(Configuration)\$(TargetName).pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\$(Configuration)\</AssemblerListingLocation>
|
||||
|
|
@ -75,7 +75,7 @@
|
|||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<OutputFile>..\..\..\Build\$(Configuration)\$(TargetName)$(TargetExt)</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\isc\win32\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>@OPENSSL_LIB@libisc.lib;@LIBXML2_LIB@@GSSAPI_LIB@@KRB5_LIB@@GEOIP_LIB@ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>@LIBUV_LIB@@OPENSSL_LIB@libisc.lib;@LIBXML2_LIB@@GSSAPI_LIB@@KRB5_LIB@@GEOIP_LIB@ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>$(ProjectName).def</ModuleDefinitionFile>
|
||||
<ImportLibrary>.\$(Configuration)\$(ProjectName).lib</ImportLibrary>
|
||||
</Link>
|
||||
|
|
@ -91,7 +91,7 @@
|
|||
<IntrinsicFunctions>@INTRINSIC@</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>BIND9;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBDNS_EXPORTS;%(PreprocessorDefinitions);%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ForcedIncludeFiles>..\..\..\config.h</ForcedIncludeFiles>
|
||||
<AdditionalIncludeDirectories>.\;..\..\..\;include;..\include;..\..\isc;..\..\isc\win32;..\..\isc\win32\include;..\..\isc\include;@LIBXML2_INC@@OPENSSL_INC@@GSSAPI_INC@@GEOIP_INC@%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>.\;..\..\..\;include;..\include;..\..\isc;..\..\isc\win32;..\..\isc\win32\include;..\..\isc\include;@LIBXML2_INC@@LIBUV_INC@@OPENSSL_INC@@GSSAPI_INC@@GEOIP_INC@%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<StringPooling>true</StringPooling>
|
||||
<PrecompiledHeaderOutputFile>.\$(Configuration)\$(TargetName).pch</PrecompiledHeaderOutputFile>
|
||||
|
|
@ -108,7 +108,7 @@
|
|||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<OutputFile>..\..\..\Build\$(Configuration)\$(TargetName)$(TargetExt)</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\isc\win32\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>@OPENSSL_LIB@libisc.lib;@LIBXML2_LIB@@GSSAPI_LIB@@KRB5_LIB@@GEOIP_LIB@ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>@LIBUV_LIB@@OPENSSL_LIB@libisc.lib;@LIBXML2_LIB@@GSSAPI_LIB@@KRB5_LIB@@GEOIP_LIB@ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>$(ProjectName).def</ModuleDefinitionFile>
|
||||
<ImportLibrary>.\$(Configuration)\$(ProjectName).lib</ImportLibrary>
|
||||
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
|
||||
|
|
|
|||
|
|
@ -230,7 +230,6 @@ libisc_la_LDFLAGS = \
|
|||
$(libisc_VERSION_INFO)
|
||||
|
||||
libisc_la_LIBADD = \
|
||||
$(LIBLTDL_LIBS) \
|
||||
$(LIBUV_LIBS) \
|
||||
$(OPENSSL_LIBS) \
|
||||
$(ZLIB_LIBS)
|
||||
|
|
|
|||
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#define lt_dlhandle HMODULE
|
||||
#define lt_dlinit() ISC_R_SUCCESS
|
||||
#define lt_dlopen(f) LoadLibraryW(f)
|
||||
#define lt_dlsym(h, s) GetProcAddress(h, s)
|
||||
#define lt_dlclose(h) FreeLibrary(h)
|
||||
|
||||
__declspec(thread) LPSTR __dlerror_message[1024] = { 0 };
|
||||
|
||||
static const char *
|
||||
lt_dlerror(void) {
|
||||
DWORD errorMessageID = GetLastError();
|
||||
if (errorMessageID == 0) {
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
LPSTR messageBuffer = NULL;
|
||||
size_t size = FormatMessageA(
|
||||
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
|
||||
FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL, errorMessageID, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
(LPSTR)&messageBuffer, 0, NULL);
|
||||
|
||||
strlcpy(__dlerror_message, messageBuffer, sizeof(__dlerror_message));
|
||||
|
||||
LocalFree(messageBuffer);
|
||||
|
||||
return ((const char *)__dlerror_message);
|
||||
}
|
||||
|
|
@ -41,14 +41,15 @@ libns_la_SOURCES = \
|
|||
|
||||
libns_la_CPPFLAGS = \
|
||||
$(AM_CPPFLAGS) \
|
||||
$(LIBISC_CFLAGS) \
|
||||
$(LIBDNS_CFLAGS) \
|
||||
$(LIBISC_CFLAGS) \
|
||||
$(LIBNS_CFLAGS) \
|
||||
$(LIBLTDL_CFLAGS)
|
||||
$(LIBUV_CFLAGS)
|
||||
|
||||
libns_la_LIBADD = \
|
||||
$(LIBDNS_LIBS) \
|
||||
$(LIBISC_LIBS) \
|
||||
$(LIBDNS_LIBS)
|
||||
$(LIBUV_LIBS)
|
||||
|
||||
libns_la_LDFLAGS = \
|
||||
$(AM_LDFLAGS) \
|
||||
|
|
|
|||
103
lib/ns/hooks.c
103
lib/ns/hooks.c
|
|
@ -12,9 +12,9 @@
|
|||
/*! \file */
|
||||
|
||||
#include <errno.h>
|
||||
#include <ltdl.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <uv.h>
|
||||
|
||||
#include <isc/errno.h>
|
||||
#include <isc/list.h>
|
||||
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
struct ns_plugin {
|
||||
isc_mem_t *mctx;
|
||||
void *handle;
|
||||
uv_lib_t handle;
|
||||
void *inst;
|
||||
char *modpath;
|
||||
ns_plugin_check_t *check_func;
|
||||
|
|
@ -91,24 +91,17 @@ ns_plugin_expandpath(const char *src, char *dst, size_t dstsize) {
|
|||
}
|
||||
|
||||
static isc_result_t
|
||||
load_symbol(void *handle, const char *modpath, const char *symbol_name,
|
||||
load_symbol(uv_lib_t *handle, const char *modpath, const char *symbol_name,
|
||||
void **symbolp) {
|
||||
void *symbol = NULL;
|
||||
int r;
|
||||
|
||||
REQUIRE(handle != NULL);
|
||||
REQUIRE(symbolp != NULL && *symbolp == NULL);
|
||||
|
||||
/*
|
||||
* Clear any pre-existing error conditions before running dlsym().
|
||||
* (In this case, we expect dlsym() to return non-NULL values
|
||||
* and will always return an error if it returns NULL, but
|
||||
* this ensures that we'll report the correct error condition
|
||||
* if there is one.)
|
||||
*/
|
||||
lt_dlerror();
|
||||
symbol = lt_dlsym(handle, symbol_name);
|
||||
if (symbol == NULL) {
|
||||
const char *errmsg = lt_dlerror();
|
||||
r = uv_dlsym(handle, symbol_name, &symbol);
|
||||
if (r != 0) {
|
||||
const char *errmsg = uv_dlerror(handle);
|
||||
if (errmsg == NULL) {
|
||||
errmsg = "returned function pointer is NULL";
|
||||
}
|
||||
|
|
@ -125,26 +118,30 @@ load_symbol(void *handle, const char *modpath, const char *symbol_name,
|
|||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static void
|
||||
unload_plugin(ns_plugin_t **pluginp);
|
||||
|
||||
static isc_result_t
|
||||
load_plugin(isc_mem_t *mctx, const char *modpath, ns_plugin_t **pluginp) {
|
||||
isc_result_t result;
|
||||
lt_dlhandle handle = NULL;
|
||||
ns_plugin_t *plugin = NULL;
|
||||
ns_plugin_check_t *check_func = NULL;
|
||||
ns_plugin_register_t *register_func = NULL;
|
||||
ns_plugin_destroy_t *destroy_func = NULL;
|
||||
ns_plugin_version_t *version_func = NULL;
|
||||
int version;
|
||||
int r;
|
||||
|
||||
REQUIRE(pluginp != NULL && *pluginp == NULL);
|
||||
|
||||
if (lt_dlinit() != 0) {
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
plugin = isc_mem_get(mctx, sizeof(*plugin));
|
||||
memset(plugin, 0, sizeof(*plugin));
|
||||
isc_mem_attach(mctx, &plugin->mctx);
|
||||
|
||||
handle = lt_dlopen(modpath);
|
||||
if (handle == NULL) {
|
||||
const char *errmsg = lt_dlerror();
|
||||
plugin->modpath = isc_mem_strdup(plugin->mctx, modpath);
|
||||
|
||||
ISC_LINK_INIT(plugin, link);
|
||||
|
||||
r = uv_dlopen(modpath, &plugin->handle);
|
||||
if (r != 0) {
|
||||
const char *errmsg = uv_dlerror(&plugin->handle);
|
||||
if (errmsg == NULL) {
|
||||
errmsg = "unknown error";
|
||||
}
|
||||
|
|
@ -152,10 +149,10 @@ load_plugin(isc_mem_t *mctx, const char *modpath, ns_plugin_t **pluginp) {
|
|||
NS_LOGMODULE_HOOKS, ISC_LOG_ERROR,
|
||||
"failed to dlopen() plugin '%s': %s", modpath,
|
||||
errmsg);
|
||||
return (ISC_R_FAILURE);
|
||||
CHECK(ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
CHECK(load_symbol(handle, modpath, "plugin_version",
|
||||
CHECK(load_symbol(&plugin->handle, modpath, "plugin_version",
|
||||
(void **)&version_func));
|
||||
|
||||
version = version_func();
|
||||
|
|
@ -169,44 +166,24 @@ load_plugin(isc_mem_t *mctx, const char *modpath, ns_plugin_t **pluginp) {
|
|||
CHECK(ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
CHECK(load_symbol(handle, modpath, "plugin_check",
|
||||
(void **)&check_func));
|
||||
CHECK(load_symbol(handle, modpath, "plugin_register",
|
||||
(void **)®ister_func));
|
||||
CHECK(load_symbol(handle, modpath, "plugin_destroy",
|
||||
(void **)&destroy_func));
|
||||
|
||||
plugin = isc_mem_get(mctx, sizeof(*plugin));
|
||||
memset(plugin, 0, sizeof(*plugin));
|
||||
isc_mem_attach(mctx, &plugin->mctx);
|
||||
plugin->handle = handle;
|
||||
plugin->modpath = isc_mem_strdup(plugin->mctx, modpath);
|
||||
plugin->check_func = check_func;
|
||||
plugin->register_func = register_func;
|
||||
plugin->destroy_func = destroy_func;
|
||||
|
||||
ISC_LINK_INIT(plugin, link);
|
||||
CHECK(load_symbol(&plugin->handle, modpath, "plugin_check",
|
||||
(void **)&plugin->check_func));
|
||||
CHECK(load_symbol(&plugin->handle, modpath, "plugin_register",
|
||||
(void **)&plugin->register_func));
|
||||
CHECK(load_symbol(&plugin->handle, modpath, "plugin_destroy",
|
||||
(void **)&plugin->destroy_func));
|
||||
|
||||
*pluginp = plugin;
|
||||
plugin = NULL;
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
cleanup:
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_log_write(ns_lctx, NS_LOGCATEGORY_GENERAL,
|
||||
NS_LOGMODULE_HOOKS, ISC_LOG_ERROR,
|
||||
"failed to dynamically load "
|
||||
"plugin '%s': %s",
|
||||
modpath, isc_result_totext(result));
|
||||
isc_log_write(ns_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_HOOKS,
|
||||
ISC_LOG_ERROR,
|
||||
"failed to dynamically load plugin '%s': %s", modpath,
|
||||
isc_result_totext(result));
|
||||
|
||||
if (plugin != NULL) {
|
||||
isc_mem_putanddetach(&plugin->mctx, plugin,
|
||||
sizeof(*plugin));
|
||||
}
|
||||
|
||||
if (handle != NULL) {
|
||||
(void)lt_dlclose(handle);
|
||||
}
|
||||
}
|
||||
unload_plugin(&plugin);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
|
@ -227,13 +204,9 @@ unload_plugin(ns_plugin_t **pluginp) {
|
|||
if (plugin->inst != NULL) {
|
||||
plugin->destroy_func(&plugin->inst);
|
||||
}
|
||||
if (plugin->handle != NULL) {
|
||||
(void)lt_dlclose(plugin->handle);
|
||||
}
|
||||
if (plugin->modpath != NULL) {
|
||||
isc_mem_free(plugin->mctx, plugin->modpath);
|
||||
}
|
||||
|
||||
uv_dlclose(&plugin->handle);
|
||||
isc_mem_free(plugin->mctx, plugin->modpath);
|
||||
isc_mem_putanddetach(&plugin->mctx, plugin, sizeof(*plugin));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@
|
|||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_USRDLL;LIBNS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ForcedIncludeFiles>..\..\..\config.h</ForcedIncludeFiles>
|
||||
<AdditionalIncludeDirectories>.\;..\..\..\;include;..\include;..\..\isc\win32;..\..\isc\win32\include;..\..\isc\include;..\..\..\lib\dns\include;@LIBXML2_INC@@OPENSSL_INC@@GSSAPI_INC@@GEOIP_INC@%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>.\;..\..\..\;include;..\include;..\..\isc\win32;..\..\isc\win32\include;..\..\isc\include;..\..\..\lib\dns\include;@LIBXML2_INC@@LIBUV_INC@@OPENSSL_INC@@GSSAPI_INC@@GEOIP_INC@%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeaderOutputFile>.\$(Configuration)\$(TargetName).pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\$(Configuration)\</AssemblerListingLocation>
|
||||
|
|
@ -74,7 +74,7 @@
|
|||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<OutputFile>..\..\..\Build\$(Configuration)\$(TargetName)$(TargetExt)</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\isc\win32\$(Configuration);..\..\..\lib\dns\win32\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>@OPENSSL_LIB@libisc.lib;libdns.lib;@LIBXML2_LIB@@GSSAPI_LIB@@GEOIP_LIB@ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>@LIBUV_LIB@@OPENSSL_LIB@libisc.lib;libdns.lib;@LIBXML2_LIB@@GSSAPI_LIB@@GEOIP_LIB@ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>$(ProjectName).def</ModuleDefinitionFile>
|
||||
<ImportLibrary>.\$(Configuration)\$(ProjectName).lib</ImportLibrary>
|
||||
</Link>
|
||||
|
|
@ -90,7 +90,7 @@
|
|||
<IntrinsicFunctions>@INTRINSIC@</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_USRDLL;LIBNS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ForcedIncludeFiles>..\..\..\config.h</ForcedIncludeFiles>
|
||||
<AdditionalIncludeDirectories>.\;..\..\..\;include;..\include;..\..\isc\win32;..\..\isc\win32\include;..\..\isc\include;..\..\..\lib\dns\include;@LIBXML2_INC@@OPENSSL_INC@@GSSAPI_INC@@GEOIP_INC@%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>.\;..\..\..\;include;..\include;..\..\isc\win32;..\..\isc\win32\include;..\..\isc\include;..\..\..\lib\dns\include;@LIBXML2_INC@@LIBUV_INC@@OPENSSL_INC@@GSSAPI_INC@@GEOIP_INC@%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<StringPooling>true</StringPooling>
|
||||
<PrecompiledHeaderOutputFile>.\$(Configuration)\$(TargetName).pch</PrecompiledHeaderOutputFile>
|
||||
|
|
@ -107,7 +107,7 @@
|
|||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<OutputFile>..\..\..\Build\$(Configuration)\$(TargetName)$(TargetExt)</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\isc\win32\$(Configuration);..\..\..\lib\dns\win32\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>@OPENSSL_LIB@libisc.lib;libdns.lib;@LIBXML2_LIB@@GSSAPI_LIB@@GEOIP_LIB@ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>@LIBUV_LIB@@OPENSSL_LIB@libisc.lib;libdns.lib;@LIBXML2_LIB@@GSSAPI_LIB@@GEOIP_LIB@ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>$(ProjectName).def</ModuleDefinitionFile>
|
||||
<ImportLibrary>.\$(Configuration)\$(ProjectName).lib</ImportLibrary>
|
||||
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
|
||||
|
|
|
|||
|
|
@ -2023,7 +2023,6 @@
|
|||
./lib/isc/win32/libisc.vcxproj.filters.in X 2013,2014,2015,2016,2018,2019,2020
|
||||
./lib/isc/win32/libisc.vcxproj.in X 2013,2014,2015,2016,2017,2018,2019,2020
|
||||
./lib/isc/win32/libisc.vcxproj.user X 2013,2018,2019,2020
|
||||
./lib/isc/win32/ltdl.h C 2020
|
||||
./lib/isc/win32/meminfo.c C 2015,2016,2018,2019,2020
|
||||
./lib/isc/win32/net.c C 1999,2000,2001,2002,2003,2004,2005,2007,2008,2009,2011,2012,2013,2014,2015,2016,2018,2019,2020
|
||||
./lib/isc/win32/netdb.h C 2000,2001,2004,2006,2007,2009,2013,2016,2018,2019,2020
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
unmatchedSuppression:*
|
||||
preprocessorErrorDirective:*
|
||||
unknownMacro:*
|
||||
uselessAssignmentPtrArg:libltdl/loaders/preopen.c:201
|
||||
deallocret:libltdl/lt__alloc.c:78
|
||||
|
|
|
|||
Loading…
Reference in a new issue