mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
format=js generates wrong DS() format (#2332)
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
This commit is contained in:
@ -328,6 +328,8 @@ func formatDsl(zonename string, rec *models.RecordConfig, defaultTTL uint32) str
|
|||||||
switch rec.Type { // #rtype_variations
|
switch rec.Type { // #rtype_variations
|
||||||
case "CAA":
|
case "CAA":
|
||||||
return makeCaa(rec, ttlop)
|
return makeCaa(rec, ttlop)
|
||||||
|
case "DS":
|
||||||
|
target = fmt.Sprintf("%d, %d, %d, '%s'", rec.DsKeyTag, rec.DsAlgorithm, rec.DsDigestType, rec.DsDigest)
|
||||||
case "MX":
|
case "MX":
|
||||||
target = fmt.Sprintf("%d, '%s'", rec.MxPreference, rec.GetTargetField())
|
target = fmt.Sprintf("%d, '%s'", rec.MxPreference, rec.GetTargetField())
|
||||||
case "NAPTR":
|
case "NAPTR":
|
||||||
|
@ -18,7 +18,7 @@ func TestFormatTypes(t *testing.T) {
|
|||||||
test_data/$DOMAIN.zone zone test_data/$DOMAIN.zone.zone
|
test_data/$DOMAIN.zone zone test_data/$DOMAIN.zone.zone
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for _, domain := range []string{"simple.com", "example.org", "apex.com"} {
|
for _, domain := range []string{"simple.com", "example.org", "apex.com", "ds.com"} {
|
||||||
t.Run(domain+"/js", func(t *testing.T) { testFormat(t, domain, "js") })
|
t.Run(domain+"/js", func(t *testing.T) { testFormat(t, domain, "js") })
|
||||||
t.Run(domain+"/djs", func(t *testing.T) { testFormat(t, domain, "djs") })
|
t.Run(domain+"/djs", func(t *testing.T) { testFormat(t, domain, "djs") })
|
||||||
t.Run(domain+"/tsv", func(t *testing.T) { testFormat(t, domain, "tsv") })
|
t.Run(domain+"/tsv", func(t *testing.T) { testFormat(t, domain, "tsv") })
|
||||||
|
4
commands/test_data/ds.com.zone
Normal file
4
commands/test_data/ds.com.zone
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
$ORIGIN ds.com.
|
||||||
|
$TTL 300
|
||||||
|
@ IN SOA ns3.serverfault.com. sysadmin.stackoverflow.com. 2020022300 3600 600 604800 1440
|
||||||
|
geo IN DS 14480 13 2 BB1C4B615CDED2B34347CF23710471934D972F1E34F53B54ED8D5F786202C73B
|
7
commands/test_data/ds.com.zone.djs
Normal file
7
commands/test_data/ds.com.zone.djs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
var DSP_BIND = NewDnsProvider("bind", "BIND");
|
||||||
|
var REG_CHANGEME = NewRegistrar("none");
|
||||||
|
D("ds.com", REG_CHANGEME
|
||||||
|
, DnsProvider(DSP_BIND)
|
||||||
|
//, SOA('@', 'ns3.serverfault.com.', 'sysadmin.stackoverflow.com.', 2020022300, 3600, 600, 604800, 1440)
|
||||||
|
, DS('geo', 14480, 13, 2, 'BB1C4B615CDED2B34347CF23710471934D972F1E34F53B54ED8D5F786202C73B')
|
||||||
|
)
|
7
commands/test_data/ds.com.zone.js
Normal file
7
commands/test_data/ds.com.zone.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
var DSP_BIND = NewDnsProvider("bind", "BIND");
|
||||||
|
var REG_CHANGEME = NewRegistrar("none");
|
||||||
|
D("ds.com", REG_CHANGEME,
|
||||||
|
DnsProvider(DSP_BIND),
|
||||||
|
//SOA('@', 'ns3.serverfault.com.', 'sysadmin.stackoverflow.com.', 2020022300, 3600, 600, 604800, 1440),
|
||||||
|
DS('geo', 14480, 13, 2, 'BB1C4B615CDED2B34347CF23710471934D972F1E34F53B54ED8D5F786202C73B')
|
||||||
|
)
|
2
commands/test_data/ds.com.zone.tsv
Normal file
2
commands/test_data/ds.com.zone.tsv
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
ds.com @ 300 IN SOA ns3.serverfault.com. sysadmin.stackoverflow.com. 2020022300 3600 600 604800 1440
|
||||||
|
geo.ds.com geo 300 IN DS 14480 13 2 BB1C4B615CDED2B34347CF23710471934D972F1E34F53B54ED8D5F786202C73B
|
|
5
commands/test_data/ds.com.zone.zone
Normal file
5
commands/test_data/ds.com.zone.zone
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
$ORIGIN ds.com.
|
||||||
|
$TTL 300
|
||||||
|
@ IN SOA ns3.serverfault.com. sysadmin.stackoverflow.com. 2020022300 3600 600 604800 1440
|
||||||
|
geo IN DS 14480 13 2 BB1C4B615CDED2B34347CF23710471934D972F1E34F53B54ED8D5F786202C73B
|
||||||
|
|
Reference in New Issue
Block a user