mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-31 22:15:23 +00:00
[2504] Fix getClosestNSEC() when tree.find() results in SUBDOMAIN
When tree.find() results in SUBDOMAIN, the node_path's top contains the previous node. Calling previousNode() yet again will return its further previous node.
This commit is contained in:
@@ -305,8 +305,16 @@ getClosestNSEC(const ZoneData& zone_data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ZoneNode* prev_node;
|
const ZoneNode* prev_node;
|
||||||
while ((prev_node = zone_data.getZoneTree().previousNode(node_path))
|
if (node_path.getLastComparisonResult().getRelation() ==
|
||||||
!= NULL) {
|
NameComparisonResult::SUBDOMAIN) {
|
||||||
|
// In case the search ended as a sub-domain, the previous node
|
||||||
|
// is already at the top of node_path.
|
||||||
|
prev_node = node_path.getLastComparedNode();
|
||||||
|
} else {
|
||||||
|
prev_node = zone_data.getZoneTree().previousNode(node_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (prev_node != NULL) {
|
||||||
if (!prev_node->isEmpty()) {
|
if (!prev_node->isEmpty()) {
|
||||||
const RdataSet* found =
|
const RdataSet* found =
|
||||||
RdataSet::find(prev_node->getData(), RRType::NSEC());
|
RdataSet::find(prev_node->getData(), RRType::NSEC());
|
||||||
@@ -314,6 +322,7 @@ getClosestNSEC(const ZoneData& zone_data,
|
|||||||
return (ConstNodeRRset(prev_node, found));
|
return (ConstNodeRRset(prev_node, found));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
prev_node = zone_data.getZoneTree().previousNode(node_path);
|
||||||
}
|
}
|
||||||
// This must be impossible and should be an internal bug.
|
// This must be impossible and should be an internal bug.
|
||||||
// See the description at the method declaration.
|
// See the description at the method declaration.
|
||||||
|
Reference in New Issue
Block a user