From: Andrew Lewis Date: Mon, 3 Oct 2016 10:16:21 +0000 (+0200) Subject: [Minor] Fix a SPF_DNSFAIL case X-Git-Tag: 1.4.0~330^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F998%2Fhead;p=rspamd.git [Minor] Fix a SPF_DNSFAIL case --- diff --git a/src/libserver/spf.c b/src/libserver/spf.c index d5ca24cc9..2d6f864ba 100644 --- a/src/libserver/spf.c +++ b/src/libserver/spf.c @@ -1876,6 +1876,14 @@ spf_dns_callback (struct rdns_reply *reply, gpointer arg) addr->flags |= RSPAMD_SPF_FLAG_NA; g_ptr_array_insert (resolved->elts, 0, addr); } + else if (reply->code != RDNS_RC_NOREC && reply->code != RDNS_RC_NXDOMAIN + && rec->dns_requests == 0) { + resolved = rspamd_spf_new_addr_list (rec, rec->sender_domain); + addr = g_slice_alloc0 (sizeof(*addr)); + addr->flags = 0; + addr->flags |= RSPAMD_SPF_FLAG_TEMPFAIL; + g_ptr_array_insert (resolved->elts, 0, addr); + } if (resolved) { if (!spf_process_txt_record (rec, resolved, reply)) { diff --git a/test/functional/cases/115_dmarc.robot b/test/functional/cases/115_dmarc.robot index 4dda829e5..2a7d72580 100644 --- a/test/functional/cases/115_dmarc.robot +++ b/test/functional/cases/115_dmarc.robot @@ -152,6 +152,11 @@ SPF DNSFAIL FAILED MX ... -i 1.2.3.4 -F x@fail9.org.org.za Check Rspamc ${result} R_SPF_DNSFAIL +SPF DNSFAIL FAILED RECORD + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml + ... -i 1.2.3.4 -F x@www.dnssec-failed.org + Check Rspamc ${result} R_SPF_DNSFAIL + *** Keywords *** DMARC Setup ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/dmarc.conf