Commit d619eab6 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[trac553] Cancel wildcard on existing subdomain

parent 6fbb0f72
......@@ -434,6 +434,33 @@ struct MemoryZone::MemoryZoneImpl {
* is known to exist).
if (node->getFlag(DOMAINFLAG_WILD)) {
/* Should we cancel this match?
* If we compare with some node and get a common ancestor,
* it might mean we are comparing with a non-wildcard node.
* In that case, we check which part is common. If we have
* something in common that lives below the node we got
* (the one above *), then we should cancel the match
* according to section 4.3.3 of RFC 1034 (as the name
* between the wildcard domain and the query name is known
* to exist).
* Because the way the tree stores relative names, we will
* have exactly one common label (the ".") in case we have
* nothing common under the node we got and we will get
* more common labels otherwise (yes, this relies on the
* internal RBTree structure, which leaks out trough this
* little bit).
* If the empty non-terminal node actually exists in the
* tree, then this cancellation is not needed, because we
* will not get here at all.
if (node_path.getLastComparisonResult().getRelation() ==
NameComparisonResult::COMMONANCESTOR && node_path.
getLastComparisonResult().getCommonLabels() > 1) {
return (FindResult(NXDOMAIN, ConstRRsetPtr()));
Name wildcard(Name("*").concatenate(
DomainTree::Result result(domains_.find(wildcard, &node));
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment