From: Otto Moerbeek Date: Tue, 5 Nov 2024 14:31:07 +0000 (+0100) Subject: Add test X-Git-Tag: rec-5.2.0-alpha1~4^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F14822%2Fhead;p=thirdparty%2Fpdns.git Add test --- diff --git a/pdns/recursordist/test-syncres_cc1.cc b/pdns/recursordist/test-syncres_cc1.cc index 86278fbe64..d51953fd2f 100644 --- a/pdns/recursordist/test-syncres_cc1.cc +++ b/pdns/recursordist/test-syncres_cc1.cc @@ -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)