fix(auto/file): return REFUSED when no next plugin is available (#7381)

This commit is contained in:
Cameron Steel
2025-07-04 19:39:19 +10:00
committed by GitHub
parent 1449cb660e
commit 0aee758833
4 changed files with 50 additions and 33 deletions

View File

@@ -51,6 +51,10 @@ func (a Auto) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (i
// Now the real zone.
zone = plugin.Zones(a.Zones.Names()).Matches(qname)
if zone == "" {
// If no next plugin is configured, it's more correct to return REFUSED as auto acts as an authoritative server
if a.Next == nil {
return dns.RcodeRefused, nil
}
return plugin.NextOrFailure(a.Name(), a.Next, ctx, w, r)
}