dnsrecords: targets of srv records cannot be ip address

It's required by rfc spec and followed also by other players.  coredns
itself will choke SERVFAIL when serv.Key == ""
This commit is contained in:
Yousong Zhou
2018-10-25 08:10:44 +00:00
parent 5bf68385df
commit f8098f0815
+4 -1
View File
@@ -84,7 +84,10 @@ func (man *SDnsRecordManager) ParseInputInfo(data *jsonutils.JSONDict) ([]string
host := parts[0]
if !regutils.MatchDomainName(host) &&
!regutils.MatchIPAddr(host) {
return "", httperrors.NewNotAcceptableError("SRV: invalid host part: %s", host)
return "", httperrors.NewNotAcceptableError("SRV: target is not valid domain: %s", host)
}
if regutils.MatchIPAddr(host) {
return "", httperrors.NewNotAcceptableError("SRV: target cannot be an IP address: %s", host)
}
port, err := strconv.Atoi(parts[1])
if err != nil || port <= 0 || port >= 65536 {