aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_cfg_file.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-23 00:37:36 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-23 00:37:36 +0000
commit2b584275d8aae7634204e047168e83f4b580ec42 (patch)
treec474d291571c3e9caa8cab4459cb1c07a688c40d /src/lua/lua_cfg_file.c
parent8638f8f9bcbd838bf6aa0b6289a962bc554e77a7 (diff)
downloadrspamd-2b584275d8aae7634204e047168e83f4b580ec42.tar.gz
rspamd-2b584275d8aae7634204e047168e83f4b580ec42.zip
Fix lua composites API.
Diffstat (limited to 'src/lua/lua_cfg_file.c')
-rw-r--r--src/lua/lua_cfg_file.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/lua/lua_cfg_file.c b/src/lua/lua_cfg_file.c
index 9ad333132..c73173f97 100644
--- a/src/lua/lua_cfg_file.c
+++ b/src/lua/lua_cfg_file.c
@@ -24,6 +24,8 @@
#include "lua_common.h"
#include "symbols_cache.h"
+#include "expression.h"
+#include "filter.h"
#ifdef HAVE_SYS_UTSNAME_H
#include <sys/utsname.h>
#endif
@@ -139,9 +141,10 @@ rspamd_lua_post_load_config (struct rspamd_config *cfg)
lua_State *L = cfg->lua_state;
const gchar *name, *val;
gchar *sym;
- struct expression *expr, *old_expr;
+ struct rspamd_expression *expr, *old_expr;
ucl_object_t *obj;
gsize keylen;
+ GError *err = NULL;
/* First check all module options that may be overriden in 'config' global */
lua_getglobal (L, "config");
@@ -192,10 +195,12 @@ rspamd_lua_post_load_config (struct rspamd_config *cfg)
if (name != NULL && lua_isstring (L, -1)) {
val = lua_tostring (L, -1);
sym = rspamd_mempool_strdup (cfg->cfg_pool, name);
- if ((expr =
- parse_expression (cfg->cfg_pool,
- rspamd_mempool_strdup (cfg->cfg_pool, val))) == NULL) {
- msg_err ("cannot parse composite expression: %s", val);
+ if (!rspamd_parse_expression (val, 0, &composite_expr_subr, NULL,
+ cfg->cfg_pool, &err, &expr)) {
+ msg_err ("cannot parse composite expression '%s': %s", val,
+ err->message);
+ g_error_free (err);
+ err = NULL;
continue;
}
/* Now check hash table for this composite */