aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-08-09 14:58:45 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-08-09 15:27:32 +0100
commitd595b6ef94b3b1e1412cda2232fa4627ac67926e (patch)
tree307095b2525ef166da2fed24b5d75e342f805696
parent084dc96bc564b814b7d8850958613cfae835dc77 (diff)
downloadrspamd-d595b6ef94b3b1e1412cda2232fa4627ac67926e.tar.gz
rspamd-d595b6ef94b3b1e1412cda2232fa4627ac67926e.zip
[Minor] Allow to get a trace function
-rw-r--r--src/lua/lua_common.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c
index 4faff8665..7d9e525bb 100644
--- a/src/lua/lua_common.c
+++ b/src/lua/lua_common.c
@@ -688,6 +688,21 @@ rspamd_lua_set_globals (struct rspamd_config *cfg, lua_State *L,
lua_settop (L, orig_top);
}
+#ifdef WITH_LUA_TRACE
+static gint
+lua_push_trace_data (lua_State *L)
+{
+ if (lua_traces) {
+ ucl_object_push_lua (L, lua_traces, true);
+ }
+ else {
+ lua_pushnil (L);
+ }
+
+ return 1;
+}
+#endif
+
lua_State *
rspamd_lua_init ()
{
@@ -783,6 +798,11 @@ rspamd_lua_init ()
#undef ADD_TABLE
lua_setglobal (L, rspamd_modules_state_global);
+#ifdef WITH_LUA_TRACE
+ lua_pushcfunction (L, lua_push_trace_data);
+ lua_setglobal (L, "get_traces");
+#endif
+
return L;
}