aboutsummaryrefslogtreecommitdiffstats
path: root/src/rspamadm
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-09-19 11:45:53 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-09-19 14:33:53 +0100
commita133eafedf5d2f117431896b98880a4850a6aced (patch)
treef126919bf2749962867e54d8c024357eab770760 /src/rspamadm
parent95df15919326182a588ed339733d71d74fc7a591 (diff)
downloadrspamd-a133eafedf5d2f117431896b98880a4850a6aced.tar.gz
rspamd-a133eafedf5d2f117431896b98880a4850a6aced.zip
[Feature] Add some recursion protection to lua logger
Diffstat (limited to 'src/rspamadm')
-rw-r--r--src/rspamadm/lua_repl.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/rspamadm/lua_repl.c b/src/rspamadm/lua_repl.c
index c6c5fd0bf..81dba946a 100644
--- a/src/rspamadm/lua_repl.c
+++ b/src/rspamadm/lua_repl.c
@@ -240,6 +240,7 @@ rspamadm_exec_input (lua_State *L, const gchar *input)
gint i, cbref;
int top = 0;
gchar outbuf[8192];
+ struct lua_logger_trace tr;
struct thread_entry *thread = lua_thread_pool_get_for_config (rspamd_main->cfg);
L = thread->lua_state;
@@ -279,7 +280,8 @@ rspamadm_exec_input (lua_State *L, const gchar *input)
rspamd_printf ("local function: %d\n", cbref);
} else {
- lua_logger_out_type (L, i, outbuf, sizeof (outbuf));
+ memset (&tr, 0, sizeof (tr));
+ lua_logger_out_type (L, i, outbuf, sizeof (outbuf), &tr);
rspamd_printf ("%s\n", outbuf);
}
}
@@ -396,6 +398,7 @@ rspamadm_lua_message_handler (lua_State *L, gint argc, gchar **argv)
gpointer map;
gsize len;
gchar outbuf[8192];
+ struct lua_logger_trace tr;
if (argv[1] == NULL) {
rspamd_printf ("no callback is specified\n");
@@ -457,7 +460,8 @@ rspamadm_lua_message_handler (lua_State *L, gint argc, gchar **argv)
rspamd_printf ("lua callback for %s returned:\n", argv[i]);
for (j = old_top + 1; j <= lua_gettop (L); j ++) {
- lua_logger_out_type (L, j, outbuf, sizeof (outbuf));
+ memset (&tr, 0, sizeof (tr));
+ lua_logger_out_type (L, j, outbuf, sizeof (outbuf), &tr);
rspamd_printf ("%s\n", outbuf);
}
}