]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Convert some chain shell-based system tests in python
authorColin Vidal <colin@isc.org>
Wed, 1 Jul 2026 08:59:01 +0000 (10:59 +0200)
committerMichał Kępień <michal@isc.org>
Fri, 10 Jul 2026 07:26:46 +0000 (09:26 +0200)
Rewriting a couple of shell-based chain system test into python. Those
tests exercise the dname resolution of either an authoritative or
resolver without extra queries (it is self resolver either because the
target is in an authoritative zone or in the same authoritative answer).

Also add an extra test checking the same mechanism, this time, from the
resolver cache (no resolver involed).

Those highlight the fact that `query_dname()` can be called in situation
where the query type is DNAME, and even though, it needs to be resolved.

bin/tests/system/chain/tests.sh
bin/tests/system/chain/tests_chain.py [new file with mode: 0644]

index 876b80698bb3fd70745f82e043a08b128e90f529..e19052ad11197da6ad31731ec1c9f84b49c1f005 100644 (file)
@@ -623,24 +623,6 @@ grep 'status: NOERROR' dig.out.7.$n >/dev/null 2>&1 || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status + ret))
 
-# Regression test for CVE-2021-25215 (authoritative server).
-n=$((n + 1))
-echo_i "checking DNAME resolution via itself (authoritative) ($n)"
-ret=0
-$DIG $DIGOPTS @10.53.0.2 DNAME self.domain0.self.domain0.nil. >dig.out.2.$n 2>&1
-grep 'status: NOERROR' dig.out.2.$n >/dev/null 2>&1 || ret=1
-if [ $ret != 0 ]; then echo_i "failed"; fi
-status=$((status + ret))
-
-# Regression test for CVE-2021-25215 (recursive resolver).
-n=$((n + 1))
-echo_i "checking DNAME resolution via itself (recursive) ($n)"
-ret=0
-$DIG $DIGOPTS @10.53.0.7 DNAME self.example.self.example.dname. >dig.out.7.$n 2>&1
-grep 'status: NOERROR' dig.out.7.$n >/dev/null 2>&1 || ret=1
-if [ $ret != 0 ]; then echo_i "failed"; fi
-status=$((status + ret))
-
 # Regression test for GL #4652
 n=$((n + 1))
 echo_i "checking handling of illegal NS below DNAME ($n)"
diff --git a/bin/tests/system/chain/tests_chain.py b/bin/tests/system/chain/tests_chain.py
new file mode 100644 (file)
index 0000000..25da50a
--- /dev/null
@@ -0,0 +1,28 @@
+# 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/.
+
+import isctest
+
+
+def query(ns, name):
+    msg = isctest.query.create(name, "DNAME")
+    res = isctest.query.udp(msg, ns.ip)
+    isctest.check.noerror(res)
+    isctest.check.has_answer(res)
+
+
+# Regression test for CVE-2021-25215.
+def test_chain_dname_self_resolution(ns2, ns7):
+    # Checking DNAME resolution via itself (authoritative).
+    query(ns2, "self.domain0.self.domain0.nil.")
+
+    # Checking DNAME resolution via itself (recursive).
+    query(ns7, "self.example.self.example.dname.")
+
+    # Checking DNAME resolution via itself (resolver cache).
+    query(ns7, "self.example.self.example.dname.")