]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Save the original SPF record in mempool variable
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 20 Jul 2018 13:45:15 +0000 (14:45 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 20 Jul 2018 14:14:55 +0000 (15:14 +0100)
src/libserver/mempool_vars_internal.h
src/libserver/spf.c

index 88cd273e8250ef1341cc16ae8ad290488ccbb9f1..a5195d32560cdad825ef405fb29359045f5b41a7 100644 (file)
@@ -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"
index 8a19e3094a138d9f819818b427f78e7691283e1d..a5f0d5b48b49981657996d4e5c3ae9e904aace9c 100644 (file)
@@ -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)