aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_config.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-12 17:22:18 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-12 17:22:18 +0100
commiteea4d934355c80febfab60f06d19824c8f921757 (patch)
treedc3f195d13207236ee4c22da240b982d9d5d01d4 /src/lua/lua_config.c
parent041bbc6c78d090698660fe6cf39802060ea0e203 (diff)
downloadrspamd-eea4d934355c80febfab60f06d19824c8f921757.tar.gz
rspamd-eea4d934355c80febfab60f06d19824c8f921757.zip
[Fix] Fix symbols registration and execution
Diffstat (limited to 'src/lua/lua_config.c')
-rw-r--r--src/lua/lua_config.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c
index d16c645a6..ee6ab3ef7 100644
--- a/src/lua/lua_config.c
+++ b/src/lua/lua_config.c
@@ -783,13 +783,24 @@ rspamd_register_symbol_fromlua (lua_State *L,
}
}
- ret = rspamd_symbols_cache_add_symbol (cfg->cache,
- name,
- priority,
- lua_metric_symbol_callback,
- cd,
- type,
- parent);
+ if (ref != -1) {
+ ret = rspamd_symbols_cache_add_symbol (cfg->cache,
+ name,
+ priority,
+ lua_metric_symbol_callback,
+ cd,
+ type,
+ parent);
+ }
+ else {
+ ret = rspamd_symbols_cache_add_symbol (cfg->cache,
+ name,
+ priority,
+ NULL,
+ cd,
+ type,
+ parent);
+ }
rspamd_mempool_add_destructor (cfg->cfg_pool,
(rspamd_mempool_destruct_t)lua_destroy_cfg_symbol,
cd);
@@ -924,10 +935,10 @@ lua_parse_symbol_type (const gchar *str)
ret = SYMBOL_TYPE_NORMAL;
}
else if (strcmp (str, "prefilter") == 0) {
- ret = SYMBOL_TYPE_PREFILTER;
+ ret = SYMBOL_TYPE_PREFILTER|SYMBOL_TYPE_GHOST;
}
else if (strcmp (str, "postfilter") == 0) {
- ret = SYMBOL_TYPE_POSTFILTER;
+ ret = SYMBOL_TYPE_POSTFILTER|SYMBOL_TYPE_GHOST;
}
else {
msg_warn ("bad type: %s", str);