diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-03-19 12:19:07 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-03-19 13:47:54 +0000 |
commit | 9825f6a5f0a7924899bf87679e5d7708c96f25da (patch) | |
tree | 7f049e1f3c81a6b34a1456147ce450ae1167afb6 /src/lua/lua_expression.c | |
parent | 6f854176850ae787ad9bbd6743fa59b671e407a2 (diff) | |
download | rspamd-9825f6a5f0a7924899bf87679e5d7708c96f25da.tar.gz rspamd-9825f6a5f0a7924899bf87679e5d7708c96f25da.zip |
Fix issues when calling for process atoms.
Diffstat (limited to 'src/lua/lua_expression.c')
-rw-r--r-- | src/lua/lua_expression.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lua/lua_expression.c b/src/lua/lua_expression.c index b4ca29602..b7e47c76a 100644 --- a/src/lua/lua_expression.c +++ b/src/lua/lua_expression.c @@ -156,9 +156,10 @@ lua_atom_process (gpointer input, rspamd_expression_atom_t *atom) gint ret; lua_rawgeti (e->L, LUA_REGISTRYINDEX, e->process_idx); + lua_pushlstring (e->L, atom->str, atom->len); lua_pushvalue (e->L, GPOINTER_TO_INT (input)); - if (lua_pcall (e->L, 1, 1, 0) != 0) { + if (lua_pcall (e->L, 2, 1, 0) != 0) { msg_info ("callback call failed: %s", lua_tostring (e->L, -1)); } @@ -216,7 +217,7 @@ lua_expr_create (lua_State *L) lua_pop (L, 1); - lua_pushnumber (L, 1); + lua_pushnumber (L, 2); lua_gettable (L, -2); if (lua_type (L, -1) != LUA_TFUNCTION) { @@ -238,11 +239,11 @@ lua_expr_create (lua_State *L) lua_pushnumber (L, 1); lua_gettable (L, -2); e->parse_idx = luaL_ref (L, LUA_REGISTRYINDEX); - lua_pop (L, 1); + lua_pushnumber (L, 2); lua_gettable (L, -2); e->process_idx = luaL_ref (L, LUA_REGISTRYINDEX); - lua_pop (L, 2); /* Idx and table */ + lua_pop (L, 1); /* Table */ if (!rspamd_parse_expression (line, len, &lua_atom_subr, e, pool, &err, &e->expr)) { |