mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-02-25 16:13:04 +08:00
BIND: Bug: DefaultNS strips last char (#1411)
* BIND: Bug: DefaultNS strips last char * fixup!
This commit is contained in:
parent
886dbf6d00
commit
40bc39533f
1 changed files with 11 additions and 2 deletions
|
@ -69,8 +69,17 @@ func initBind(config map[string]string, providermeta json.RawMessage) (providers
|
|||
}
|
||||
}
|
||||
var nss []string
|
||||
for _, ns := range api.DefaultNS {
|
||||
nss = append(nss, ns[0:len(ns)-1])
|
||||
for i, ns := range api.DefaultNS {
|
||||
if ns == "" {
|
||||
return nil, fmt.Errorf("empty string in default_ns[%d]", i)
|
||||
}
|
||||
// If it contains a ".", it must end in a ".".
|
||||
if strings.ContainsRune(ns, '.') && ns[len(ns)-1] != '.' {
|
||||
return nil, fmt.Errorf("default_ns (%v) must end with a (.) [https://stackexchange.github.io/dnscontrol/why-the-dot]", ns)
|
||||
}
|
||||
// This is one of the (increasingly rare) cases where we store a
|
||||
// name without the trailing dot to indicate a FQDN.
|
||||
nss = append(nss, strings.TrimSuffix(ns, "."))
|
||||
}
|
||||
var err error
|
||||
api.nameservers, err = models.ToNameservers(nss)
|
||||
|
|
Loading…
Reference in a new issue