From: Michał Kępień Date: Tue, 12 Feb 2019 14:59:54 +0000 (+0100) Subject: Look for named plugins in ${libdir}/named X-Git-Tag: v9.15.0~123^2~2 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=1a9fc624ca4cfc1279e6df6d39f74603de7f374a;p=thirdparty%2Fbind9.git Look for named plugins in ${libdir}/named When the "library" part of a "plugin" configuration stanza does not contain at least one path separator, treat it as a filename and assume it is a name of a shared object present in the named plugin installation directory. Absolute and relative paths can still be used and will be used verbatim. Get the full path to a plugin before attempting to check/register it so that all relevant log messages include the same plugin path (apart from the one logged when the full path cannot be determined). --- diff --git a/bin/named/server.c b/bin/named/server.c index 435be1ee0c0..48c5aab8b98 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -3655,9 +3655,21 @@ register_one_plugin(const cfg_obj_t *config, const cfg_obj_t *obj, void *callback_data) { dns_view_t *view = callback_data; + char full_path[PATH_MAX]; isc_result_t result; - result = ns_plugin_register(plugin_path, parameters, config, + result = ns_plugin_expandpath(plugin_path, + full_path, sizeof(full_path)); + if (result != ISC_R_SUCCESS) { + isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, + NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR, + "%s: plugin configuration failed: " + "unable to get full plugin path: %s", + plugin_path, isc_result_totext(result)); + return (result); + } + + result = ns_plugin_register(full_path, parameters, config, cfg_obj_file(obj), cfg_obj_line(obj), named_g_mctx, named_g_lctx, named_g_aclconfctx, view); @@ -3665,7 +3677,7 @@ register_one_plugin(const cfg_obj_t *config, const cfg_obj_t *obj, isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR, "%s: plugin configuration failed: %s", - plugin_path, isc_result_totext(result)); + full_path, isc_result_totext(result)); } return (result); diff --git a/lib/bind9/check.c b/lib/bind9/check.c index 6f5f7684849..215e767de0a 100644 --- a/lib/bind9/check.c +++ b/lib/bind9/check.c @@ -3409,15 +3409,26 @@ check_one_plugin(const cfg_obj_t *config, const cfg_obj_t *obj, void *callback_data) { struct check_one_plugin_data *data = callback_data; + char full_path[PATH_MAX]; isc_result_t result; - result = ns_plugin_check(plugin_path, parameters, config, + result = ns_plugin_expandpath(plugin_path, + full_path, sizeof(full_path)); + if (result != ISC_R_SUCCESS) { + cfg_obj_log(obj, data->lctx, ISC_LOG_ERROR, + "%s: plugin check failed: " + "unable to get full plugin path: %s", + plugin_path, isc_result_totext(result)); + return (result); + } + + result = ns_plugin_check(full_path, parameters, config, cfg_obj_file(obj), cfg_obj_line(obj), data->mctx, data->lctx, data->actx); if (result != ISC_R_SUCCESS) { cfg_obj_log(obj, data->lctx, ISC_LOG_ERROR, "%s: plugin check failed: %s", - plugin_path, isc_result_totext(result)); + full_path, isc_result_totext(result)); *data->check_result = result; }