aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/spf.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-02-14 17:56:13 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-02-14 17:56:13 +0300
commit4be4cd5d9da12c449a2154d7e70b5244e7bb1a48 (patch)
treea79ccbbaa8e9521b7d02e8e46de5b76c53b25582 /src/plugins/spf.c
parent3c2638e27f6a693318ec9d787885d20c28c41d36 (diff)
downloadrspamd-4be4cd5d9da12c449a2154d7e70b5244e7bb1a48.tar.gz
rspamd-4be4cd5d9da12c449a2154d7e70b5244e7bb1a48.zip
Fix spf parser for some cases.
Diffstat (limited to 'src/plugins/spf.c')
-rw-r--r--src/plugins/spf.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/plugins/spf.c b/src/plugins/spf.c
index f6077d2c2..f7b0caab3 100644
--- a/src/plugins/spf.c
+++ b/src/plugins/spf.c
@@ -136,7 +136,7 @@ spf_plugin_callback (struct spf_record *record, struct worker_task *task)
guint32 s, m;
if (record) {
- cur = g_list_first (record->addrs);
+ cur = g_list_last (record->addrs);
s = ntohl (task->from_addr.s_addr);
while (cur) {
addr = cur->data;
@@ -147,6 +147,14 @@ spf_plugin_callback (struct spf_record *record, struct worker_task *task)
else {
m = G_MAXUINT32 << (32 - addr->mask);
}
+ if (addr->addr == 0 && cur->prev != NULL) {
+ /*
+ * In fact default record should be the last element in a record
+ * so ignore such other records
+ */
+ cur = g_list_previous (cur);
+ continue;
+ }
if ((s & m) == (addr->addr & m)) {
switch (addr->mech) {
case SPF_FAIL:
@@ -167,7 +175,7 @@ spf_plugin_callback (struct spf_record *record, struct worker_task *task)
break;
}
}
- cur = g_list_next (cur);
+ cur = g_list_previous (cur);
}
if (record->addrs != NULL) {
/* Free addresses that we already proceed */