mirror of
https://github.com/coredns/coredns.git
synced 2026-01-22 08:31:18 -05:00
fix: return SOA and NS records when queried for a record CNAMEd to origin (#7808)
* fix: return SOA and NS records when queried for a record CNAMEd to origin Signed-off-by: Shiv Tyagi <shivtyagi3015@gmail.com> * chore(test): add test for covering cname to origin scenario in file plugin Signed-off-by: Shiv Tyagi <shivtyagi3015@gmail.com> --------- Signed-off-by: Shiv Tyagi <shivtyagi3015@gmail.com>
This commit is contained in:
@@ -331,7 +331,7 @@ func (z *Zone) externalLookup(ctx context.Context, state request.Request, elem *
|
||||
|
||||
targetName := rrs[0].(*dns.CNAME).Target
|
||||
elem, _ = z.Search(targetName)
|
||||
if elem == nil {
|
||||
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
|
||||
@@ -351,7 +351,7 @@ Redo:
|
||||
}
|
||||
targetName := cname[0].(*dns.CNAME).Target
|
||||
elem, _ = z.Search(targetName)
|
||||
if elem == nil {
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user