diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-03-04 19:36:11 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-03-04 20:04:00 +0000 |
commit | baf567789ec0b66e84e86423a2fbb39862d1a127 (patch) | |
tree | 70627cde0c411702acf4967938da9809982f6440 /src/fuzzy_storage.c | |
parent | d33893c59fb0a22f098c98445aa8b936655382e3 (diff) | |
download | rspamd-baf567789ec0b66e84e86423a2fbb39862d1a127.tar.gz rspamd-baf567789ec0b66e84e86423a2fbb39862d1a127.zip |
[Minor] Fix some issues with lua scripts invocation
Diffstat (limited to 'src/fuzzy_storage.c')
-rw-r--r-- | src/fuzzy_storage.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c index 107cf7944..b6d7d8ee7 100644 --- a/src/fuzzy_storage.c +++ b/src/fuzzy_storage.c @@ -796,7 +796,7 @@ rspamd_fuzzy_check_callback (struct rspamd_fuzzy_reply *result, void *ud) /* Preallocate stack (small opt) */ lua_checkstack (L, err_idx + 9); /* function */ - lua_rawgeti (L, LUA_REGISTRYINDEX, session->ctx->lua_pre_handler_cbref); + lua_rawgeti (L, LUA_REGISTRYINDEX, session->ctx->lua_post_handler_cbref); /* client IP */ rspamd_lua_ip_push (L, session->addr); /* client command */ @@ -825,6 +825,7 @@ rspamd_fuzzy_check_callback (struct rspamd_fuzzy_reply *result, void *ud) * if it is true, then we need to read the former ones: * 2-nd will be reply code * 3-rd will be probability (or 0.0 if missing) + * 4-th value is flag (or default flag if missing) */ ret = lua_toboolean (L, err_idx + 1); @@ -839,6 +840,10 @@ rspamd_fuzzy_check_callback (struct rspamd_fuzzy_reply *result, void *ud) result->v1.prob = 0.0f; } + if (lua_isnumber (L, err_idx + 4)) { + result->v1.flag = lua_tointeger (L, err_idx + 4); + } + lua_settop (L, 0); rspamd_fuzzy_make_reply (cmd, result, session, encrypted, is_shingle); REF_RELEASE (session); |