aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2020-07-31 10:58:09 +0200
committerGravatar GitHub <noreply@github.com> 2020-07-31 10:58:09 +0200
commit975305732e72246890a10fb2cddf0d2ce32c916c (patch)
tree1d11e4bdd5ca056ea290d2b95f2d8bc37e5ec098 /plugin
parentf23171af5f3f6432c249e26265ec6540f6c1b46b (diff)
downloadcoredns-975305732e72246890a10fb2cddf0d2ce32c916c.tar.gz
coredns-975305732e72246890a10fb2cddf0d2ce32c916c.tar.zst
coredns-975305732e72246890a10fb2cddf0d2ce32c916c.zip
backend: fix root zone usage (#4039)
properly concatenate labels by using dnsutil.Join instead of '+' Fixes: #3316 Signed-off-by: Miek Gieben <miek@miek.nl>
Diffstat (limited to 'plugin')
-rw-r--r--plugin/backend_lookup.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/plugin/backend_lookup.go b/plugin/backend_lookup.go
index 9d7e366a3..5e08efb78 100644
--- a/plugin/backend_lookup.go
+++ b/plugin/backend_lookup.go
@@ -422,7 +422,7 @@ func NS(ctx context.Context, b ServiceBackend, zone string, state request.Reques
old := state.QName()
state.Clear()
- state.Req.Question[0].Name = "ns.dns." + zone
+ state.Req.Question[0].Name = dnsutil.Join("ns.dns.", zone)
services, err := b.Services(ctx, state, false, opt)
if err != nil {
return nil, nil, err
@@ -462,12 +462,8 @@ func SOA(ctx context.Context, b ServiceBackend, zone string, state request.Reque
header := dns.RR_Header{Name: zone, Rrtype: dns.TypeSOA, Ttl: ttl, Class: dns.ClassINET}
- Mbox := hostmaster + "."
- Ns := "ns.dns."
- if zone[0] != '.' {
- Mbox += zone
- Ns += zone
- }
+ Mbox := dnsutil.Join(hostmaster, zone)
+ Ns := dnsutil.Join("ns.dns", zone)
soa := &dns.SOA{Hdr: header,
Mbox: Mbox,