aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-08-19 10:27:43 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-08-19 10:27:43 +0100
commit9933eb12cb6d689328ec07e3e05567ffaef86f2e (patch)
treef58c68708d5882a509a5ae80b9a0b8743be2603e /src
parent4435b4ec2d40fb2193752fead5fee7bc093a2e10 (diff)
downloadrspamd-9933eb12cb6d689328ec07e3e05567ffaef86f2e.tar.gz
rspamd-9933eb12cb6d689328ec07e3e05567ffaef86f2e.zip
[Feature] Add SPF method in spf return result
Issue: #831 Reported by: @moisseev
Diffstat (limited to 'src')
-rw-r--r--src/plugins/spf.c10
1 files changed, 9 insertions, 1 deletions
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,