]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix SPF PERMFAIL/DNSFAIL behaviour on failed redirect 978/head
authorAndrew Lewis <nerf@judo.za.org>
Mon, 26 Sep 2016 09:39:25 +0000 (11:39 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Mon, 26 Sep 2016 09:39:25 +0000 (11:39 +0200)
src/libserver/spf.c
src/libserver/spf.h
src/plugins/spf.c
test/functional/cases/115_dmarc.robot

index c0ca38e15eb4df12a4b13eb1c9548720bdad0307..41f31bfb0adc335487b684e977a2514a033a4476 100644 (file)
@@ -332,6 +332,10 @@ rspamd_spf_process_reference (struct spf_resolved *target,
                        target->temp_failed = TRUE;
                        continue;
                }
+               if (cur->flags & RSPAMD_SPF_FLAG_PERMFAIL) {
+                       target->perm_failed = TRUE;
+                       continue;
+               }
                if (cur->flags & RSPAMD_SPF_FLAG_NA) {
                        target->na = TRUE;
                        continue;
@@ -734,7 +738,7 @@ spf_record_dns_callback (struct rdns_reply *reply, gpointer arg)
                                                task->message_id,
                                                cb->rec->sender_domain,
                                                cb->resolved->cur_domain);
-                               cb->addr->flags &= ~RSPAMD_SPF_FLAG_PARSED;
+                               cb->addr->flags |= RSPAMD_SPF_FLAG_PERMFAIL;
                                break;
                        case SPF_RESOLVE_INCLUDE:
                                msg_debug_spf (
index 1e2bcfe4537be5bddc8a44e6177f2de39bce6a24..ab2d0bc5340c6d1d969c5836a185386f4a000373 100644 (file)
@@ -39,6 +39,7 @@ typedef enum spf_action_e {
 #define RSPAMD_SPF_FLAG_REDIRECT (1 << 7)
 #define RSPAMD_SPF_FLAG_TEMPFAIL (1 << 8)
 #define RSPAMD_SPF_FLAG_NA (1 << 9)
+#define RSPAMD_SPF_FLAG_PERMFAIL (1 << 10)
 
 struct spf_addr {
        guchar addr6[sizeof (struct in6_addr)];
@@ -61,6 +62,7 @@ struct spf_resolved {
        guint ttl;
        gboolean temp_failed;
        gboolean na;
+       gboolean perm_failed;
        GArray *elts; /* Flat list of struct spf_addr */
        ref_entry_t ref; /* Refcounting */
 };
index 33df85262ffd493ab33b3a9d6fe1d0463e14dd59..99d09fd01dc0200f7bb179fbf730c1c868edaf81 100644 (file)
@@ -478,6 +478,12 @@ spf_plugin_callback (struct spf_resolved *record, struct rspamd_task *task,
                                1,
                                NULL);
        }
+       else if (record && record->perm_failed) {
+               rspamd_task_insert_result (task,
+                               spf_module_ctx->symbol_permfail,
+                               1,
+                               NULL);
+       }
        else if (record && record->elts->len == 0) {
                rspamd_task_insert_result (task,
                                spf_module_ctx->symbol_permfail,
index 82616c8f9b6f24f26e72c48bf44469e92b932575..2895729926afa3db405b182cbd477c7a37802124 100644 (file)
@@ -102,10 +102,10 @@ SPF NA NXDOMAIN
   ...  -i  8.8.8.8  -F  x@zzzzaaaa
   Check Rspamc  ${result}  R_SPF_NA
 
-SPF DNSFAIL UNRESOLVEABLE REDIRECT
+SPF PERMFAIL UNRESOLVEABLE REDIRECT
   ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/bad_dkim1.eml
   ...  -i  8.8.8.8  -F  x@cacophony.za.org
-  Check Rspamc  ${result}  R_SPF_DNSFAIL
+  Check Rspamc  ${result}  R_SPF_PERMFAIL
 
 SPF PERMFAIL
   ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/bad_dkim1.eml