Browse Source

[Minor] Fix some issues with lua scripts invocation

tags/2.5
Vsevolod Stakhov 4 years ago
parent
commit
baf567789e
1 changed files with 6 additions and 1 deletions
  1. 6
    1
      src/fuzzy_storage.c

+ 6
- 1
src/fuzzy_storage.c View File

@@ -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);

Loading…
Cancel
Save