mirror of
https://github.com/coredns/coredns.git
synced 2026-10-19 00:35:42 -04:00
plugin/file: test that out-of-zone CNAME targets keep NOERROR (#8569)
This commit is contained in:
@@ -469,6 +469,9 @@ func delegationFromElem(tr *tree.Tree, elem *tree.Elem, qname string, qtype uint
|
||||
}
|
||||
|
||||
func (z *Zone) doLookup(ctx context.Context, state request.Request, target string, qtype uint16) ([]dns.RR, Result) {
|
||||
if z.Upstream == nil {
|
||||
return nil, ServerFailure
|
||||
}
|
||||
m, e := z.Upstream.Lookup(ctx, state, target, qtype)
|
||||
if e != nil {
|
||||
return nil, ServerFailure
|
||||
@@ -485,6 +488,9 @@ func (z *Zone) doLookup(ctx context.Context, state request.Request, target strin
|
||||
if m.Rcode == dns.RcodeSuccess && len(m.Answer) == 0 {
|
||||
return m.Answer, NoData
|
||||
}
|
||||
// Anything else, including the REFUSED returned for a target outside every
|
||||
// zone served here, keeps NOERROR: the CNAME is the answer and the resolver
|
||||
// chases the target itself. See #7346.
|
||||
return m.Answer, Success
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user