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

TRANSIP: Fix TXT quoting (#2708)

Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
This commit is contained in:
Vincent Hagen
2023-12-11 02:47:44 +01:00
committed by GitHub
parent 8f1b33ae17
commit a7e764391c
4 changed files with 17 additions and 4 deletions

View File

@@ -17,6 +17,15 @@ func TxtHasBackslash(rc *models.RecordConfig) error {
return nil
}
// TxtStartsOrEndsWithSpaces audits TXT records that starts or ends with spaces
func TxtStartsOrEndsWithSpaces(rc *models.RecordConfig) error {
txt := rc.GetTargetTXTJoined()
if len(txt) > 0 && (txt[0] == ' ' || txt[len(txt)-1] == ' ') {
return fmt.Errorf("txtstring starts or ends with spaces")
}
return nil
}
// TxtHasBackticks audits TXT records for strings that contain backticks.
func TxtHasBackticks(rc *models.RecordConfig) error {
if strings.Contains(rc.GetTargetTXTJoined(), "`") {