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)"
--- /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/.
+
+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.")