diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-12-07 20:19:02 +0300 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-12-07 20:19:02 +0300 |
commit | be7f8c95a7689ec6d2ffac4abffd36fdaa5229eb (patch) | |
tree | 2e85f85120d2d9b73b5957b4bc57f2c23d2d9459 /src/plugins/spf.c | |
parent | e2605b25c3bc7fe3240cf0e3bb83fd10789adabe (diff) | |
download | rspamd-be7f8c95a7689ec6d2ffac4abffd36fdaa5229eb.tar.gz rspamd-be7f8c95a7689ec6d2ffac4abffd36fdaa5229eb.zip |
* Some fixes to 'include' and 'redirect' defines and to mask checking
Diffstat (limited to 'src/plugins/spf.c')
-rw-r--r-- | src/plugins/spf.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/plugins/spf.c b/src/plugins/spf.c index dae3cb471..b597da1e5 100644 --- a/src/plugins/spf.c +++ b/src/plugins/spf.c @@ -140,23 +140,27 @@ spf_plugin_callback (struct spf_record *record, struct worker_task *task) uint32_t s, m; if (record) { - record->addrs = g_list_reverse (record->addrs); cur = g_list_first (record->addrs); s = ntohl (task->from_addr.s_addr); while (cur) { addr = cur->data; - m = (1 << addr->mask) - 1; + if (addr->mask == 0) { + m = 0; + } + else { + m = G_MAXUINT32 << (32 - addr->mask); + } if ((s & m) == (addr->addr & m)) { switch (addr->mech) { case SPF_FAIL: - insert_result (task, spf_module_ctx->metric, spf_module_ctx->symbol_fail, 1, NULL); + insert_result (task, spf_module_ctx->metric, spf_module_ctx->symbol_fail, 1, g_list_prepend (NULL, addr->spf_string)); break; case SPF_SOFT_FAIL: case SPF_NEUTRAL: - insert_result (task, spf_module_ctx->metric, spf_module_ctx->symbol_softfail, 1, NULL); + insert_result (task, spf_module_ctx->metric, spf_module_ctx->symbol_softfail, 1, g_list_prepend (NULL, addr->spf_string)); break; default: - insert_result (task, spf_module_ctx->metric, spf_module_ctx->symbol_allow, 1, NULL); + insert_result (task, spf_module_ctx->metric, spf_module_ctx->symbol_allow, 1, g_list_prepend (NULL, addr->spf_string)); break; } /* Stop parsing */ |