--- /dev/null
+view foo {
+ plugin query "driver/.libs/test-syncplugin.so";
+};
+plugin query "driver/.libs/test-syncplugin.so";
--- /dev/null
+plugin query "driver/.libs/test-syncplugin.so";
--- /dev/null
+view foo {
+ plugin query "driver/.libs/test-syncplugin.so";
+};
--- /dev/null
+view someview {
+ zone "foo.bar" {
+ plugin query "driver/.libs/test-syncplugin.so";
+ type primary;
+ file "foo.bar.db";
+ };
+ plugin query "driver/.libs/test-syncplugin.so";
+};
--- /dev/null
+zone "foo.bar" {
+ plugin query "driver/.libs/test-syncplugin.so";
+ type primary;
+ file "foo.bar.db";
+};
--- /dev/null
+/*
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+ *
+ * SPDX-License-Identifier: MPL-2.0
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, you can obtain one at https://mozilla.org/MPL/2.0/.
+ *
+ * See the COPYRIGHT file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+#include <isccfg/aclconf.h>
+#include <isccfg/cfg.h>
+#include <isccfg/grammar.h>
+
+#include <ns/hooks.h>
+
+static ns_hookresult_t
+syncplugin_hook(void *arg, void *cbdata, isc_result_t *resp) {
+ UNUSED(arg);
+ UNUSED(cbdata);
+ UNUSED(resp);
+
+ return NS_HOOK_CONTINUE;
+}
+
+isc_result_t
+plugin_register(const char *parameters, const void *cfg, const char *cfgfile,
+ unsigned long cfgline, isc_mem_t *mctx, void *actx,
+ ns_hooktable_t *hooktable, void **instp) {
+ ns_hook_t hook;
+
+ UNUSED(parameters);
+ UNUSED(cfg);
+ UNUSED(cfgfile);
+ UNUSED(cfgline);
+ UNUSED(mctx);
+ UNUSED(actx);
+ UNUSED(hooktable);
+ UNUSED(instp);
+
+ hook = (ns_hook_t){ .action = syncplugin_hook,
+ .action_data = NULL };
+ ns_hook_add(hooktable, mctx, NS_QUERY_NODATA_BEGIN, &hook);
+
+ return ISC_R_SUCCESS;
+}
+
+isc_result_t
+plugin_check(const char *parameters, const void *cfg, const char *cfgfile,
+ unsigned long cfgline, isc_mem_t *mctx, void *actx) {
+ UNUSED(parameters);
+ UNUSED(cfg);
+ UNUSED(cfgfile);
+ UNUSED(cfgline);
+ UNUSED(mctx);
+ UNUSED(actx);
+
+ return ISC_R_SUCCESS;
+}
+
+void
+plugin_destroy(void **instp) {
+ UNUSED(instp);
+}
+
+int
+plugin_version(void) {
+ return NS_PLUGIN_VERSION;
+}
--- /dev/null
+#!/bin/sh
+
+# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+#
+# SPDX-License-Identifier: MPL-2.0
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, you can obtain one at https://mozilla.org/MPL/2.0/.
+#
+# See the COPYRIGHT file distributed with this work for additional
+# information regarding copyright ownership.
+
+set -e
+
+. ../conf.sh
+
+status=0
+n=0
+
+for conf in conf/good*.conf; do
+ n=$((n + 1))
+ echo_i "checking that $conf is accepted ($n)"
+ ret=0
+ $CHECKCONF "$conf" || ret=1
+ if [ $ret != 0 ]; then echo_i "failed"; fi
+ status=$((status + ret))
+done
+
+for conf in conf/bad*.conf; do
+ n=$((n + 1))
+ echo_i "checking that $conf is rejected ($n)"
+ ret=0
+ $CHECKCONF "$conf" >/dev/null && ret=1
+ if [ $ret != 0 ]; then echo_i "failed"; fi
+ status=$((status + ret))
+done
+
+echo_i "exit status: $status"
+[ $status -eq 0 ] || exit 1
ns1.rndc("reload")
watcher.wait_for_line("all zones loaded")
test_hooks()
+
+
+def test_plugins_config(run_tests_sh):
+ run_tests_sh()
system_test_libraries += {
'driver-async': files('hooks' / 'driver' / 'test-async.c'),
+ 'driver-syncplugin': files('hooks' / 'driver' / 'test-syncplugin.c'),
'driver-dlzexternal': files('dlzexternal' / 'driver' / 'driver.c'),
'driver-sample': files(
'dyndb' / 'driver' / 'db.c',
dependencies: [
libdns_dep,
libisc_dep,
+ libisccfg_dep,
libns_dep,
],
)