mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 08:14:18 -04:00
Validate zone during normalization (#3165)
This commit is contained in:
committed by
Yong Tang
parent
27f44f60ee
commit
f888c5f7f6
@@ -3,6 +3,7 @@ package dnsserver
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/coredns/coredns/plugin"
|
||||
@@ -52,7 +53,13 @@ func normalizeZone(str string) (zoneAddr, error) {
|
||||
}
|
||||
}
|
||||
|
||||
return zoneAddr{Zone: dns.Fqdn(host), Port: port, Transport: trans, IPNet: ipnet}, nil
|
||||
z := zoneAddr{Zone: dns.Fqdn(host), Port: port, Transport: trans, IPNet: ipnet}
|
||||
_, err = url.ParseRequestURI(z.String())
|
||||
if err != nil {
|
||||
return zoneAddr{}, err
|
||||
}
|
||||
|
||||
return z, nil
|
||||
}
|
||||
|
||||
// SplitProtocolHostPort splits a full formed address like "dns://[::1]:53" into parts.
|
||||
|
||||
Reference in New Issue
Block a user