Commit 1a9fc624 authored by Michał Kępień's avatar Michał Kępień Committed by Evan Hunt
Browse files

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).
parent d181c28c
...@@ -3655,9 +3655,21 @@ register_one_plugin(const cfg_obj_t *config, const cfg_obj_t *obj, ...@@ -3655,9 +3655,21 @@ register_one_plugin(const cfg_obj_t *config, const cfg_obj_t *obj,
void *callback_data) void *callback_data)
{ {
dns_view_t *view = callback_data; dns_view_t *view = callback_data;
char full_path[PATH_MAX];
isc_result_t result; 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), cfg_obj_file(obj), cfg_obj_line(obj),
named_g_mctx, named_g_lctx, named_g_mctx, named_g_lctx,
named_g_aclconfctx, view); named_g_aclconfctx, view);
...@@ -3665,7 +3677,7 @@ register_one_plugin(const cfg_obj_t *config, const cfg_obj_t *obj, ...@@ -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, isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR, NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"%s: plugin configuration failed: %s", "%s: plugin configuration failed: %s",
plugin_path, isc_result_totext(result)); full_path, isc_result_totext(result));
} }
return (result); return (result);
......
...@@ -3409,15 +3409,26 @@ check_one_plugin(const cfg_obj_t *config, const cfg_obj_t *obj, ...@@ -3409,15 +3409,26 @@ check_one_plugin(const cfg_obj_t *config, const cfg_obj_t *obj,
void *callback_data) void *callback_data)
{ {
struct check_one_plugin_data *data = callback_data; struct check_one_plugin_data *data = callback_data;
char full_path[PATH_MAX];
isc_result_t result; 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), cfg_obj_file(obj), cfg_obj_line(obj),
data->mctx, data->lctx, data->actx); data->mctx, data->lctx, data->actx);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
cfg_obj_log(obj, data->lctx, ISC_LOG_ERROR, cfg_obj_log(obj, data->lctx, ISC_LOG_ERROR,
"%s: plugin check failed: %s", "%s: plugin check failed: %s",
plugin_path, isc_result_totext(result)); full_path, isc_result_totext(result));
*data->check_result = result; *data->check_result = result;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment