]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Test that a long CNAME chain causes SERVFAIL
authorAram Sargsyan <aram@isc.org>
Thu, 6 Jun 2024 12:10:19 +0000 (12:10 +0000)
committerAram Sargsyan <aram@isc.org>
Wed, 31 Jul 2024 15:14:43 +0000 (15:14 +0000)
Also check that the expected partial answer in returned too.

(cherry picked from commit 580f872fe13a85b71c5f2483aa297445759583c2)

bin/tests/system/resolver/ans3/ans.pl
bin/tests/system/resolver/tests.sh

index 893c9ed8d5908f6043295a58c617058d097ab9a5..880848e9c293123bb403645540e7bd66d6add4a3 100644 (file)
@@ -102,6 +102,9 @@ sub handleQuery {
                $packet->push("answer",
                              new Net::DNS::RR($qname .
                                       " 300 CNAME goodcname.example.org"));
+       } elsif ($qname =~ /^longcname/) {
+               $cname = $qname =~ s/longcname/longcnamex/r;
+               $packet->push("answer", new Net::DNS::RR($qname . " 300 CNAME " . $cname));
        } elsif ($qname =~ /^nodata\.example\.net$/i) {
                $packet->header->aa(1);
        } elsif ($qname =~ /^nxdomain\.example\.net$/i) {
index 0296ad6413c6fa08395cab36323c234139d6edfc..83e0ed404c31413adca31abd5e6212e6db86959a 100755 (executable)
@@ -222,6 +222,17 @@ if [ -x "${RESOLVE}" ]; then
   status=$((status + ret))
 fi
 
+n=$((n + 1))
+echo_i "checking long CNAME chain target filtering (deny) ($n)"
+ret=0
+dig_with_opts +tcp longcname1.example.net @10.53.0.1 a >dig.out.ns1.test${n} || ret=1
+grep -F "status: SERVFAIL" dig.out.ns1.test${n} >/dev/null || ret=1
+grep -F "max. restarts reached" dig.out.ns1.test${n} >/dev/null || ret=1
+lines=$(grep -F "CNAME" dig.out.ns1.test${n} | wc -l)
+test ${lines:-1} -eq 17 || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status + ret))
+
 n=$((n + 1))
 echo_i "checking DNAME target filtering (deny) ($n)"
 ret=0