mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-09-04 20:24:23 +08:00
Remove length checking from TxtNoMultipleStrings (#1308)
All functions in should test for only one condition. There already is a function that tests for long TXT records: TxtNoLongStrings. Add calls to TxtNoLongStrings in all providers that use TxtNoMultipleStrings, to keep functionality, except for NS1 and ClouDNS, which allow for any TXT record length, but not for multiple strings per TXT.
This commit is contained in:
parent
3405757271
commit
58a5a4bcf0
4 changed files with 9 additions and 17 deletions
|
@ -97,8 +97,6 @@ func TxtNoMultipleStrings(records []*models.RecordConfig) error {
|
|||
if rc.HasFormatIdenticalToTXT() { // TXT and similar:
|
||||
if len(rc.TxtStrings) > 1 {
|
||||
return fmt.Errorf("multiple strings in one txt")
|
||||
} else if len(rc.TxtStrings) == 1 && len(rc.TxtStrings[0]) > 255 {
|
||||
return fmt.Errorf("strings >255 octets")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package cloudns
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/StackExchange/dnscontrol/v3/models"
|
||||
"github.com/StackExchange/dnscontrol/v3/pkg/recordaudit"
|
||||
)
|
||||
|
@ -30,22 +29,9 @@ func AuditRecords(records []*models.RecordConfig) error {
|
|||
}
|
||||
// Still needed as of 2021-03-11
|
||||
|
||||
if err := txtNoMultipleStrings(records); err != nil {
|
||||
if err := recordaudit.TxtNoMultipleStrings(records); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ClouDNS NOT allow multiple TXT records with same name
|
||||
// But allow values longer the 255
|
||||
func txtNoMultipleStrings(records []*models.RecordConfig) error {
|
||||
for _, rc := range records {
|
||||
if rc.HasFormatIdenticalToTXT() { // TXT and similar:
|
||||
if len(rc.TxtStrings) > 1 {
|
||||
return fmt.Errorf("multiple strings in one txt")
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -14,6 +14,10 @@ func AuditRecords(records []*models.RecordConfig) error {
|
|||
}
|
||||
// Still needed as of 2021-03-01
|
||||
|
||||
if err := recordaudit.TxtNoLongStrings(records); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := recordaudit.TxtNotEmpty(records); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -20,5 +20,9 @@ func AuditRecords(records []*models.RecordConfig) error {
|
|||
return err
|
||||
}
|
||||
|
||||
if err := recordaudit.TxtNoLongStrings(records); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue