@@ -870,7 +870,21 @@ dkim_symbol_callback (struct rspamd_task *task, void *unused) | |||
GError *err = NULL; | |||
struct rspamd_mime_header *rh; | |||
struct dkim_check_result *res = NULL, *cur; | |||
guint checked = 0, i; | |||
guint checked = 0, i, *dmarc_checks; | |||
/* Allow dmarc */ | |||
dmarc_checks = rspamd_mempool_get_variable (task->task_pool, "dmarc_checks"); | |||
if (dmarc_checks) { | |||
(*dmarc_checks) ++; | |||
} | |||
else { | |||
dmarc_checks = rspamd_mempool_alloc (task->task_pool, | |||
sizeof (*dmarc_checks)); | |||
*dmarc_checks = 1; | |||
rspamd_mempool_set_variable (task->task_pool, "dmarc_checks", | |||
dmarc_checks, NULL); | |||
} | |||
/* First check if plugin should be enabled */ | |||
if ((!dkim_module_ctx->check_authed && task->user != NULL) |
@@ -255,6 +255,12 @@ local function dmarc_callback(task) | |||
local dmarc_domain, efromdom, spf_domain | |||
local ip_addr = task:get_ip() | |||
local dkim_results = {} | |||
local dmarc_checks = task:get_mempool():get_variable('dmarc_checks', 'int') or 0 | |||
if dmarc_checks ~= 2 then | |||
rspamd_logger.infox(task, "skip DMARC checks as either SPF or DKIM were not checked"); | |||
return | |||
end | |||
if ((not check_authed and task:get_user()) or | |||
(not check_local and ip_addr and ip_addr:is_local())) then |
@@ -549,6 +549,21 @@ spf_symbol_callback (struct rspamd_task *task, void *unused) | |||
const gchar *domain; | |||
struct spf_resolved *l; | |||
struct rspamd_async_watcher *w; | |||
gint *dmarc_checks; | |||
/* Allow dmarc */ | |||
dmarc_checks = rspamd_mempool_get_variable (task->task_pool, "dmarc_checks"); | |||
if (dmarc_checks) { | |||
(*dmarc_checks) ++; | |||
} | |||
else { | |||
dmarc_checks = rspamd_mempool_alloc (task->task_pool, | |||
sizeof (*dmarc_checks)); | |||
*dmarc_checks = 1; | |||
rspamd_mempool_set_variable (task->task_pool, "dmarc_checks", | |||
dmarc_checks, NULL); | |||
} | |||
if (radix_find_compressed_addr (spf_module_ctx->whitelist_ip, | |||
task->from_addr) != RADIX_NO_VALUE) { |