aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-10-26 12:18:49 +0200
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-10-26 12:19:22 +0200
commitb2cfa63b1fc61c666ee2539f070ac99c0961fcee (patch)
treedd00d4a538ce3498242f05d30892505a597dca3d
parentafa99d6cb1443fbea654027c3ecaa4057b610000 (diff)
downloadrspamd-b2cfa63b1fc61c666ee2539f070ac99c0961fcee.tar.gz
rspamd-b2cfa63b1fc61c666ee2539f070ac99c0961fcee.zip
[Fix] Fix applying of lua dynamic confg
-rw-r--r--src/libserver/dynamic_cfg.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/libserver/dynamic_cfg.c b/src/libserver/dynamic_cfg.c
index 56b7b17f0..ffb5963a5 100644
--- a/src/libserver/dynamic_cfg.c
+++ b/src/libserver/dynamic_cfg.c
@@ -394,13 +394,13 @@ new_dynamic_elt (ucl_object_t *arr, const gchar *name, gdouble value)
return n;
}
-static gboolean
+static gint
rspamd_maybe_add_lua_dynsym (struct rspamd_config *cfg,
const gchar *sym,
gdouble score)
{
lua_State *L = cfg->lua_state;
- gboolean ret = FALSE;
+ gint ret = -1;
struct rspamd_config **pcfg;
lua_getglobal (L, "rspamd_plugins");
@@ -442,13 +442,13 @@ rspamd_maybe_add_lua_dynsym (struct rspamd_config *cfg,
return ret;
}
-static gboolean
+static gint
rspamd_maybe_add_lua_dynact (struct rspamd_config *cfg,
const gchar *action,
gdouble score)
{
lua_State *L = cfg->lua_state;
- gboolean ret = FALSE;
+ gint ret = -1;
struct rspamd_config **pcfg;
lua_getglobal (L, "rspamd_plugins");
@@ -505,9 +505,10 @@ add_dynamic_symbol (struct rspamd_config *cfg,
gdouble value)
{
ucl_object_t *metric, *syms;
+ gint ret;
- if (rspamd_maybe_add_lua_dynsym (cfg, symbol, value)) {
- return TRUE;
+ if ((ret = rspamd_maybe_add_lua_dynsym (cfg, symbol, value)) != -1) {
+ return ret == 0 ? FALSE : TRUE;
}
if (cfg->dynamic_conf == NULL) {
@@ -597,9 +598,10 @@ add_dynamic_action (struct rspamd_config *cfg,
{
ucl_object_t *metric, *acts;
const gchar *action_name = rspamd_action_to_str (action);
+ gint ret;
- if (rspamd_maybe_add_lua_dynact (cfg, action_name, value)) {
- return TRUE;
+ if ((ret = rspamd_maybe_add_lua_dynact (cfg, action_name, value)) != -1) {
+ return ret == 0 ? FALSE : TRUE;
}
if (cfg->dynamic_conf == NULL) {