From 95ebf1d35b9ff3612f0dec07db3a1e90fb6197b3 Mon Sep 17 00:00:00 2001 From: Kieran Jacobsen <2404128+kjacobsen@users.noreply.github.com> Date: Fri, 3 Aug 2018 00:57:41 +1000 Subject: [PATCH] Include PTR types in SPF Builder (#378) * Include PTR types in SPF * Simplify PTR and Exists logic * Include PTR test case * Include PTR test case * Remove extra } --- pkg/spflib/parse.go | 2 +- pkg/spflib/parse_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/spflib/parse.go b/pkg/spflib/parse.go index 55a6290bb..2111c9e5a 100644 --- a/pkg/spflib/parse.go +++ b/pkg/spflib/parse.go @@ -82,7 +82,7 @@ func Parse(text string, dnsres Resolver) (*SPFRecord, error) { return nil, errors.Errorf("In included spf: %s", err) } } - } else if strings.HasPrefix(part, "exists:") { + } else if strings.HasPrefix(part, "exists:") || strings.HasPrefix(part, "ptr:") { p.IsLookup = true } else { return nil, errors.Errorf("Unsupported spf part %s", part) diff --git a/pkg/spflib/parse_test.go b/pkg/spflib/parse_test.go index 157bbdb9c..8bb02e850 100644 --- a/pkg/spflib/parse_test.go +++ b/pkg/spflib/parse_test.go @@ -21,6 +21,7 @@ func TestParse(t *testing.T) { "include:sendgrid.net", "include:spf.mtasv.net", "exists:%{i}._spf.sparkpostmail.com", + "ptr:sparkpostmail.com", "~all"}, " "), dnsres) if err != nil { t.Fatal(err)