diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-11-09 13:32:14 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-11-09 13:32:14 +0000 |
commit | 0c43dd1200d6d39426c26d6ad5ca5ba499e0e78b (patch) | |
tree | 38e3a4a5141ff948418f19a6c730020ef58817c3 /src/libserver | |
parent | 4350175fb19b67c432a2847ac6ee80a2d0d66ff1 (diff) | |
download | rspamd-0c43dd1200d6d39426c26d6ad5ca5ba499e0e78b.tar.gz rspamd-0c43dd1200d6d39426c26d6ad5ca5ba499e0e78b.zip |
Fix spf redirects.
Diffstat (limited to 'src/libserver')
-rw-r--r-- | src/libserver/spf.c | 11 | ||||
-rw-r--r-- | src/libserver/spf.h | 1 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/libserver/spf.c b/src/libserver/spf.c index 433f8f927..36b513707 100644 --- a/src/libserver/spf.c +++ b/src/libserver/spf.c @@ -249,7 +249,7 @@ static void rspamd_spf_process_reference (struct spf_resolved *target, struct spf_addr *addr, struct spf_record *rec, gboolean top) { - struct spf_resolved_element *elt; + struct spf_resolved_element *elt, *relt; struct spf_addr *cur = NULL, taddr; guint i; @@ -267,7 +267,7 @@ rspamd_spf_process_reference (struct spf_resolved *target, for (i = 0; i < elt->elts->len; i++) { cur = g_ptr_array_index (elt->elts, i); - if (cur->flags & RSPAMD_SPF_FLAG_PARSED) { + if (cur->flags & RSPAMD_SPF_FLAG_REDIRECT) { break; } } @@ -281,7 +281,10 @@ rspamd_spf_process_reference (struct spf_resolved *target, g_assert (cur->flags & RSPAMD_SPF_FLAG_REFRENCE); g_assert (cur->m.idx < rec->resolved->len); - elt = g_ptr_array_index (rec->resolved, cur->m.idx); + relt = g_ptr_array_index (rec->resolved, cur->m.idx); + msg_debug_spf ("domain %s is redirected to %s", elt->cur_domain, + relt->cur_domain); + elt = relt; } for (i = 0; i < elt->elts->len; i++) { @@ -1065,7 +1068,7 @@ parse_spf_redirect (struct spf_record *rec, cb = rspamd_mempool_alloc (task->task_pool, sizeof (struct spf_dns_cb)); /* Set reference */ - addr->flags |= RSPAMD_SPF_FLAG_REFRENCE; + addr->flags |= RSPAMD_SPF_FLAG_REFRENCE | RSPAMD_SPF_FLAG_REDIRECT; addr->m.idx = rec->resolved->len; cb->rec = rec; diff --git a/src/libserver/spf.h b/src/libserver/spf.h index cdb7a0434..9aa439905 100644 --- a/src/libserver/spf.h +++ b/src/libserver/spf.h @@ -34,6 +34,7 @@ typedef enum spf_action_e { #define RSPAMD_SPF_FLAG_PARSED (1 << 3) #define RSPAMD_SPF_FLAG_VALID (1 << 4) #define RSPAMD_SPF_FLAG_REFRENCE (1 << 5) +#define RSPAMD_SPF_FLAG_REDIRECT (1 << 6) struct spf_addr { guchar addr6[sizeof (struct in6_addr)]; |