1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

DNSIMPLE: support NAPTR (#671)

Fix the model to strip quotes from all the string parts; BIND
integration tests still pass.  DNSIMPLE integration tests pass.
This commit is contained in:
Phil Pennock
2020-03-01 09:36:55 -05:00
committed by GitHub
parent 95dcce8b6f
commit ecac8f1c10
2 changed files with 11 additions and 1 deletions

View File

@@ -44,5 +44,5 @@ func (rc *RecordConfig) SetTargetNAPTRString(s string) error {
if len(part) != 6 {
return fmt.Errorf("NAPTR value does not contain 6 fields: (%#v)", s)
}
return rc.SetTargetNAPTRStrings(part[0], part[1], part[2], part[3], part[4], StripQuotes(part[5]))
return rc.SetTargetNAPTRStrings(part[0], part[1], StripQuotes(part[2]), StripQuotes(part[3]), StripQuotes(part[4]), StripQuotes(part[5]))
}

View File

@@ -19,6 +19,7 @@ import (
var features = providers.DocumentationNotes{
providers.CanUseAlias: providers.Can(),
providers.CanUseCAA: providers.Can(),
providers.CanUseNAPTR: providers.Can(),
providers.CanUsePTR: providers.Can(),
providers.CanUseSSHFP: providers.Can(),
providers.CanUseSRV: providers.Can(),
@@ -565,6 +566,12 @@ func getTargetRecordContent(rc *models.RecordConfig) string {
quoted[i] = quoteDNSString(rc.TxtStrings[i])
}
return strings.Join(quoted, " ")
case "NAPTR":
return fmt.Sprintf("%d %d %s %s %s %s",
rc.NaptrOrder, rc.NaptrPreference,
quoteDNSString(rc.NaptrFlags), quoteDNSString(rc.NaptrService),
quoteDNSString(rc.NaptrRegexp),
rc.GetTargetField())
default:
return rc.GetTargetField()
}
@@ -577,6 +584,9 @@ func getTargetRecordPriority(rc *models.RecordConfig) int {
return int(rc.MxPreference)
case "SRV":
return int(rc.SrvPriority)
case "NAPTR":
// Neither order nor preference
return 0
default:
return 0
}