Fix #362: convertzone produces deprecated NAMESERVER entries (#363)

This commit is contained in:
Tom Limoncelli 2018-05-13 08:31:34 -04:00 committed by GitHub
parent 7085096468
commit e1af3034c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -186,9 +186,17 @@ func rrFormat(zonename string, filename string, recs []dns.RR, defaultTTL uint32
target = strings.Replace(target, " ", "\t", 1)
}
var ttlop string
if hdr.Ttl == defaultTTL {
ttlop = ""
} else {
ttlop = fmt.Sprintf(", TTL(%d)", hdr.Ttl)
}
// NS records at the apex should be NAMESERVER() records.
if hdr.Rrtype == dns.TypeNS && name == "@" {
typeStr = "NAMESERVER"
fmt.Printf(",\n\tNAMESERVER('%s'%s)", target, ttlop)
continue
}
if !dsl { // TSV format:
@ -209,12 +217,7 @@ func rrFormat(zonename string, filename string, recs []dns.RR, defaultTTL uint32
default:
target = "'" + target + "'"
}
if hdr.Ttl == defaultTTL {
ttl = ""
} else {
ttl = fmt.Sprintf(", TTL(%d)", hdr.Ttl)
}
fmt.Printf(",\n\t%s('%s', %s%s)", typeStr, name, target, ttl)
fmt.Printf(",\n\t%s('%s', %s%s)", typeStr, name, target, ttlop)
}
}