diff options
Diffstat (limited to 'plugin/file/lookup.go')
-rw-r--r-- | plugin/file/lookup.go | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/plugin/file/lookup.go b/plugin/file/lookup.go index 7b17698a4..6eeb4c397 100644 --- a/plugin/file/lookup.go +++ b/plugin/file/lookup.go @@ -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 domainās 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) |