diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-04-02 09:12:17 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-04-02 09:12:17 +0100 |
commit | 61c2a3c1e4ef7291130c8f6ea45d0b72e4b86d22 (patch) | |
tree | 28e52fc3f48b4465833df88b48d0fcdfb497090a /src/libserver/cfg_rcl.c | |
parent | 633e5513e27b1ea14b6f152ef72a5498b6b1f825 (diff) | |
download | rspamd-61c2a3c1e4ef7291130c8f6ea45d0b72e4b86d22.tar.gz rspamd-61c2a3c1e4ef7291130c8f6ea45d0b72e4b86d22.zip |
[Fix] Initialize lua debugging earlier
Diffstat (limited to 'src/libserver/cfg_rcl.c')
-rw-r--r-- | src/libserver/cfg_rcl.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c index ed99ef8b6..a9f957183 100644 --- a/src/libserver/cfg_rcl.c +++ b/src/libserver/cfg_rcl.c @@ -3796,6 +3796,41 @@ rspamd_config_read (struct rspamd_config *cfg, } else { logger_fin (cfg->cfg_pool, logger_ud); } + + /* Init lua logging */ + lua_State *L = cfg->lua_state; + gint err_idx; + struct rspamd_config **pcfg; + + lua_pushcfunction (L, &rspamd_lua_traceback); + err_idx = lua_gettop (L); + + /* Obtain function */ + if (!rspamd_lua_require_function (L, "lua_util", + "init_debug_logging")) { + msg_err_config ("cannot require lua_util.init_debug_logging"); + lua_settop (L, err_idx - 1); + + return FALSE; + } + + pcfg = lua_newuserdata (L, sizeof (*pcfg)); + *pcfg = cfg; + rspamd_lua_setclass (L, "rspamd{config}", -1); + + if (lua_pcall (L, 1, 0, err_idx) != 0) { + GString *tb; + + tb = lua_touserdata (L, -1); + msg_err_config ("cannot call lua init_debug_logging script: %s", + tb->str); + g_string_free (tb, TRUE); + lua_settop (L, err_idx - 1); + + return FALSE; + } + + lua_settop (L, err_idx - 1); } HASH_DEL (top, logger_section); |