commit baf5677: [Minor] Fix some issues with lua scripts invocation
Vsevolod Stakhov
vsevolod at highsecure.ru
Wed Mar 4 20:07:09 UTC 2020
Author: Vsevolod Stakhov
Date: 2020-03-04 19:36:11 +0000
URL: https://github.com/rspamd/rspamd/commit/baf567789ec0b66e84e86423a2fbb39862d1a127 (HEAD -> master)
[Minor] Fix some issues with lua scripts invocation
---
src/fuzzy_storage.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
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);
More information about the Commits
mailing list