|
@@ -1255,6 +1255,24 @@ struct InMemoryZoneFinder::InMemoryZoneFinderImpl {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // A helper function for the NXRRSET case in find(). If the zone is
|
|
|
+ // NSEC-signed and DNSSEC records are requested, try to find NSEC
|
|
|
+ // on the given node, and return it if found; return NULL for all other
|
|
|
+ // cases.
|
|
|
+ ConstRBNodeRRsetPtr getNSECForNXRRSET(FindOptions options,
|
|
|
+ const DomainNode& node) const
|
|
|
+ {
|
|
|
+ if (zone_data_->nsec_signed_ &&
|
|
|
+ (options & ZoneFinder::FIND_DNSSEC) != 0) {
|
|
|
+ const Domain::const_iterator found =
|
|
|
+ node.getData()->find(RRType::NSEC());
|
|
|
+ if (found != node.getData()->end()) {
|
|
|
+ return (found->second);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return (ConstRBNodeRRsetPtr());
|
|
|
+ }
|
|
|
+
|
|
|
// Set up FindContext object as a return value of find(), taking into
|
|
|
// account wildcard matches and DNSSEC information. We set the NSEC/NSEC3
|
|
|
// flag when applicable regardless of the find option; the caller would
|
|
@@ -1367,23 +1385,9 @@ struct InMemoryZoneFinder::InMemoryZoneFinderImpl {
|
|
|
rename));
|
|
|
}
|
|
|
}
|
|
|
- // No exact match or CNAME. This is NXRRSET case. If with DNSSEC query,
|
|
|
- // get the NSEC RRset, returns with result code NXRRSET.
|
|
|
- if (zone_data_->nsec_signed_ && (options & ZoneFinder::FIND_DNSSEC) != 0) {
|
|
|
- found = node->getData()->find(RRType::NSEC());
|
|
|
- if (found != node->getData()->end()) {
|
|
|
- LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_MEM_NXRRSET).arg(type).
|
|
|
- arg(name);
|
|
|
- return (createFindResult(NXRRSET,
|
|
|
- prepareRRset(name, found->second,
|
|
|
- rename, options),
|
|
|
- rename));
|
|
|
- }
|
|
|
- }
|
|
|
- // No exact match or CNAME. Return NXRRSET.
|
|
|
- LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_MEM_NXRRSET).arg(type).
|
|
|
- arg(name);
|
|
|
- return (createFindResult(NXRRSET, ConstRBNodeRRsetPtr(), rename));
|
|
|
+ // No exact match or CNAME. Get NSEC if necessary and return NXRRSET.
|
|
|
+ return (createFindResult(NXRRSET, getNSECForNXRRSET(options, *node),
|
|
|
+ rename));
|
|
|
}
|
|
|
};
|
|
|
|