]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix crash in named-checkconf -n 12547/head
authorEvan Hunt <each@isc.org>
Tue, 11 Aug 2026 00:04:34 +0000 (17:04 -0700)
committerEvan Hunt <each@isc.org>
Tue, 11 Aug 2026 07:00:48 +0000 (07:00 +0000)
The "named-checkconf -n" option always triggered a crash due to
an incorrect REQUIRE. This has been fixed, and a regression test
added to the checkconf system test.

bin/check/named-checkconf.c
bin/check/named-checkconf.rst
bin/tests/system/checkconf/disabled.conf [new file with mode: 0644]
bin/tests/system/checkconf/tests.sh
lib/isccfg/parser.c

index a40a4b703c5467a52971fc368f7c9f3639f13c2c..ea38abcd6a4d11f2c0a5800c5bf0002c96150400 100644 (file)
@@ -51,7 +51,7 @@ usage(void);
 static void
 usage(void) {
        fprintf(stderr,
-               "usage: %s [-achijklvz] [-pe [-x]] [-b] [-t directory] "
+               "usage: %s [-achijklnvz] [-pe [-x]] [-b] [-t directory] "
                "[named.conf]\n",
                isc_commandline_progname);
        exit(EXIT_SUCCESS);
index fb267a13b4396aed36966adac03db2e291592934..8e65c85e419bc39d6cdcf5a4ee082204674b8ffc 100644 (file)
@@ -21,7 +21,7 @@ named-checkconf - named configuration file syntax checking tool
 Synopsis
 ~~~~~~~~
 
-:program:`named-checkconf` [**-achjklnvz**] [**-pe** [**-x** ]] [**-b**]
+:program:`named-checkconf` [**-achijklnvz**] [**-pe** [**-x** ]] [**-b**]
 [**-t** directory] {filename}
 
 Description
diff --git a/bin/tests/system/checkconf/disabled.conf b/bin/tests/system/checkconf/disabled.conf
new file mode 100644 (file)
index 0000000..04ce2e7
--- /dev/null
@@ -0,0 +1,4 @@
+options {
+       # depending on build options, this should require named-checkconf -n
+       dnstap-version none;
+};
index ff976d842b64d9bfb78e5c2361fe4d3f68066450..40e5802d911b1c2b2ee6c9c55cf967e429136c34 100644 (file)
@@ -175,11 +175,24 @@ grep "option 'max-zone-ttl' is deprecated" <checkconf.out$n.1 >/dev/null || ret=
 if [ $ret -ne 0 ]; then echo_i "failed"; fi
 status=$((status + ret))
 # set -i to ignore deprecate warnings
-$CHECKCONF -i deprecated.conf 2>&1 | grep_v "rrset-order: order 'fixed' was disabled at compilation time" >checkconf.out$n.2
+$CHECKCONF -i deprecated.conf >checkconf.out$n.2 2>&1
 grep '^.+$' <checkconf.out$n.2 >/dev/null && ret=1
 if [ $ret -ne 0 ]; then echo_i "failed"; fi
 status=$((status + ret))
 
+if ! $FEATURETEST --enable-dnstap; then
+  n=$((n + 1))
+  echo_i "checking named-checkconf disabled warnings ($n)"
+  ret=0
+  $CHECKCONF disabled.conf >checkconf.out$n.1 2>&1 && ret=1
+  grep "option 'dnstap-version' was not enabled at compile time" <checkconf.out$n.1 >/dev/null || ret=1
+fi
+# set -n to ignore disabled warnings
+$CHECKCONF -n disabled.conf >checkconf.out$n.2 2>&1
+[ -s checkconf.out$n.2 ] && ret=1
+if [ $ret -ne 0 ]; then echo_i "failed"; fi
+status=$((status + ret))
+
 n=$((n + 1))
 echo_i "checking named-checkconf servestale warnings ($n)"
 ret=0
index ca7e5f247146c1e5c0a5d62695753cae7f49235b..6cc2bbb0110d7ce66a839baee633b4d3a560296c 100644 (file)
@@ -799,7 +799,8 @@ cleanup:
 
 #define REQUIRE_PCTX_FLAGS(flags)                                        \
        REQUIRE((flags & ~(CFG_PCTX_NODEPRECATED | CFG_PCTX_NOOBSOLETE | \
-                          CFG_PCTX_NOEXPERIMENTAL | CFG_PCTX_BUILTIN)) == 0)
+                          CFG_PCTX_NOEXPERIMENTAL | CFG_PCTX_BUILTIN |  \
+                          CFG_PCTX_ALLCONFIGS)) == 0)
 
 isc_result_t
 cfg_parse_file(const char *filename, const cfg_type_t *type, unsigned int flags,