summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-08 11:30:12 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-08 11:30:12 +0000
commitfd38974d948b5e1a64f40f1f21bb59eee447c794 (patch)
treee6f0e91b9bba7f3dafede4733a3f3f4ce839bcb6
parent63c4d493d145b59d000ff7579aa7893c97d1566e (diff)
downloadrspamd-fd38974d948b5e1a64f40f1f21bb59eee447c794.tar.gz
rspamd-fd38974d948b5e1a64f40f1f21bb59eee447c794.zip
Fix one shot mode for SA metas
-rw-r--r--src/lua/lua_config.c2
-rw-r--r--src/plugins/lua/spamassassin.lua6
2 files changed, 6 insertions, 2 deletions
diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c
index bd1f5852f..fa778ff6d 100644
--- a/src/lua/lua_config.c
+++ b/src/lua/lua_config.c
@@ -940,7 +940,7 @@ lua_metric_symbol_callback (struct rspamd_task *task, gpointer ud)
if (nresults >= 1) {
/* Function returned boolean, so maybe we need to insert result? */
- gint res;
+ gint res = 0;
GList *opts = NULL;
gint i;
gdouble flag = 1.0;
diff --git a/src/plugins/lua/spamassassin.lua b/src/plugins/lua/spamassassin.lua
index d74066124..4f41681e6 100644
--- a/src/plugins/lua/spamassassin.lua
+++ b/src/plugins/lua/spamassassin.lua
@@ -1212,6 +1212,7 @@ local function post_process()
res = expression:process(task)
end
if res > 0 then
+ -- Symbol should be one shot to make it working properly
task:insert_result(k, res)
end
else
@@ -1226,7 +1227,10 @@ local function post_process()
rspamd_logger.errx(rspamd_config, 'Cannot parse expression ' .. r['meta'])
else
if r['score'] then
- rspamd_config:set_metric_symbol(k, r['score'], r['description'])
+ rspamd_config:set_metric_symbol({
+ name = k, score = r['score'],
+ description = r['description'],
+ one_shot = true })
end
rspamd_config:register_symbol(k, calculate_score(k, r), meta_cb)
r['expression'] = expression