aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/spf.c
diff options
context:
space:
mode:
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 */