int res = sr->beginResolve(target, QType(QType::A), QClass::IN, ret);
BOOST_CHECK_EQUAL(res, RCode::NoError);
BOOST_CHECK_EQUAL(sr->getValidationState(), vState::BogusNoValidRRSIG);
- BOOST_REQUIRE_EQUAL(ret.size(), 4U);
+ BOOST_REQUIRE_EQUAL(ret.size(), 2U);
BOOST_CHECK_EQUAL(queriesCount, 7U);
/* make sure that the bogus wildcard entry has not been cached! */
return false;
}
+static bool isRRSIGLabelCountValid(const RRSIGRecordContent& sign)
+{
+ const auto signerLabelCount = sign.d_signer.countLabels();
+ return sign.d_labels >= signerLabelCount;
+}
+
/* RFC 4035 section-5.3.4:
"If the number of labels in an RRset's owner name is greater than the
Labels field of the covering RRSIG RR, then the RRset and its
*/
bool isWildcardExpanded(unsigned int labelCount, const RRSIGRecordContent& sign)
{
- return sign.d_labels < labelCount;
+ return sign.d_labels < labelCount && isRRSIGLabelCountValid(sign);
}
static bool isWildcardExpanded(const DNSName& owner, const std::vector<std::shared_ptr<const RRSIGRecordContent>>& signatures)
bool isWildcardExpandedOntoItself(const DNSName& owner, unsigned int labelCount, const RRSIGRecordContent& sign)
{
/* this is a wildcard alright, but it has not been expanded */
- return owner.isWildcard() && (labelCount - 1) == sign.d_labels;
+ return owner.isWildcard() && (labelCount - 1) == sign.d_labels && isRRSIGLabelCountValid(sign);
}
static bool isWildcardExpandedOntoItself(const DNSName& owner, const std::vector<std::shared_ptr<const RRSIGRecordContent>>& signatures)
const auto& sign = signatures.at(0);
unsigned int labelsCount = initialOwner.countLabels();
- if (sign && sign->d_labels < labelsCount) {
+ if (sign && sign->d_labels < labelsCount && isRRSIGLabelCountValid(*sign)) {
do {
result.chopOff();
labelsCount--;
VLOG(log, name << ": Discarding invalid RRSIG whose label count is " << signature->d_labels << " while the RRset owner name has only " << labelCount << endl);
continue;
}
- const auto signerLabelsCount = signature->d_signer.countLabels();
- if (signature->d_labels < signerLabelsCount) {
- VLOG(log, name << ": Discarding invalid RRSIG whose label count is " << signature->d_labels << " while the signer has only " << signerLabelsCount << endl);
+ if (!isRRSIGLabelCountValid(*signature)) {
+ VLOG(log, name << ": Discarding invalid RRSIG whose label count is " << signature->d_labels << " while the signer has only " << signature->d_signer.countLabels() << endl);
continue;
}
allDiscarded = false;