mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 22:15:20 +00:00
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).
This commit is contained in:
@@ -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);
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user