From: Vsevolod Stakhov Date: Fri, 19 Aug 2016 09:27:43 +0000 (+0100) Subject: [Feature] Add SPF method in spf return result X-Git-Tag: 1.3.4~26 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9933eb12cb6d689328ec07e3e05567ffaef86f2e;p=rspamd.git [Feature] Add SPF method in spf return result Issue: #831 Reported by: @moisseev --- diff --git a/src/plugins/spf.c b/src/plugins/spf.c index 4af4d15bb..6e466a11f 100644 --- a/src/plugins/spf.c +++ b/src/plugins/spf.c @@ -338,12 +338,14 @@ spf_check_element (struct spf_resolved *rec, struct spf_addr *addr, } if (res) { - spf_result = rspamd_mempool_strdup (task->task_pool, addr->spf_string); + spf_result = rspamd_mempool_alloc (task->task_pool, + strlen (addr->spf_string) + 2); opts = g_list_prepend (opts, spf_result); switch (addr->mech) { case SPF_FAIL: spf_symbol = spf_module_ctx->symbol_fail; + spf_result[0] = '-'; spf_message = "(SPF): spf fail"; if (addr->flags & RSPAMD_SPF_FLAG_ANY) { if (rec->failed) { @@ -357,6 +359,7 @@ spf_check_element (struct spf_resolved *rec, struct spf_addr *addr, case SPF_SOFT_FAIL: spf_symbol = spf_module_ctx->symbol_softfail; spf_message = "(SPF): spf softfail"; + spf_result[0] = '~'; if (addr->flags & RSPAMD_SPF_FLAG_ANY) { if (rec->failed) { @@ -370,13 +373,18 @@ spf_check_element (struct spf_resolved *rec, struct spf_addr *addr, case SPF_NEUTRAL: spf_symbol = spf_module_ctx->symbol_neutral; spf_message = "(SPF): spf neutral"; + spf_result[0] = '?'; break; default: spf_symbol = spf_module_ctx->symbol_allow; spf_message = "(SPF): spf allow"; + spf_result[0] = '+'; break; } + rspamd_strlcpy (spf_result + 1, addr->spf_string, + strlen (addr->spf_string) + 1); + rspamd_task_insert_result (task, spf_symbol, 1,