aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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