ucl_obj_tostring (value), cfg->raw_mode)) {
res = FALSE;
}
- register_symbol (&cfg->cache,
- cur_item->symbol,
- 1,
- process_regexp_item,
- cur_item);
+ else {
+ register_symbol (&cfg->cache,
+ cur_item->symbol,
+ 1,
+ process_regexp_item,
+ cur_item);
+ }
}
else if (value->type == UCL_USERDATA) {
cur_item = rspamd_mempool_alloc0 (regexp_module_ctx->regexp_pool,
static gboolean rspamd_lua_call_expression_func(
struct ucl_lua_funcdata *lua_data, struct rspamd_task *task,
- GArray *args, gboolean *res)
+ GArray *args, gint *res)
{
lua_State *L = lua_data->L;
struct rspamd_task **ptask;
}
pop++;
- if (!lua_isboolean (L, -1)) {
- lua_pop (L, pop);
+ if (lua_type (L, -1) == LUA_TNUMBER) {
+ *res = lua_tonumber (L, -1);
+ }
+ else if (lua_type (L, -1) == LUA_TBOOLEAN) {
+ *res = lua_toboolean (L, -1);
+ }
+ else {
msg_info("lua function must return a boolean");
- return FALSE;
}
- *res = lua_toboolean (L, -1);
+
lua_pop (L, pop);
return TRUE;
process_regexp_item (struct rspamd_task *task, void *user_data)
{
struct regexp_module_item *item = user_data;
- gboolean res = FALSE;
+ gint res = FALSE;
/* Non-threaded version */
if (item->lua_function) {
}
else {
/* Process expression */
- res = rspamd_process_expression (item->expr, task);
+ if (item->expr) {
+ res = rspamd_process_expression (item->expr, task);
+ }
+ else {
+ msg_warn ("FIXME: %s symbol is broken with new expressions",
+ item->symbol);
+ }
}
if (res) {