From 25b47c040f5b01ce296a708c72398f38379dccd0 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sun, 10 Jul 2016 12:23:41 +0100 Subject: [PATCH] [Feature] Sign message merely after DKIM check --- src/plugins/dkim_check.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/plugins/dkim_check.c b/src/plugins/dkim_check.c index c3503e7aa..dbe279957 100644 --- a/src/plugins/dkim_check.c +++ b/src/plugins/dkim_check.c @@ -231,7 +231,7 @@ gint dkim_module_config (struct rspamd_config *cfg) { const ucl_object_t *value; - gint res = TRUE, cb_id; + gint res = TRUE, cb_id = -1, check_id = -1; guint cache_size; gboolean got_trusted = FALSE; @@ -389,7 +389,7 @@ dkim_module_config (struct rspamd_config *cfg) 128, g_free, /* Keys are just C-strings */ (GDestroyNotify)rspamd_dkim_sign_key_unref); - cb_id = rspamd_symbols_cache_add_symbol (cfg->cache, + check_id = rspamd_symbols_cache_add_symbol (cfg->cache, "DKIM_SIGN", 0, dkim_sign_callback, @@ -398,6 +398,14 @@ dkim_module_config (struct rspamd_config *cfg) -1); msg_info_config ("init condition script for DKIM signing"); + /* + * Allow dkim signing to be executed only after dkim check + */ + if (cb_id > 0) { + rspamd_symbols_cache_add_delayed_dependency (cfg->cache, + "DKIM_SIGN", dkim_module_ctx->symbol_reject); + } + } else { msg_err_config ("lua script must return " -- 2.39.5