]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Look for named plugins in ${libdir}/named
authorMichał Kępień <michal@isc.org>
Tue, 12 Feb 2019 14:59:54 +0000 (15:59 +0100)
committerEvan Hunt <each@isc.org>
Wed, 6 Mar 2019 00:52:49 +0000 (16:52 -0800)
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).

(cherry picked from commit 1a9fc624ca4cfc1279e6df6d39f74603de7f374a)

bin/named/server.c
lib/bind9/check.c

index 435be1ee0c01ac34b8765cd7787c3edf46dfa53d..48c5aab8b987be581869fad16be29925c32c3f30 100644 (file)
@@ -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);
index 6f5f7684849590c6a30c7592dfbebebcd42386e2..215e767de0add939b2ef8ffe8cfd564c712971fb 100644 (file)
@@ -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;
        }