Skip to content

Commit

Permalink
Stop looking up the SPF record twice
Browse files Browse the repository at this point in the history
If we include the SPF record (as obtained by following redirects) as
an argument to spf.query.check(), then that method will not look up
the SPF record a second time.  I suspect that these repeated DNS
queries may be occasionally failing, and that is what is responsible
for the "Result unexpectedly differs" errors that are seen in the
trustymail results.
  • Loading branch information
jsf9k committed Nov 17, 2018
1 parent b05b952 commit 56fcc07
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions trustymail/trustymail.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def check_spf_record(record_text, expected_result, domain, strict=2):
query = spf.query('128.143.22.36',
'email_wizard@' + domain.domain_name,
domain.domain_name, strict=strict)
response = query.check()
response = query.check(spf=record_text)

response_type = response[0]
if response_type == 'temperror' or response_type == 'permerror':
Expand Down Expand Up @@ -325,7 +325,7 @@ def spf_scan(resolver, domain):
else:
result = 'neutral'

check_spf_record(record_text_not_following_redirect, result, domain)
check_spf_record(record_text_following_redirect, result, domain)


def parse_dmarc_report_uri(uri):
Expand Down

0 comments on commit 56fcc07

Please sign in to comment.