From: Vsevolod Stakhov Date: Fri, 20 Jul 2018 13:45:15 +0000 (+0100) Subject: [Minor] Save the original SPF record in mempool variable X-Git-Tag: 1.7.9~78 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2820b72c14ae08e4dc02c8785833ca68f2385727;p=rspamd.git [Minor] Save the original SPF record in mempool variable --- 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)