diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-04-29 14:52:25 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-04-29 14:52:25 +0100 |
commit | 18e95de8f1fb5f5d756d3bf4db168ad96cd5f954 (patch) | |
tree | cd9d6d2d20d7f1885b1a174c40e495b8e272f8ef /src/lua/lua_common.h | |
parent | 622bad3d8a52fc810070bb000025c642e5a0695f (diff) | |
download | rspamd-18e95de8f1fb5f5d756d3bf4db168ad96cd5f954.tar.gz rspamd-18e95de8f1fb5f5d756d3bf4db168ad96cd5f954.zip |
[Minor] Improve lua logging escaping
Diffstat (limited to 'src/lua/lua_common.h')
-rw-r--r-- | src/lua/lua_common.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/lua/lua_common.h b/src/lua/lua_common.h index d9bbff585..5ff5cc8bf 100644 --- a/src/lua/lua_common.h +++ b/src/lua/lua_common.h @@ -365,6 +365,16 @@ struct lua_logger_trace { gconstpointer traces[TRACE_POINTS]; }; +enum lua_logger_escape_type { + LUA_ESCAPE_NONE = (0u), + LUA_ESCAPE_UNPRINTABLE = (1u << 0u), + LUA_ESCAPE_NEWLINES = (1u << 1u), + LUA_ESCAPE_8BIT = (1u << 2u), +}; + +#define LUA_ESCAPE_LOG (LUA_ESCAPE_UNPRINTABLE|LUA_ESCAPE_NEWLINES) +#define LUA_ESCAPE_ALL (LUA_ESCAPE_UNPRINTABLE|LUA_ESCAPE_NEWLINES|LUA_ESCAPE_8BIT) + /** * Log lua object to string * @param L @@ -374,7 +384,8 @@ struct lua_logger_trace { * @return */ gsize lua_logger_out_type (lua_State *L, gint pos, gchar *outbuf, - gsize len, struct lua_logger_trace *trace); + gsize len, struct lua_logger_trace *trace, + enum lua_logger_escape_type esc_type); /** * Safely checks userdata to match specified class |