summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-07-20 14:45:15 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-07-20 15:14:55 +0100
commit2820b72c14ae08e4dc02c8785833ca68f2385727 (patch)
tree5ffcecfbd30f5e62074b483679fb50db9c8a90b5 /src
parentcec08418f8d5097df1bb83b9e942d81d195eabf7 (diff)
downloadrspamd-2820b72c14ae08e4dc02c8785833ca68f2385727.tar.gz
rspamd-2820b72c14ae08e4dc02c8785833ca68f2385727.zip
[Minor] Save the original SPF record in mempool variable
Diffstat (limited to 'src')
-rw-r--r--src/libserver/mempool_vars_internal.h1
-rw-r--r--src/libserver/spf.c5
2 files changed, 6 insertions, 0 deletions
diff --git a/src/libserver/mempool_vars_internal.h b/src/libserver/mempool_vars_internal.h
index 88cd273e8..a5195d325 100644
--- a/src/libserver/mempool_vars_internal.h
+++ b/src/libserver/mempool_vars_internal.h
@@ -25,6 +25,7 @@
#define RSPAMD_MEMPOOL_MTA_TAG "MTA-Tag"
#define RSPAMD_MEMPOOL_MTA_NAME "MTA-Name"
#define RSPAMD_MEMPOOL_SPF_DOMAIN "spf_domain"
+#define RSPAMD_MEMPOOL_SPF_RECORD "spf_record"
#define RSPAMD_MEMPOOL_PRINCIPAL_RECIPIENT "principal_recipient"
#define RSPAMD_MEMPOOL_PROFILE "profile"
#define RSPAMD_MEMPOOL_MILTER_REPLY "milter_reply"
diff --git a/src/libserver/spf.c b/src/libserver/spf.c
index 8a19e3094..a5f0d5b48 100644
--- a/src/libserver/spf.c
+++ b/src/libserver/spf.c
@@ -584,6 +584,10 @@ spf_process_txt_record (struct spf_record *rec, struct spf_resolved_element *res
LL_FOREACH (reply->entries, elt) {
if (start_spf_parse (rec, resolved, elt->content.txt.data)) {
ret = TRUE;
+ rspamd_mempool_set_variable (rec->task->task_pool,
+ RSPAMD_MEMPOOL_SPF_RECORD,
+ rspamd_mempool_strdup (rec->task->task_pool,
+ elt->content.txt.data), NULL);
break;
}
}
@@ -2023,6 +2027,7 @@ spf_dns_callback (struct rdns_reply *reply, gpointer arg)
if (resolved) {
if (!spf_process_txt_record (rec, resolved, reply)) {
resolved = g_ptr_array_index(rec->resolved, 0);
+
if (rec->resolved->len > 1) {
addr = g_ptr_array_index(resolved->elts, 0);
if ((reply->code == RDNS_RC_NOREC || reply->code == RDNS_RC_NXDOMAIN)