Revert "plugin/file: Fix in wrong answers returned when wildcard and concrete records exist (#4599)" (#4633)

reverting as I don't want to release 1.8.4 with this enabled.

This reverts commit fbf3f07f46.
This commit is contained in:
Miek Gieben
2021-05-20 22:25:18 +02:00
committed by GitHub
parent 0348b019be
commit 163ac033ae
3 changed files with 6 additions and 110 deletions

View File

@@ -56,10 +56,10 @@ func (z *Zone) Lookup(ctx context.Context, state request.Request, qname string)
}
var (
found, shot bool
parts string
i, maxLabelNum int
elem, wildElem, nextElem *tree.Elem
found, shot bool
parts string
i int
elem, wildElem *tree.Elem
)
loop, _ := ctx.Value(dnsserver.LoopKey{}).(int)
@@ -92,12 +92,6 @@ func (z *Zone) Lookup(ctx context.Context, state request.Request, qname string)
break
}
if nextElem, found = tr.Next(parts); found {
if dns.IsSubDomain(parts, nextElem.Name()) {
maxLabelNum = z.origLen + i
}
}
elem, found = tr.Search(parts)
if !found {
// Apex will always be found, when we are here we can search for a wildcard
@@ -207,18 +201,8 @@ func (z *Zone) Lookup(ctx context.Context, state request.Request, qname string)
// Found wildcard.
if wildElem != nil {
// if the domain's longest matching parent domain is subdomain of the wildcard,
// in other words, the domains max number of labels matched is >= number of labels of the wildcard
if maxLabelNum >= dns.CountLabel(wildElem.Name()) {
ret := ap.soa(do)
if do {
nsec := typeFromElem(wildElem, dns.TypeNSEC, do)
ret = append(ret, nsec...)
}
return nil, ret, nil, NameError
}
auth := ap.ns(do)
if rrs := wildElem.TypeForWildcard(dns.TypeCNAME, qname); len(rrs) > 0 {
ctx = context.WithValue(ctx, dnsserver.LoopKey{}, loop+1)
return z.externalLookup(ctx, state, wildElem, rrs)