From eb4af05d319c1ee6127306cb5b450e8499ded259 Mon Sep 17 00:00:00 2001 From: Tom Limoncelli Date: Wed, 8 Mar 2023 07:59:35 -0800 Subject: [PATCH 1/2] DIGITALOCEAN: Improve TXT record handling (#2128) --- integrationTest/integration_test.go | 13 ++++++------- providers/digitalocean/digitaloceanProvider.go | 7 +++---- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/integrationTest/integration_test.go b/integrationTest/integration_test.go index 694d05284..b0e22bfbd 100644 --- a/integrationTest/integration_test.go +++ b/integrationTest/integration_test.go @@ -843,19 +843,18 @@ func makeTests(t *testing.T) []*TestGroup { // of record. When the provider fixes the bug or changes behavior, // update the AuditRecords(). - tc("TXT with 0-octel string", txt("foo1", "")), + // NB(tlim) 2023-03-07: Removing this test. Nobody does this. + //tc("TXT with 0-octel string", txt("foo1", "")), // https://github.com/StackExchange/dnscontrol/issues/598 // RFC1035 permits this, but rarely do provider support it. //clear(), - - tc("a 255-byte TXT", txt("foo255", strings.Repeat("C", 255))), + //tc("a 255-byte TXT", txt("foo255", strings.Repeat("C", 255))), //clear(), - tc("a 256-byte TXT", txt("foo256", strings.Repeat("D", 256))), + //tc("a 256-byte TXT", txt("foo256", strings.Repeat("D", 256))), //clear(), - - tc("a 512-byte TXT", txt("foo512", strings.Repeat("C", 512))), + //tc("a 512-byte TXT", txt("foo512", strings.Repeat("C", 512))), //clear(), - tc("a 513-byte TXT", txt("foo513", strings.Repeat("D", 513))), + //tc("a 513-byte TXT", txt("foo513", strings.Repeat("D", 513))), //clear(), tc("TXT with 1 single-quote", txt("foosq", "quo'te")), diff --git a/providers/digitalocean/digitaloceanProvider.go b/providers/digitalocean/digitaloceanProvider.go index 5dbc99030..0aebb39fe 100644 --- a/providers/digitalocean/digitaloceanProvider.go +++ b/providers/digitalocean/digitaloceanProvider.go @@ -277,12 +277,11 @@ func toRc(domain string, r *godo.DomainRecord) *models.RecordConfig { CaaFlag: uint8(r.Flags), } t.SetLabelFromFQDN(name, domain) - t.SetTarget(target) switch rtype := r.Type; rtype { case "TXT": - t.SetTargetTXTfromRFC1035Quoted(target) + t.SetTargetTXT(target) default: - // nothing additional required + t.SetTarget(target) } return t } @@ -304,7 +303,7 @@ func toReq(dc *models.DomainConfig, rc *models.RecordConfig) *godo.DomainRecordE priority = int(rc.SrvPriority) case "TXT": // TXT records are the one place where DO combines many items into one field. - target = rc.GetTargetField() + target = rc.GetTargetTXTJoined() default: // no action required } From ad4b8daa137e74b421dc95e5e25560e2d050ead1 Mon Sep 17 00:00:00 2001 From: Tom Limoncelli Date: Wed, 8 Mar 2023 22:22:12 -0800 Subject: [PATCH 2/2] BUGFIX: REPORT change type always crashes on push (#2130) --- commands/previewPush.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/commands/previewPush.go b/commands/previewPush.go index 6eee2cac8..8c65bfd3f 100644 --- a/commands/previewPush.go +++ b/commands/previewPush.go @@ -2,11 +2,12 @@ package commands import ( "fmt" - "golang.org/x/net/idna" "log" "os" "strings" + "golang.org/x/net/idna" + "github.com/StackExchange/dnscontrol/v3/models" "github.com/StackExchange/dnscontrol/v3/pkg/credsfile" "github.com/StackExchange/dnscontrol/v3/pkg/nameservers" @@ -495,10 +496,12 @@ func printOrRunCorrections(domain string, provider string, corrections []*models if interactive && !out.PromptToRun() { continue } - err = correction.F() - out.EndCorrection(err) - if err != nil { - anyErrors = true + if correction.F != nil { + err = correction.F() + out.EndCorrection(err) + if err != nil { + anyErrors = true + } } } notifier.Notify(domain, provider, correction.Msg, err, !push)