]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Add test 14822/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 5 Nov 2024 14:31:07 +0000 (15:31 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 5 Nov 2024 14:31:07 +0000 (15:31 +0100)
pdns/recursordist/test-syncres_cc1.cc

index 86278fbe642e5153b6a61ceaeb6fe0a328fea6d5..d51953fd2ff71d637122aaaa12710e2f4f120e06 100644 (file)
@@ -1772,17 +1772,26 @@ BOOST_AUTO_TEST_CASE(test_cname_length)
   BOOST_CHECK_EQUAL(ret.size(), length);
   BOOST_CHECK_EQUAL(length, SyncRes::s_max_CNAMES_followed + 1);
 
-  // Currently a CNAME bounds check originating from the record cache causes an ImmediateServFail
-  // exception. This is different from the non-cached case, tested above. There a ServFail is
-  // returned with a partial CNAME chain. This should be fixed one way or another. For details, see
-  // how the result of syncres.cc:scanForCNAMELoop() is handled in the two cases.
+  // The CNAME bounds check originating from the record cache causes an ImmediateServFail
+  // exception. This is different from the non-cached case, tested above.
   ret.clear();
-  length = 0;
   BOOST_CHECK_EXCEPTION(sr->beginResolve(target, QType(QType::A), QClass::IN, ret),
                         ImmediateServFailException,
                         [&](const ImmediateServFailException& isfe) {
                           return isfe.reason == "max number of CNAMEs exceeded";
                         });
+  BOOST_CHECK_EQUAL(ret.size(), SyncRes::s_max_CNAMES_followed + 1);
+
+  // Again, now with QName Minimization on, originally this would fail as the result was collected
+  // in a temp vector and the throw would skip the copy of the temp vector into the end result
+  sr->setQNameMinimization();
+  ret.clear();
+  BOOST_CHECK_EXCEPTION(sr->beginResolve(target, QType(QType::A), QClass::IN, ret),
+                        ImmediateServFailException,
+                        [&](const ImmediateServFailException& isfe) {
+                          return isfe.reason == "max number of CNAMEs exceeded";
+                        });
+  BOOST_CHECK_EQUAL(ret.size(), SyncRes::s_max_CNAMES_followed + 1);
 }
 
 BOOST_AUTO_TEST_CASE(test_cname_target_servfail)