From 9825f6a5f0a7924899bf87679e5d7708c96f25da Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 19 Mar 2015 12:19:07 +0000 Subject: Fix issues when calling for process atoms. --- src/lua/lua_expression.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/lua/lua_expression.c') 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)) { -- cgit v1.2.3