diff options
author | Andrew Lewis <nerf@judo.za.org> | 2016-09-26 11:39:25 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2016-09-26 11:39:25 +0200 |
commit | 18b3d066748baff20608adfa2270c50a40704c88 (patch) | |
tree | 009c73d1fac0eb8d1e6d721aee641d150330481d /src | |
parent | aa4e6f0e09a45d0e82be4d495e97a7c9eb7342a8 (diff) | |
download | rspamd-18b3d066748baff20608adfa2270c50a40704c88.tar.gz rspamd-18b3d066748baff20608adfa2270c50a40704c88.zip |
[Minor] Fix SPF PERMFAIL/DNSFAIL behaviour on failed redirect
Diffstat (limited to 'src')
-rw-r--r-- | src/libserver/spf.c | 6 | ||||
-rw-r--r-- | src/libserver/spf.h | 2 | ||||
-rw-r--r-- | src/plugins/spf.c | 6 |
3 files changed, 13 insertions, 1 deletions
diff --git a/src/libserver/spf.c b/src/libserver/spf.c index c0ca38e15..41f31bfb0 100644 --- a/src/libserver/spf.c +++ b/src/libserver/spf.c @@ -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 ( diff --git a/src/libserver/spf.h b/src/libserver/spf.h index 1e2bcfe45..ab2d0bc53 100644 --- a/src/libserver/spf.h +++ b/src/libserver/spf.h @@ -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 */ }; diff --git a/src/plugins/spf.c b/src/plugins/spf.c index 33df85262..99d09fd01 100644 --- a/src/plugins/spf.c +++ b/src/plugins/spf.c @@ -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, |