[9.20] fix: dev: check plugin config before registering

In `named_config_parsefile()`, when checking the validity of
`named.conf`, the checking of plugin correctness was deliberately
postponed until the plugin is loaded and registered. However,
the checking was never actually done: the `plugin_register()`
implementation was called, but `plugin_check()` was not.

`ns_plugin_register()` (used by `named`) now calls the check function
before the register function, and aborts if either one fails.
`ns_plugin_check()` (used by `named-checkconf`) calls only
the check function.

Backport of MR !11031

Merge branch 'backport-each-check-plugin-named-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!11032
This commit is contained in:
Colin Vidal 2025-10-01 11:55:48 +02:00
commit e2260b8070

View file

@ -224,6 +224,9 @@ ns_plugin_register(const char *modpath, const char *parameters, const void *cfg,
isc_log_write(ns_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_HOOKS,
ISC_LOG_INFO, "registering plugin '%s'", modpath);
CHECK(plugin->check_func(parameters, cfg, cfg_file, cfg_line, mctx,
lctx, actx));
CHECK(plugin->register_func(parameters, cfg, cfg_file, cfg_line, mctx,
lctx, actx, view->hooktable,
&plugin->inst));