mirror of
https://github.com/coredns/coredns.git
synced 2026-07-10 09:40:12 -04:00
plugin/file: return SOA in authority for negative CNAME target answers (#8226)
This commit is contained in:
@@ -315,6 +315,16 @@ func (a Apex) ns(do bool) []dns.RR {
|
||||
return a.NS
|
||||
}
|
||||
|
||||
// authority returns the records for the authority section of a response with
|
||||
// the given result: the SOA for negative answers (NXDOMAIN/NODATA), as
|
||||
// required by RFC 2308, and the NS records otherwise.
|
||||
func (z *Zone) authority(do bool, result Result) []dns.RR {
|
||||
if result == NameError || result == NoData {
|
||||
return z.soa(do)
|
||||
}
|
||||
return z.ns(do)
|
||||
}
|
||||
|
||||
// externalLookup adds signatures and tries to resolve CNAMEs that point to external names.
|
||||
func (z *Zone) externalLookup(ctx context.Context, state request.Request, elem *tree.Elem, rrs []dns.RR) ([]dns.RR, []dns.RR, []dns.RR, Result) {
|
||||
qtype := state.QType()
|
||||
@@ -331,7 +341,7 @@ func (z *Zone) externalLookup(ctx context.Context, state request.Request, elem *
|
||||
if elem == nil || (qtype == dns.TypeNS || qtype == dns.TypeSOA && targetName == z.origin) {
|
||||
lookupRRs, result := z.doLookup(ctx, state, targetName, qtype)
|
||||
rrs = append(rrs, lookupRRs...)
|
||||
return rrs, z.ns(do), nil, result
|
||||
return rrs, z.authority(do, result), nil, result
|
||||
}
|
||||
|
||||
i := 0
|
||||
@@ -351,7 +361,7 @@ Redo:
|
||||
if elem == nil || (qtype == dns.TypeNS || qtype == dns.TypeSOA && targetName == z.origin) {
|
||||
lookupRRs, result := z.doLookup(ctx, state, targetName, qtype)
|
||||
rrs = append(rrs, lookupRRs...)
|
||||
return rrs, z.ns(do), nil, result
|
||||
return rrs, z.authority(do, result), nil, result
|
||||
}
|
||||
|
||||
i++
|
||||
|
||||
Reference in New Issue
Block a user