summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-08-09 14:27:33 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-08-09 15:27:32 +0100
commit084dc96bc564b814b7d8850958613cfae835dc77 (patch)
treea33bbbb6dac6c4277389478b154f2b4306eacb34
parent0ebcb5c9fb90363a2afff95f3f1af827fcf9b287 (diff)
downloadrspamd-084dc96bc564b814b7d8850958613cfae835dc77.tar.gz
rspamd-084dc96bc564b814b7d8850958613cfae835dc77.zip
[Feature] Add support for Lua API tracing
-rw-r--r--CMakeLists.txt5
-rw-r--r--config.h.in1
-rw-r--r--src/lua/lua_common.c4
-rw-r--r--src/lua/lua_common.h16
-rw-r--r--src/lua/lua_config.c53
-rw-r--r--src/lua/lua_cryptobox.c36
-rw-r--r--src/lua/lua_dns.c1
-rw-r--r--src/lua/lua_expression.c5
-rw-r--r--src/lua/lua_html.c13
-rw-r--r--src/lua/lua_http.c1
-rw-r--r--src/lua/lua_ip.c13
-rw-r--r--src/lua/lua_logger.c11
-rw-r--r--src/lua/lua_map.c17
-rw-r--r--src/lua/lua_mempool.c10
-rw-r--r--src/lua/lua_mimepart.c42
-rw-r--r--src/lua/lua_redis.c6
-rw-r--r--src/lua/lua_regexp.c13
-rw-r--r--src/lua/lua_sqlite3.c4
-rw-r--r--src/lua/lua_task.c110
-rw-r--r--src/lua/lua_tcp.c6
-rw-r--r--src/lua/lua_trie.c4
-rw-r--r--src/lua/lua_upstream.c9
-rw-r--r--src/lua/lua_url.c24
-rw-r--r--src/lua/lua_util.c50
-rw-r--r--src/lua/lua_xmlrpc.c2
25 files changed, 454 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 80aad7f69..e81368296 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -63,6 +63,7 @@ OPTION(ENABLE_FULL_DEBUG "Build rspamd with all possible debug [default: OFF]"
OPTION(ENABLE_UTILS "Build rspamd internal utils [default: OFF]" OFF)
OPTION(ENABLE_TORCH "Install torch7 with Rspamd [default: ON]" ON)
OPTION(ENABLE_LIBUNWIND "Use libunwind to print crash traces [default: OFF]" OFF)
+OPTION(ENABLE_LUA_TRACE "Trace all Lua C API invocations [default: OFF]" OFF)
INCLUDE(FindArch.cmake)
TARGET_ARCHITECTURE(ARCH)
@@ -845,6 +846,10 @@ IF(ENABLE_COVERAGE)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
ENDIF(ENABLE_COVERAGE)
+IF(ENABLE_LUA_TRACE)
+ SET(WITH_LUA_TRACE 1)
+ENDIF(ENABLE_LUA_TRACE)
+
SET(CMAKE_C_FLAGS "${CMAKE_C_OPT_FLAGS} ${CMAKE_C_FLAGS} ${CMAKE_C_WARN_FLAGS}")
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
diff --git a/config.h.in b/config.h.in
index d6a6a2cbe..1e9aab7bd 100644
--- a/config.h.in
+++ b/config.h.in
@@ -144,6 +144,7 @@
#cmakedefine WITH_SYSTEM_HIREDIS 1
#cmakedefine WITH_TORCH 1
#cmakedefine WITH_LIBUNWIND 1
+#cmakedefine WITH_LUA_TRACE 1
#cmakedefine DISABLE_PTHREAD_MUTEX 1
diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c
index 323957086..4faff8665 100644
--- a/src/lua/lua_common.c
+++ b/src/lua/lua_common.c
@@ -27,6 +27,10 @@
/* Lua module init function */
#define MODULE_INIT_FUNC "module_init"
+#ifdef WITH_LUA_TRACE
+ucl_object_t *lua_traces;
+#endif
+
const luaL_reg null_reg[] = {
{"__tostring", rspamd_lua_class_tostring},
{NULL, NULL}
diff --git a/src/lua/lua_common.h b/src/lua/lua_common.h
index 838e0fe7a..45baa5549 100644
--- a/src/lua/lua_common.h
+++ b/src/lua/lua_common.h
@@ -420,5 +420,21 @@ gboolean rspamd_lua_require_function (lua_State *L, const gchar *modname,
#define RSPAMD_PREFIX_INDEX "PREFIX"
#define RSPAMD_VERSION_INDEX "VERSION"
+#ifdef WITH_LUA_TRACE
+extern ucl_object_t *lua_traces;
+#define LUA_TRACE_POINT do { \
+ ucl_object_t *func_obj; \
+ if (lua_traces == NULL) { lua_traces = ucl_object_typed_new (UCL_OBJECT); } \
+ func_obj = (ucl_object_t *)ucl_object_lookup (lua_traces, G_STRFUNC); \
+ if (func_obj == NULL) { \
+ func_obj = ucl_object_typed_new (UCL_INT); \
+ ucl_object_insert_key (lua_traces, func_obj, G_STRFUNC, 0, false); \
+ } \
+ func_obj->value.iv ++; \
+} while(0)
+#else
+#define LUA_TRACE_POINT
+#endif
+
#endif /* WITH_LUA */
#endif /* RSPAMD_LUA_H */
diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c
index 2093cbe01..d7af3956f 100644
--- a/src/lua/lua_config.c
+++ b/src/lua/lua_config.c
@@ -841,6 +841,7 @@ lua_config_get_api_version (lua_State *L)
static gint
lua_config_get_module_opt (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *mname, *optname;
const ucl_object_t *obj;
@@ -863,6 +864,7 @@ lua_config_get_module_opt (lua_State * L)
static int
lua_config_get_mempool (lua_State * L)
{
+ LUA_TRACE_POINT;
rspamd_mempool_t **ppool;
struct rspamd_config *cfg = lua_check_config (L, 1);
@@ -880,6 +882,7 @@ lua_config_get_mempool (lua_State * L)
static int
lua_config_get_resolver (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_dns_resolver **pres;
struct rspamd_config *cfg = lua_check_config (L, 1);
@@ -898,6 +901,7 @@ lua_config_get_resolver (lua_State * L)
static gint
lua_config_get_all_opt (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *mname;
const ucl_object_t *obj, *cur, *cur_elt;
@@ -965,6 +969,7 @@ lua_config_ucl_dtor (gpointer p)
static gint
lua_config_get_ucl (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
struct rspamd_lua_cached_config *cached;
@@ -995,6 +1000,7 @@ lua_config_get_ucl (lua_State * L)
static gint
lua_config_get_classifier (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
struct rspamd_classifier_config *clc = NULL, **pclc = NULL;
const gchar *name;
@@ -1432,6 +1438,7 @@ rspamd_register_symbol_fromlua (lua_State *L,
static gint
lua_config_register_post_filter (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
gint order = 0, cbref, ret;
@@ -1476,6 +1483,7 @@ lua_config_register_post_filter (lua_State *L)
static gint
lua_config_register_pre_filter (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
gint order = 0, cbref, ret;
@@ -1520,6 +1528,7 @@ lua_config_register_pre_filter (lua_State *L)
static gint
lua_config_get_key (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *name;
size_t namelen;
@@ -1630,6 +1639,7 @@ lua_parse_symbol_type (const gchar *str)
static gint
lua_config_register_symbol (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *name = NULL, *flags_str = NULL, *type_str = NULL,
*description = NULL, *group = NULL;
@@ -1733,6 +1743,7 @@ lua_config_register_symbol (lua_State * L)
static gint
lua_config_register_symbols (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
gint i, top, idx, ret = -1;
const gchar *sym;
@@ -1806,6 +1817,7 @@ lua_config_register_symbols (lua_State *L)
static gint
lua_config_register_virtual_symbol (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *name;
double weight;
@@ -1834,6 +1846,7 @@ lua_config_register_virtual_symbol (lua_State * L)
static gint
lua_config_register_callback_symbol (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *name = NULL;
double weight;
@@ -1874,6 +1887,7 @@ lua_config_register_callback_symbol (lua_State * L)
static gint
lua_config_register_callback_symbol_priority (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *name = NULL;
double weight;
@@ -1952,6 +1966,7 @@ rspamd_lua_squeeze_dependency (lua_State *L, struct rspamd_config *cfg,
static gint
lua_config_register_dependency (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *parent = NULL, *child = NULL;
gint child_id;
@@ -2008,6 +2023,7 @@ lua_config_register_dependency (lua_State * L)
static gint
lua_config_set_metric_symbol (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *description = NULL,
*group = NULL, *name = NULL, *flags_str = NULL;
@@ -2107,6 +2123,7 @@ lua_config_set_metric_symbol (lua_State * L)
static gint
lua_config_get_metric_symbol (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *sym_name = luaL_checkstring (L, 2);
struct rspamd_symbol *sym_def;
@@ -2158,6 +2175,7 @@ lua_config_get_metric_symbol (lua_State * L)
static gint
lua_config_set_metric_action (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *name = NULL;
double weight;
@@ -2196,6 +2214,7 @@ lua_config_set_metric_action (lua_State * L)
static gint
lua_config_get_metric_action (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *act_name = luaL_checkstring (L, 2);
gint act = 0;
@@ -2223,6 +2242,7 @@ lua_config_get_metric_action (lua_State * L)
static gint
lua_config_get_all_actions (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
gint act = 0;
@@ -2247,6 +2267,7 @@ lua_config_get_all_actions (lua_State * L)
static gint
lua_config_add_composite (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
struct rspamd_expression *expr;
gchar *name;
@@ -2302,6 +2323,7 @@ lua_config_add_composite (lua_State * L)
static gint
lua_config_newindex (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *name;
gint id, nshots;
@@ -2530,6 +2552,7 @@ lua_config_newindex (lua_State *L)
static gint
lua_config_add_condition (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *sym = luaL_checkstring (L, 2);
gboolean ret = FALSE;
@@ -2554,6 +2577,7 @@ lua_config_add_condition (lua_State *L)
static gint
lua_config_set_peak_cb (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
gint condref;
@@ -2570,6 +2594,7 @@ lua_config_set_peak_cb (lua_State *L)
static gint
lua_config_enable_symbol (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *sym = luaL_checkstring (L, 2);
@@ -2586,6 +2611,7 @@ lua_config_enable_symbol (lua_State *L)
static gint
lua_config_disable_symbol (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *sym = luaL_checkstring (L, 2);
@@ -2602,6 +2628,7 @@ lua_config_disable_symbol (lua_State *L)
static gint
lua_config_register_regexp (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
struct rspamd_lua_regexp *re = NULL;
rspamd_regexp_t *cache_re;
@@ -2685,6 +2712,7 @@ lua_config_register_regexp (lua_State *L)
static gint
lua_config_replace_regexp (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
struct rspamd_lua_regexp *old_re = NULL, *new_re = NULL;
GError *err = NULL;
@@ -2710,6 +2738,7 @@ lua_config_replace_regexp (lua_State *L)
static gint
lua_config_register_worker_script (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *worker_type = luaL_checkstring (L, 2), *wtype;
struct rspamd_worker_conf *cf;
@@ -2742,6 +2771,7 @@ lua_config_register_worker_script (lua_State *L)
static gint
lua_config_add_on_load (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
struct rspamd_config_post_load_script *sc;
@@ -2831,6 +2861,7 @@ lua_periodic_callback (gint unused_fd, short what, gpointer ud)
static gint
lua_config_add_periodic (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
struct event_base *ev_base = lua_check_ev_base (L, 2);
gdouble timeout = lua_tonumber (L, 3);
@@ -2870,6 +2901,7 @@ lua_config_add_periodic (lua_State *L)
static gint
lua_config_get_symbols_count (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
guint res = 0;
@@ -2888,6 +2920,7 @@ lua_config_get_symbols_count (lua_State *L)
static gint
lua_config_get_symbols_cksum (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
guint64 res = 0, *pres;
@@ -2908,6 +2941,7 @@ lua_config_get_symbols_cksum (lua_State *L)
static gint
lua_config_get_symbols_counters (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
ucl_object_t *counters;
@@ -2945,6 +2979,7 @@ lua_metric_symbol_inserter (gpointer k, gpointer v, gpointer ud)
static gint
lua_config_get_symbols_scores (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
if (cfg != NULL) {
@@ -2964,6 +2999,7 @@ lua_config_get_symbols_scores (lua_State *L)
static gint
lua_config_get_symbol_callback (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *sym = luaL_checkstring (L, 2);
struct rspamd_abstract_callback_data *abs_cbdata;
@@ -2996,6 +3032,7 @@ lua_config_get_symbol_callback (lua_State *L)
static gint
lua_config_set_symbol_callback (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *sym = luaL_checkstring (L, 2);
struct rspamd_abstract_callback_data *abs_cbdata;
@@ -3032,6 +3069,7 @@ lua_config_set_symbol_callback (lua_State *L)
static gint
lua_config_get_symbol_stat (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *sym = luaL_checkstring (L, 2);
gdouble freq, stddev, tm;
@@ -3069,6 +3107,7 @@ lua_config_get_symbol_stat (lua_State *L)
static gint
lua_config_register_finish_script (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
struct rspamd_config_post_load_script *sc;
@@ -3088,6 +3127,7 @@ lua_config_register_finish_script (lua_State *L)
static gint
lua_config_register_monitored (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
struct rspamd_monitored *m, **pm;
const gchar *url, *type;
@@ -3139,6 +3179,7 @@ lua_config_register_monitored (lua_State *L)
static gint
lua_config_add_doc (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg;
const gchar *path = NULL, *option, *doc_string;
const gchar *type_str = NULL, *default_value = NULL;
@@ -3187,6 +3228,7 @@ lua_config_add_doc (lua_State *L)
static gint
lua_config_add_example (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg;
const gchar *path = NULL, *option, *doc_string, *example;
gsize example_len;
@@ -3216,6 +3258,7 @@ lua_config_add_example (lua_State *L)
static gint
lua_config_get_cpu_flags (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
struct rspamd_cryptobox_library_ctx *crypto_ctx;
@@ -3269,6 +3312,7 @@ lua_config_get_cpu_flags (lua_State *L)
static gint
lua_config_has_torch (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
struct rspamd_cryptobox_library_ctx *crypto_ctx;
@@ -3296,6 +3340,7 @@ lua_config_has_torch (lua_State *L)
static gint
lua_config_experimental_enabled (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
if (cfg != NULL) {
@@ -3378,6 +3423,7 @@ lua_config_load_ucl (lua_State *L)
static gint
lua_config_parse_rcl (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
GHashTable *excluded = g_hash_table_new_full (rspamd_str_hash, rspamd_str_equal,
g_free, NULL);
@@ -3422,6 +3468,7 @@ lua_config_parse_rcl (lua_State *L)
static gint
lua_config_init_modules (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
if (cfg != NULL) {
@@ -3438,6 +3485,7 @@ lua_config_init_modules (lua_State *L)
static gint
lua_config_init_subsystem (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *subsystem = luaL_checkstring (L, 2);
gchar **parts;
@@ -3473,6 +3521,7 @@ lua_config_init_subsystem (lua_State *L)
static gint
lua_config_get_tld_path (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
if (cfg != NULL) {
@@ -3488,6 +3537,7 @@ lua_config_get_tld_path (lua_State *L)
static gint
lua_monitored_alive (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_monitored *m = lua_check_monitored (L, 1);
if (m) {
@@ -3503,6 +3553,7 @@ lua_monitored_alive (lua_State *L)
static gint
lua_monitored_offline (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_monitored *m = lua_check_monitored (L, 1);
if (m) {
@@ -3518,6 +3569,7 @@ lua_monitored_offline (lua_State *L)
static gint
lua_monitored_total_offline (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_monitored *m = lua_check_monitored (L, 1);
if (m) {
@@ -3533,6 +3585,7 @@ lua_monitored_total_offline (lua_State *L)
static gint
lua_monitored_latency (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_monitored *m = lua_check_monitored (L, 1);
if (m) {
diff --git a/src/lua/lua_cryptobox.c b/src/lua/lua_cryptobox.c
index 5f4908adf..cda4912de 100644
--- a/src/lua/lua_cryptobox.c
+++ b/src/lua/lua_cryptobox.c
@@ -203,6 +203,7 @@ lua_check_cryptobox_hash (lua_State * L, int pos)
static gint
lua_cryptobox_pubkey_load (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_cryptobox_pubkey *pkey = NULL, **ppkey;
const gchar *filename, *arg;
gint type = RSPAMD_KEYPAIR_SIGN;
@@ -278,6 +279,7 @@ lua_cryptobox_pubkey_load (lua_State *L)
static gint
lua_cryptobox_pubkey_create (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_cryptobox_pubkey *pkey = NULL, **ppkey;
const gchar *buf, *arg;
gsize len;
@@ -332,6 +334,7 @@ lua_cryptobox_pubkey_create (lua_State *L)
static gint
lua_cryptobox_pubkey_gc (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_cryptobox_pubkey *pkey = lua_check_cryptobox_pubkey (L, 1);
if (pkey != NULL) {
@@ -350,6 +353,7 @@ lua_cryptobox_pubkey_gc (lua_State *L)
static gint
lua_cryptobox_keypair_load (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_cryptobox_keypair *kp, **pkp;
const gchar *buf;
gsize len;
@@ -420,6 +424,7 @@ lua_cryptobox_keypair_load (lua_State *L)
static gint
lua_cryptobox_keypair_create (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_cryptobox_keypair *kp, **pkp;
enum rspamd_cryptobox_keypair_type type = RSPAMD_KEYPAIR_KEX;
enum rspamd_cryptobox_mode alg = RSPAMD_CRYPTOBOX_MODE_25519;
@@ -464,6 +469,7 @@ lua_cryptobox_keypair_create (lua_State *L)
static gint
lua_cryptobox_keypair_gc (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_cryptobox_keypair *kp = lua_check_cryptobox_keypair (L, 1);
if (kp != NULL) {
@@ -480,6 +486,7 @@ lua_cryptobox_keypair_gc (lua_State *L)
static gint
lua_cryptobox_keypair_totable (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_cryptobox_keypair *kp = lua_check_cryptobox_keypair (L, 1);
ucl_object_t *obj;
gboolean hex = FALSE;
@@ -510,6 +517,7 @@ lua_cryptobox_keypair_totable (lua_State *L)
static gint
lua_cryptobox_keypair_get_type (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_cryptobox_keypair *kp = lua_check_cryptobox_keypair (L, 1);
if (kp) {
@@ -535,6 +543,7 @@ lua_cryptobox_keypair_get_type (lua_State *L)
static gint
lua_cryptobox_keypair_get_alg (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_cryptobox_keypair *kp = lua_check_cryptobox_keypair (L, 1);
if (kp) {
@@ -560,6 +569,7 @@ lua_cryptobox_keypair_get_alg (lua_State *L)
static gint
lua_cryptobox_keypair_get_pk (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_cryptobox_keypair *kp = lua_check_cryptobox_keypair (L, 1);
struct rspamd_cryptobox_pubkey *pk, **ppk;
const guchar *data;
@@ -593,6 +603,7 @@ lua_cryptobox_keypair_get_pk (lua_State *L)
static gint
lua_cryptobox_signature_load (lua_State *L)
{
+ LUA_TRACE_POINT;
rspamd_fstring_t *sig, **psig;
const gchar *filename;
gpointer data;
@@ -664,6 +675,7 @@ lua_cryptobox_signature_load (lua_State *L)
static gint
lua_cryptobox_signature_save (lua_State *L)
{
+ LUA_TRACE_POINT;
rspamd_fstring_t *sig;
gint fd, flags;
const gchar *filename;
@@ -727,6 +739,7 @@ lua_cryptobox_signature_save (lua_State *L)
static gint
lua_cryptobox_signature_create (lua_State *L)
{
+ LUA_TRACE_POINT;
rspamd_fstring_t *sig, **psig;
struct rspamd_lua_text *t;
const gchar *data;
@@ -769,6 +782,7 @@ lua_cryptobox_signature_create (lua_State *L)
static gint
lua_cryptobox_signature_hex (lua_State *L)
{
+ LUA_TRACE_POINT;
rspamd_fstring_t *sig = lua_check_cryptobox_sign (L, 1);
gchar *encoded;
@@ -792,6 +806,7 @@ lua_cryptobox_signature_hex (lua_State *L)
static gint
lua_cryptobox_signature_base32 (lua_State *L)
{
+ LUA_TRACE_POINT;
rspamd_fstring_t *sig = lua_check_cryptobox_sign (L, 1);
gchar *encoded;
@@ -815,6 +830,7 @@ lua_cryptobox_signature_base32 (lua_State *L)
static gint
lua_cryptobox_signature_base64 (lua_State *L)
{
+ LUA_TRACE_POINT;
rspamd_fstring_t *sig = lua_check_cryptobox_sign (L, 1);
gsize dlen;
gchar *encoded;
@@ -839,6 +855,7 @@ lua_cryptobox_signature_base64 (lua_State *L)
static gint
lua_cryptobox_signature_bin (lua_State *L)
{
+ LUA_TRACE_POINT;
rspamd_fstring_t *sig = lua_check_cryptobox_sign (L, 1);
if (sig) {
@@ -854,6 +871,7 @@ lua_cryptobox_signature_bin (lua_State *L)
static gint
lua_cryptobox_signature_gc (lua_State *L)
{
+ LUA_TRACE_POINT;
rspamd_fstring_t *sig = lua_check_cryptobox_sign (L, 1);
rspamd_fstring_free (sig);
@@ -937,6 +955,7 @@ ret:
static gint
lua_cryptobox_hash_create (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_cryptobox_hash *h, **ph;
const gchar *s = NULL;
struct rspamd_lua_text *t;
@@ -979,6 +998,7 @@ lua_cryptobox_hash_create (lua_State *L)
static gint
lua_cryptobox_hash_create_specific (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_cryptobox_hash *h, **ph;
const gchar *s = NULL, *type = luaL_checkstring (L, 1);
gsize len = 0;
@@ -1024,6 +1044,7 @@ lua_cryptobox_hash_create_specific (lua_State *L)
static gint
lua_cryptobox_hash_create_keyed (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_cryptobox_hash *h, **ph;
const gchar *key, *s = NULL;
struct rspamd_lua_text *t;
@@ -1073,6 +1094,7 @@ lua_cryptobox_hash_create_keyed (lua_State *L)
static gint
lua_cryptobox_hash_update (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_cryptobox_hash *h = lua_check_cryptobox_hash (L, 1);
const gchar *data;
struct rspamd_lua_text *t;
@@ -1120,6 +1142,7 @@ lua_cryptobox_hash_update (lua_State *L)
static gint
lua_cryptobox_hash_reset (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_cryptobox_hash *h = lua_check_cryptobox_hash (L, 1);
if (h) {
@@ -1147,6 +1170,7 @@ lua_cryptobox_hash_reset (lua_State *L)
static gint
lua_cryptobox_hash_hex (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_cryptobox_hash *h = lua_check_cryptobox_hash (L, 1);
guchar out[rspamd_cryptobox_HASHBYTES],
out_hex[rspamd_cryptobox_HASHBYTES * 2 + 1];
@@ -1183,6 +1207,7 @@ lua_cryptobox_hash_hex (lua_State *L)
static gint
lua_cryptobox_hash_base32 (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_cryptobox_hash *h = lua_check_cryptobox_hash (L, 1);
guchar out[rspamd_cryptobox_HASHBYTES],
out_b32[rspamd_cryptobox_HASHBYTES * 2];
@@ -1218,6 +1243,7 @@ lua_cryptobox_hash_base32 (lua_State *L)
static gint
lua_cryptobox_hash_base64 (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_cryptobox_hash *h = lua_check_cryptobox_hash (L, 1);
guchar out[rspamd_cryptobox_HASHBYTES], *b64;
gsize len;
@@ -1253,6 +1279,7 @@ lua_cryptobox_hash_base64 (lua_State *L)
static gint
lua_cryptobox_hash_bin (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_cryptobox_hash *h = lua_check_cryptobox_hash (L, 1);
guchar out[rspamd_cryptobox_HASHBYTES];
guint dlen;
@@ -1280,6 +1307,7 @@ lua_cryptobox_hash_bin (lua_State *L)
static gint
lua_cryptobox_hash_gc (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_cryptobox_hash *h = lua_check_cryptobox_hash (L, 1);
if (h->is_ssl) {
@@ -1311,6 +1339,7 @@ lua_cryptobox_hash_gc (lua_State *L)
static gint
lua_cryptobox_verify_memory (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_cryptobox_pubkey *pk;
rspamd_fstring_t *signature;
struct rspamd_lua_text *t;
@@ -1379,6 +1408,7 @@ lua_cryptobox_verify_memory (lua_State *L)
static gint
lua_cryptobox_verify_file (lua_State *L)
{
+ LUA_TRACE_POINT;
const gchar *fname;
struct rspamd_cryptobox_pubkey *pk;
rspamd_fstring_t *signature;
@@ -1444,6 +1474,7 @@ lua_cryptobox_verify_file (lua_State *L)
static gint
lua_cryptobox_sign_memory (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_cryptobox_keypair *kp;
const gchar *data;
struct rspamd_lua_text *t;
@@ -1494,6 +1525,7 @@ lua_cryptobox_sign_memory (lua_State *L)
static gint
lua_cryptobox_sign_file (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_cryptobox_keypair *kp;
const gchar *filename;
gchar *data;
@@ -1539,6 +1571,7 @@ lua_cryptobox_sign_file (lua_State *L)
static gint
lua_cryptobox_encrypt_memory (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_cryptobox_keypair *kp = NULL;
struct rspamd_cryptobox_pubkey *pk = NULL;
const gchar *data;
@@ -1620,6 +1653,7 @@ lua_cryptobox_encrypt_memory (lua_State *L)
static gint
lua_cryptobox_encrypt_file (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_cryptobox_keypair *kp = NULL;
struct rspamd_cryptobox_pubkey *pk = NULL;
const gchar *filename;
@@ -1695,6 +1729,7 @@ lua_cryptobox_encrypt_file (lua_State *L)
static gint
lua_cryptobox_decrypt_memory (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_cryptobox_keypair *kp;
const gchar *data;
guchar *out;
@@ -1750,6 +1785,7 @@ lua_cryptobox_decrypt_memory (lua_State *L)
static gint
lua_cryptobox_decrypt_file (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_cryptobox_keypair *kp;
const gchar *filename;
gchar *data;
diff --git a/src/lua/lua_dns.c b/src/lua/lua_dns.c
index cc709ddaf..f6ba88f2e 100644
--- a/src/lua/lua_dns.c
+++ b/src/lua/lua_dns.c
@@ -294,6 +294,7 @@ lua_dns_resolver_resolve_common (lua_State *L,
enum rdns_request_type type,
int first)
{
+ LUA_TRACE_POINT;
struct rspamd_async_session *session = NULL;
rspamd_mempool_t *pool = NULL;
const gchar *to_resolve = NULL, *user_str = NULL;
diff --git a/src/lua/lua_expression.c b/src/lua/lua_expression.c
index 7975cc227..03a667b8d 100644
--- a/src/lua/lua_expression.c
+++ b/src/lua/lua_expression.c
@@ -190,6 +190,7 @@ lua_atom_process (gpointer input, rspamd_expression_atom_t *atom)
static gint
lua_expr_process (lua_State *L)
{
+ LUA_TRACE_POINT;
struct lua_expression *e = rspamd_lua_expression (L, 1);
gdouble res;
gint flags = 0;
@@ -208,6 +209,7 @@ lua_expr_process (lua_State *L)
static gint
lua_expr_process_traced (lua_State *L)
{
+ LUA_TRACE_POINT;
struct lua_expression *e = rspamd_lua_expression (L, 1);
rspamd_expression_atom_t *atom;
gint res;
@@ -242,6 +244,7 @@ lua_expr_process_traced (lua_State *L)
static gint
lua_expr_create (lua_State *L)
{
+ LUA_TRACE_POINT;
struct lua_expression *e, **pe;
const char *line;
gsize len;
@@ -323,6 +326,7 @@ lua_expr_create (lua_State *L)
static gint
lua_expr_to_string (lua_State *L)
{
+ LUA_TRACE_POINT;
struct lua_expression *e = rspamd_lua_expression (L, 1);
GString *str;
@@ -360,6 +364,7 @@ lua_exr_atom_cb (const rspamd_ftok_t *tok, gpointer ud)
static gint
lua_expr_atoms (lua_State *L)
{
+ LUA_TRACE_POINT;
struct lua_expression *e = rspamd_lua_expression (L, 1);
struct lua_expr_atoms_cbdata cbdata;
diff --git a/src/lua/lua_html.c b/src/lua/lua_html.c
index dc058745c..c79fb33fd 100644
--- a/src/lua/lua_html.c
+++ b/src/lua/lua_html.c
@@ -197,6 +197,7 @@ lua_check_html_tag (lua_State * L, gint pos)
static gint
lua_html_has_tag (lua_State *L)
{
+ LUA_TRACE_POINT;
struct html_content *hc = lua_check_html (L, 1);
const gchar *tagname = luaL_checkstring (L, 2);
gboolean ret = FALSE;
@@ -215,6 +216,7 @@ lua_html_has_tag (lua_State *L)
static gint
lua_html_has_property (lua_State *L)
{
+ LUA_TRACE_POINT;
struct html_content *hc = lua_check_html (L, 1);
const gchar *propname = luaL_checkstring (L, 2);
gboolean ret = FALSE;
@@ -256,6 +258,7 @@ lua_html_has_property (lua_State *L)
static void
lua_html_push_image (lua_State *L, struct html_image *img)
{
+ LUA_TRACE_POINT;
struct html_tag **ptag;
lua_newtable (L);
@@ -288,6 +291,7 @@ lua_html_push_image (lua_State *L, struct html_image *img)
static gint
lua_html_get_images (lua_State *L)
{
+ LUA_TRACE_POINT;
struct html_content *hc = lua_check_html (L, 1);
struct html_image *img;
@@ -317,6 +321,7 @@ lua_html_get_images (lua_State *L)
static void
lua_html_push_block (lua_State *L, struct html_block *bl)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_text *t;
lua_createtable (L, 0, 6);
@@ -376,6 +381,7 @@ lua_html_push_block (lua_State *L, struct html_block *bl)
static gint
lua_html_get_blocks (lua_State *L)
{
+ LUA_TRACE_POINT;
struct html_content *hc = lua_check_html (L, 1);
struct html_block *bl;
@@ -445,6 +451,7 @@ lua_html_node_foreach_cb (GNode *n, gpointer d)
static gint
lua_html_foreach_tag (lua_State *L)
{
+ LUA_TRACE_POINT;
struct html_content *hc = lua_check_html (L, 1);
struct lua_html_traverse_ud ud;
const gchar *tagname;
@@ -518,6 +525,7 @@ lua_html_foreach_tag (lua_State *L)
static gint
lua_html_tag_get_type (lua_State *L)
{
+ LUA_TRACE_POINT;
struct html_tag *tag = lua_check_html_tag (L, 1);
const gchar *tagname;
@@ -541,6 +549,7 @@ lua_html_tag_get_type (lua_State *L)
static gint
lua_html_tag_get_parent (lua_State *L)
{
+ LUA_TRACE_POINT;
struct html_tag *tag = lua_check_html_tag (L, 1), **ptag;
GNode *node;
@@ -563,6 +572,7 @@ lua_html_tag_get_parent (lua_State *L)
static gint
lua_html_tag_get_flags (lua_State *L)
{
+ LUA_TRACE_POINT;
struct html_tag *tag = lua_check_html_tag (L, 1);
gint i = 1;
@@ -600,6 +610,7 @@ lua_html_tag_get_flags (lua_State *L)
static gint
lua_html_tag_get_content (lua_State *L)
{
+ LUA_TRACE_POINT;
struct html_tag *tag = lua_check_html_tag (L, 1);
struct rspamd_lua_text *t;
@@ -625,6 +636,7 @@ lua_html_tag_get_content (lua_State *L)
static gint
lua_html_tag_get_content_length (lua_State *L)
{
+ LUA_TRACE_POINT;
struct html_tag *tag = lua_check_html_tag (L, 1);
if (tag) {
@@ -640,6 +652,7 @@ lua_html_tag_get_content_length (lua_State *L)
static gint
lua_html_tag_get_extra (lua_State *L)
{
+ LUA_TRACE_POINT;
struct html_tag *tag = lua_check_html_tag (L, 1);
struct html_image *img;
struct rspamd_url **purl;
diff --git a/src/lua/lua_http.c b/src/lua/lua_http.c
index b3d4350f5..cbf30a07c 100644
--- a/src/lua/lua_http.c
+++ b/src/lua/lua_http.c
@@ -372,6 +372,7 @@ lua_http_push_headers (lua_State *L, struct rspamd_http_message *msg)
static gint
lua_http_request (lua_State *L)
{
+ LUA_TRACE_POINT;
struct event_base *ev_base;
struct rspamd_http_message *msg;
struct lua_http_cbdata *cbd;
diff --git a/src/lua/lua_ip.c b/src/lua/lua_ip.c
index b0f17e5c3..dc6271e7e 100644
--- a/src/lua/lua_ip.c
+++ b/src/lua/lua_ip.c
@@ -219,6 +219,7 @@ lua_check_ip (lua_State * L, gint pos)
static gint
lua_ip_to_table (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_ip *ip = lua_check_ip (L, 1);
guint max, i;
guint8 *ptr;
@@ -242,6 +243,7 @@ lua_ip_to_table (lua_State *L)
static gint
lua_ip_str_octets (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_ip *ip = lua_check_ip (L, 1);
guint max, i;
guint8 *ptr;
@@ -282,6 +284,7 @@ lua_ip_str_octets (lua_State *L)
static gint
lua_ip_inversed_str_octets (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_ip *ip = lua_check_ip (L, 1);
guint max, i;
guint8 *ptr;
@@ -323,6 +326,7 @@ lua_ip_inversed_str_octets (lua_State *L)
static gint
lua_ip_to_string (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_ip *ip = lua_check_ip (L, 1);
if (ip != NULL && ip->addr) {
@@ -343,6 +347,7 @@ lua_ip_to_string (lua_State *L)
static gint
lua_ip_get_port (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_ip *ip = lua_check_ip (L, 1);
if (ip != NULL && ip->addr) {
@@ -358,6 +363,7 @@ lua_ip_get_port (lua_State *L)
static gint
lua_ip_from_string (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_ip *ip;
const gchar *ip_str;
@@ -380,6 +386,7 @@ lua_ip_from_string (lua_State *L)
static gint
lua_ip_to_number (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_ip *ip = lua_check_ip (L, 1);
guint32 c;
guint max, i;
@@ -406,6 +413,7 @@ lua_ip_to_number (lua_State *L)
static gint
lua_ip_destroy (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_ip *ip = lua_check_ip (L, 1);
if (ip) {
@@ -421,6 +429,7 @@ lua_ip_destroy (lua_State *L)
static gint
lua_ip_get_version (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_ip *ip = lua_check_ip (L, 1);
if (ip && ip->addr) {
@@ -437,6 +446,7 @@ lua_ip_get_version (lua_State *L)
static gint
lua_ip_is_valid (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_ip *ip = lua_check_ip (L, 1);
if (ip) {
@@ -452,6 +462,7 @@ lua_ip_is_valid (lua_State *L)
static gint
lua_ip_apply_mask (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_ip *ip = lua_check_ip (L, 1), *nip;
gint mask;
@@ -470,6 +481,7 @@ lua_ip_apply_mask (lua_State *L)
static gint
lua_ip_equal (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_ip *ip1 = lua_check_ip (L, 1),
*ip2 = lua_check_ip (L, 2);
gboolean res = FALSE;
@@ -486,6 +498,7 @@ lua_ip_equal (lua_State *L)
static gint
lua_ip_copy (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_ip *ip = lua_check_ip (L, 1);
if (ip) {
diff --git a/src/lua/lua_logger.c b/src/lua/lua_logger.c
index a1297563b..e3fefe875 100644
--- a/src/lua/lua_logger.c
+++ b/src/lua/lua_logger.c
@@ -229,6 +229,7 @@ lua_common_log_line (GLogLevelFlags level, lua_State *L,
static gint
lua_logger_err (lua_State *L)
{
+ LUA_TRACE_POINT;
const gchar *msg;
msg = luaL_checkstring (L, 1);
lua_common_log_line (G_LOG_LEVEL_CRITICAL, L, msg, NULL, NULL);
@@ -238,6 +239,7 @@ lua_logger_err (lua_State *L)
static gint
lua_logger_warn (lua_State *L)
{
+ LUA_TRACE_POINT;
const gchar *msg;
msg = luaL_checkstring (L, 1);
lua_common_log_line (G_LOG_LEVEL_WARNING, L, msg, NULL, NULL);
@@ -247,6 +249,7 @@ lua_logger_warn (lua_State *L)
static gint
lua_logger_info (lua_State *L)
{
+ LUA_TRACE_POINT;
const gchar *msg;
msg = luaL_checkstring (L, 1);
lua_common_log_line (G_LOG_LEVEL_INFO, L, msg, NULL, NULL);
@@ -256,6 +259,7 @@ lua_logger_info (lua_State *L)
static gint
lua_logger_message (lua_State *L)
{
+ LUA_TRACE_POINT;
const gchar *msg;
msg = luaL_checkstring (L, 1);
lua_common_log_line (G_LOG_LEVEL_MESSAGE, L, msg, NULL, NULL);
@@ -265,6 +269,7 @@ lua_logger_message (lua_State *L)
static gint
lua_logger_debug (lua_State *L)
{
+ LUA_TRACE_POINT;
const gchar *msg;
msg = luaL_checkstring (L, 1);
lua_common_log_line (G_LOG_LEVEL_DEBUG, L, msg, NULL, NULL);
@@ -739,36 +744,42 @@ lua_logger_logx (lua_State *L, GLogLevelFlags level, gboolean is_string)
static gint
lua_logger_errx (lua_State *L)
{
+ LUA_TRACE_POINT;
return lua_logger_logx (L, G_LOG_LEVEL_CRITICAL, FALSE);
}
static gint
lua_logger_warnx (lua_State *L)
{
+ LUA_TRACE_POINT;
return lua_logger_logx (L, G_LOG_LEVEL_WARNING, FALSE);
}
static gint
lua_logger_infox (lua_State *L)
{
+ LUA_TRACE_POINT;
return lua_logger_logx (L, G_LOG_LEVEL_INFO, FALSE);
}
static gint
lua_logger_messagex (lua_State *L)
{
+ LUA_TRACE_POINT;
return lua_logger_logx (L, G_LOG_LEVEL_MESSAGE, FALSE);
}
static gint
lua_logger_debugx (lua_State *L)
{
+ LUA_TRACE_POINT;
return lua_logger_logx (L, G_LOG_LEVEL_DEBUG, FALSE);
}
static gint
lua_logger_debugm (lua_State *L)
{
+ LUA_TRACE_POINT;
gchar logbuf[RSPAMD_LOGBUF_SIZE - 128];
const gchar *uid = NULL, *module = NULL;
gboolean ret;
diff --git a/src/lua/lua_map.c b/src/lua/lua_map.c
index d3fc8edb9..5af724577 100644
--- a/src/lua/lua_map.c
+++ b/src/lua/lua_map.c
@@ -141,6 +141,7 @@ lua_check_map (lua_State * L, gint pos)
gint
lua_config_add_radix_map (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *map_line, *description;
struct rspamd_lua_map *map, **pmap;
@@ -181,6 +182,7 @@ lua_config_add_radix_map (lua_State *L)
gint
lua_config_radix_from_config (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *mname, *optname;
const ucl_object_t *obj;
@@ -246,6 +248,7 @@ lua_config_radix_from_config (lua_State *L)
gint
lua_config_radix_from_ucl (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
ucl_object_t *obj;
struct rspamd_lua_map *map, **pmap;
@@ -301,6 +304,7 @@ lua_config_radix_from_ucl (lua_State *L)
gint
lua_config_add_hash_map (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *map_line, *description;
struct rspamd_lua_map *map, **pmap;
@@ -340,6 +344,7 @@ lua_config_add_hash_map (lua_State *L)
gint
lua_config_add_kv_map (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *map_line, *description;
struct rspamd_lua_map *map, **pmap;
@@ -468,6 +473,7 @@ lua_map_dtor (struct map_cb_data *data)
gint
lua_config_add_map (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const char *description = NULL;
const gchar *type = NULL;
@@ -657,6 +663,7 @@ lua_config_add_map (lua_State *L)
gint
lua_config_get_maps (lua_State*L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
struct rspamd_lua_map *map, **pmap;
struct rspamd_map *m;
@@ -733,6 +740,7 @@ lua_map_process_string_key (lua_State *L, gint pos, gsize *len)
static gint
lua_map_get_key (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_map *map = lua_check_map (L, 1);
struct rspamd_radix_map_helper *radix;
struct rspamd_lua_ip *addr = NULL;
@@ -895,6 +903,7 @@ lua_map_traverse_cb (gconstpointer key,
static gint
lua_map_get_stats (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_map *map = lua_check_map (L, 1);
gboolean do_reset = FALSE;
@@ -919,6 +928,7 @@ lua_map_get_stats (lua_State * L)
static gint
lua_map_get_data_digest (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_map *map = lua_check_map (L, 1);
gchar numbuf[64];
@@ -936,6 +946,7 @@ lua_map_get_data_digest (lua_State * L)
static gint
lua_map_get_nelts (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_map *map = lua_check_map (L, 1);
if (map != NULL) {
@@ -951,6 +962,7 @@ lua_map_get_nelts (lua_State * L)
static int
lua_map_is_signed (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_map *map = lua_check_map (L, 1);
gboolean ret = FALSE;
struct rspamd_map_backend *bk;
@@ -978,6 +990,7 @@ lua_map_is_signed (lua_State *L)
static int
lua_map_get_proto (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_map *map = lua_check_map (L, 1);
const gchar *ret = "undefined";
struct rspamd_map_backend *bk;
@@ -1014,6 +1027,7 @@ lua_map_get_proto (lua_State *L)
static int
lua_map_get_sign_key (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_map *map = lua_check_map (L, 1);
struct rspamd_map_backend *bk;
guint i;
@@ -1050,6 +1064,7 @@ lua_map_get_sign_key (lua_State *L)
static int
lua_map_set_sign_key (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_map *map = lua_check_map (L, 1);
struct rspamd_map_backend *bk;
const gchar *pk_str;
@@ -1089,6 +1104,7 @@ lua_map_set_sign_key (lua_State *L)
static int
lua_map_set_callback (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_map *map = lua_check_map (L, 1);
if (!map || map->type != RSPAMD_LUA_MAP_CALLBACK || map->data.cbdata == NULL) {
@@ -1109,6 +1125,7 @@ lua_map_set_callback (lua_State *L)
static int
lua_map_get_uri (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_map *map = lua_check_map (L, 1);
const gchar *ret = "undefined";
struct rspamd_map_backend *bk;
diff --git a/src/lua/lua_mempool.c b/src/lua/lua_mempool.c
index 3ace7055d..e5cb94219 100644
--- a/src/lua/lua_mempool.c
+++ b/src/lua/lua_mempool.c
@@ -152,6 +152,7 @@ rspamd_lua_check_mempool (lua_State * L, gint pos)
static int
lua_mempool_create (lua_State *L)
{
+ LUA_TRACE_POINT;
struct memory_pool_s *mempool = rspamd_mempool_new (
rspamd_mempool_suggest_size (), "lua"), **pmempool;
@@ -183,6 +184,7 @@ lua_mempool_destructor_func (gpointer p)
static int
lua_mempool_add_destructor (lua_State *L)
{
+ LUA_TRACE_POINT;
struct memory_pool_s *mempool = rspamd_lua_check_mempool (L, 1);
struct lua_mempool_udata *ud;
@@ -213,6 +215,7 @@ lua_mempool_add_destructor (lua_State *L)
static int
lua_mempool_delete (lua_State *L)
{
+ LUA_TRACE_POINT;
struct memory_pool_s *mempool = rspamd_lua_check_mempool (L, 1);
if (mempool) {
@@ -229,6 +232,7 @@ lua_mempool_delete (lua_State *L)
static int
lua_mempool_stat (lua_State *L)
{
+ LUA_TRACE_POINT;
struct memory_pool_s *mempool = rspamd_lua_check_mempool (L, 1);
if (mempool) {
@@ -244,6 +248,7 @@ lua_mempool_stat (lua_State *L)
static int
lua_mempool_suggest_size (lua_State *L)
{
+ LUA_TRACE_POINT;
struct memory_pool_s *mempool = rspamd_lua_check_mempool (L, 1);
if (mempool) {
@@ -265,6 +270,7 @@ struct lua_numbers_bucket {
static int
lua_mempool_set_bucket (lua_State *L)
{
+ LUA_TRACE_POINT;
struct memory_pool_s *mempool = rspamd_lua_check_mempool (L, 1);
const gchar *var = luaL_checkstring (L, 2);
struct lua_numbers_bucket *bucket;
@@ -301,6 +307,7 @@ lua_mempool_set_bucket (lua_State *L)
static int
lua_mempool_set_variable (lua_State *L)
{
+ LUA_TRACE_POINT;
struct memory_pool_s *mempool = rspamd_lua_check_mempool (L, 1);
const gchar *var = luaL_checkstring (L, 2);
gpointer value;
@@ -400,6 +407,7 @@ lua_mempool_set_variable (lua_State *L)
static int
lua_mempool_get_variable (lua_State *L)
{
+ LUA_TRACE_POINT;
struct memory_pool_s *mempool = rspamd_lua_check_mempool (L, 1);
const gchar *var = luaL_checkstring (L, 2);
const gchar *type = NULL, *pt;
@@ -516,6 +524,7 @@ lua_mempool_get_variable (lua_State *L)
static int
lua_mempool_has_variable (lua_State *L)
{
+ LUA_TRACE_POINT;
struct memory_pool_s *mempool = rspamd_lua_check_mempool (L, 1);
const gchar *var = luaL_checkstring (L, 2);
gboolean ret = FALSE;
@@ -534,6 +543,7 @@ lua_mempool_has_variable (lua_State *L)
static int
lua_mempool_delete_variable (lua_State *L)
{
+ LUA_TRACE_POINT;
struct memory_pool_s *mempool = rspamd_lua_check_mempool (L, 1);
const gchar *var = luaL_checkstring (L, 2);
gboolean ret = FALSE;
diff --git a/src/lua/lua_mimepart.c b/src/lua/lua_mimepart.c
index 6ed06f22d..f3ea62b98 100644
--- a/src/lua/lua_mimepart.c
+++ b/src/lua/lua_mimepart.c
@@ -470,6 +470,7 @@ lua_check_mimepart (lua_State * L)
static gint
lua_textpart_is_utf (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_text_part *part = lua_check_textpart (L);
if (part == NULL || IS_PART_EMPTY (part)) {
@@ -486,6 +487,7 @@ lua_textpart_is_utf (lua_State * L)
static gint
lua_textpart_has_8bit_raw (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_text_part *part = lua_check_textpart (L);
if (part) {
@@ -506,6 +508,7 @@ lua_textpart_has_8bit_raw (lua_State * L)
static gint
lua_textpart_has_8bit (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_text_part *part = lua_check_textpart (L);
if (part) {
@@ -527,6 +530,7 @@ lua_textpart_has_8bit (lua_State * L)
static gint
lua_textpart_get_content (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_text_part *part = lua_check_textpart (L);
struct rspamd_lua_text *t;
gsize len;
@@ -582,6 +586,7 @@ lua_textpart_get_content (lua_State * L)
static gint
lua_textpart_get_raw_content (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_text_part *part = lua_check_textpart (L);
struct rspamd_lua_text *t;
@@ -602,6 +607,7 @@ lua_textpart_get_raw_content (lua_State * L)
static gint
lua_textpart_get_content_oneline (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_text_part *part = lua_check_textpart (L);
struct rspamd_lua_text *t;
@@ -622,6 +628,7 @@ lua_textpart_get_content_oneline (lua_State * L)
static gint
lua_textpart_get_length (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_text_part *part = lua_check_textpart (L);
if (part == NULL) {
@@ -642,6 +649,7 @@ lua_textpart_get_length (lua_State * L)
static gint
lua_textpart_get_raw_length (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_text_part *part = lua_check_textpart (L);
if (part == NULL) {
@@ -657,6 +665,7 @@ lua_textpart_get_raw_length (lua_State * L)
static gint
lua_textpart_get_urls_length (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_text_part *part = lua_check_textpart (L);
GList *cur;
guint total = 0;
@@ -683,6 +692,7 @@ lua_textpart_get_urls_length (lua_State * L)
static gint
lua_textpart_get_lines_count (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_text_part *part = lua_check_textpart (L);
if (part == NULL) {
@@ -703,6 +713,7 @@ lua_textpart_get_lines_count (lua_State * L)
static gint
lua_textpart_get_words_count (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_text_part *part = lua_check_textpart (L);
if (part == NULL) {
@@ -723,6 +734,7 @@ lua_textpart_get_words_count (lua_State *L)
static gint
lua_textpart_get_words (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_text_part *part = lua_check_textpart (L);
rspamd_stat_token_t *w;
guint i;
@@ -751,6 +763,7 @@ lua_textpart_get_words (lua_State *L)
static gint
lua_textpart_is_empty (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_text_part *part = lua_check_textpart (L);
if (part == NULL) {
@@ -766,6 +779,7 @@ lua_textpart_is_empty (lua_State * L)
static gint
lua_textpart_is_html (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_text_part *part = lua_check_textpart (L);
if (part == NULL) {
@@ -781,6 +795,7 @@ lua_textpart_is_html (lua_State * L)
static gint
lua_textpart_get_html (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_text_part *part = lua_check_textpart (L);
struct html_content **phc;
@@ -799,6 +814,7 @@ lua_textpart_get_html (lua_State * L)
static gint
lua_textpart_get_language (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_text_part *part = lua_check_textpart (L);
if (part != NULL) {
@@ -820,6 +836,7 @@ lua_textpart_get_language (lua_State * L)
static gint
lua_textpart_get_languages (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_text_part *part = lua_check_textpart (L);
guint i;
struct rspamd_lang_detector_res *cur;
@@ -899,6 +916,7 @@ lua_shingles_filter (guint64 *input, gsize count,
static gint
lua_textpart_get_fuzzy_hashes (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_text_part *part = lua_check_textpart (L);
rspamd_mempool_t *pool = rspamd_lua_check_mempool (L, 2);
guchar key[rspamd_cryptobox_HASHBYTES], digest[rspamd_cryptobox_HASHBYTES],
@@ -970,6 +988,7 @@ lua_textpart_get_fuzzy_hashes (lua_State * L)
static gint
lua_textpart_get_mimepart (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_text_part *part = lua_check_textpart (L);
struct rspamd_mime_part **pmime;
@@ -1002,6 +1021,7 @@ lua_textpart_get_mimepart (lua_State * L)
static gint
lua_textpart_get_stats (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_text_part *part = lua_check_textpart (L);
if (part != NULL) {
@@ -1047,6 +1067,7 @@ lua_textpart_get_stats (lua_State * L)
static gint
lua_mimepart_get_content (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_part *part = lua_check_mimepart (L);
struct rspamd_lua_text *t;
@@ -1067,6 +1088,7 @@ lua_mimepart_get_content (lua_State * L)
static gint
lua_mimepart_get_raw_content (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_part *part = lua_check_mimepart (L);
struct rspamd_lua_text *t;
@@ -1087,6 +1109,7 @@ lua_mimepart_get_raw_content (lua_State * L)
static gint
lua_mimepart_get_length (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_part *part = lua_check_mimepart (L);
if (part == NULL) {
@@ -1156,18 +1179,21 @@ lua_mimepart_get_type_common (lua_State * L, gboolean full)
static gint
lua_mimepart_get_type (lua_State * L)
{
+ LUA_TRACE_POINT;
return lua_mimepart_get_type_common (L, FALSE);
}
static gint
lua_mimepart_get_type_full (lua_State * L)
{
+ LUA_TRACE_POINT;
return lua_mimepart_get_type_common (L, TRUE);
}
static gint
lua_mimepart_get_cte (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_part *part = lua_check_mimepart (L);
if (part == NULL) {
@@ -1183,6 +1209,7 @@ lua_mimepart_get_cte (lua_State * L)
static gint
lua_mimepart_get_filename (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_part *part = lua_check_mimepart (L);
if (part == NULL || part->cd == NULL || part->cd->filename.len == 0) {
@@ -1220,30 +1247,35 @@ lua_mimepart_get_header_common (lua_State *L, enum rspamd_lua_task_header_type h
static gint
lua_mimepart_get_header_full (lua_State * L)
{
+ LUA_TRACE_POINT;
return lua_mimepart_get_header_common (L, RSPAMD_TASK_HEADER_PUSH_FULL);
}
static gint
lua_mimepart_get_header (lua_State * L)
{
+ LUA_TRACE_POINT;
return lua_mimepart_get_header_common (L, RSPAMD_TASK_HEADER_PUSH_SIMPLE);
}
static gint
lua_mimepart_get_header_raw (lua_State * L)
{
+ LUA_TRACE_POINT;
return lua_mimepart_get_header_common (L, RSPAMD_TASK_HEADER_PUSH_RAW);
}
static gint
lua_mimepart_get_header_count (lua_State * L)
{
+ LUA_TRACE_POINT;
return lua_mimepart_get_header_common (L, RSPAMD_TASK_HEADER_PUSH_COUNT);
}
static gint
lua_mimepart_is_image (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_part *part = lua_check_mimepart (L);
if (part == NULL) {
@@ -1258,6 +1290,7 @@ lua_mimepart_is_image (lua_State * L)
static gint
lua_mimepart_is_archive (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_part *part = lua_check_mimepart (L);
if (part == NULL) {
@@ -1272,6 +1305,7 @@ lua_mimepart_is_archive (lua_State * L)
static gint
lua_mimepart_is_multipart (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_part *part = lua_check_mimepart (L);
if (part == NULL) {
@@ -1286,6 +1320,7 @@ lua_mimepart_is_multipart (lua_State * L)
static gint
lua_mimepart_is_text (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_part *part = lua_check_mimepart (L);
if (part == NULL) {
@@ -1300,6 +1335,7 @@ lua_mimepart_is_text (lua_State * L)
static gint
lua_mimepart_is_broken (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_part *part = lua_check_mimepart (L);
if (part == NULL) {
@@ -1320,6 +1356,7 @@ lua_mimepart_is_broken (lua_State * L)
static gint
lua_mimepart_get_image (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_part *part = lua_check_mimepart (L);
struct rspamd_image **pimg;
@@ -1342,6 +1379,7 @@ lua_mimepart_get_image (lua_State * L)
static gint
lua_mimepart_get_archive (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_part *part = lua_check_mimepart (L);
struct rspamd_archive **parch;
@@ -1364,6 +1402,7 @@ lua_mimepart_get_archive (lua_State * L)
static gint
lua_mimepart_get_children (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_part *part = lua_check_mimepart (L);
struct rspamd_mime_part **pcur, *cur;
guint i;
@@ -1393,6 +1432,7 @@ lua_mimepart_get_children (lua_State * L)
static gint
lua_mimepart_get_text (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_part *part = lua_check_mimepart (L);
struct rspamd_mime_text_part **ppart;
@@ -1415,6 +1455,7 @@ lua_mimepart_get_text (lua_State * L)
static gint
lua_mimepart_get_digest (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_part *part = lua_check_mimepart (L);
gchar digestbuf[rspamd_cryptobox_HASHBYTES * 2 + 1];
@@ -1433,6 +1474,7 @@ lua_mimepart_get_digest (lua_State * L)
static gint
lua_mimepart_headers_foreach (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_mime_part *part = lua_check_mimepart (L);
enum rspamd_lua_task_header_type how = RSPAMD_TASK_HEADER_PUSH_SIMPLE;
struct rspamd_lua_regexp *re = NULL;
diff --git a/src/lua/lua_redis.c b/src/lua/lua_redis.c
index 3651f9c7a..cf416a12a 100644
--- a/src/lua/lua_redis.c
+++ b/src/lua/lua_redis.c
@@ -751,6 +751,7 @@ rspamd_lua_redis_prepare_connection (lua_State *L, gint *pcbref)
static int
lua_redis_make_request (lua_State *L)
{
+ LUA_TRACE_POINT;
struct lua_redis_specific_userdata *sp_ud;
struct lua_redis_userdata *ud;
struct lua_redis_ctx *ctx, **pctx;
@@ -858,6 +859,7 @@ lua_redis_make_request (lua_State *L)
static int
lua_redis_make_request_sync (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_ip *addr = NULL;
rspamd_inet_addr_t *ip = NULL;
const gchar *cmd = NULL, *host;
@@ -1000,6 +1002,7 @@ lua_redis_make_request_sync (lua_State *L)
static int
lua_redis_connect (lua_State *L)
{
+ LUA_TRACE_POINT;
struct lua_redis_userdata *ud;
struct lua_redis_ctx *ctx, **pctx;
gdouble timeout = REDIS_DEFAULT_TIMEOUT;
@@ -1042,6 +1045,7 @@ lua_redis_connect (lua_State *L)
static int
lua_redis_connect_sync (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_ip *addr = NULL;
rspamd_inet_addr_t *ip = NULL;
const gchar *host;
@@ -1153,6 +1157,7 @@ lua_redis_connect_sync (lua_State *L)
static int
lua_redis_add_cmd (lua_State *L)
{
+ LUA_TRACE_POINT;
struct lua_redis_ctx *ctx = lua_check_redis (L, 1);
struct lua_redis_specific_userdata *sp_ud;
struct lua_redis_userdata *ud;
@@ -1275,6 +1280,7 @@ lua_redis_add_cmd (lua_State *L)
static int
lua_redis_exec (lua_State *L)
{
+ LUA_TRACE_POINT;
struct lua_redis_ctx *ctx = lua_check_redis (L, 1);
redisReply *r;
gint ret;
diff --git a/src/lua/lua_regexp.c b/src/lua/lua_regexp.c
index 1853e4a4d..896fb3d9b 100644
--- a/src/lua/lua_regexp.c
+++ b/src/lua/lua_regexp.c
@@ -122,6 +122,7 @@ rspamd_lua_get_module_name (lua_State *L)
static int
lua_regexp_create (lua_State *L)
{
+ LUA_TRACE_POINT;
rspamd_regexp_t *re;
struct rspamd_lua_regexp *new, **pnew;
const gchar *string, *flags_str = NULL;
@@ -164,6 +165,7 @@ lua_regexp_create (lua_State *L)
static int
lua_regexp_get_cached (lua_State *L)
{
+ LUA_TRACE_POINT;
rspamd_regexp_t *re;
struct rspamd_lua_regexp *new, **pnew;
const gchar *string, *flags_str = NULL;
@@ -209,6 +211,7 @@ lua_regexp_get_cached (lua_State *L)
static int
lua_regexp_create_cached (lua_State *L)
{
+ LUA_TRACE_POINT;
rspamd_regexp_t *re;
struct rspamd_lua_regexp *new, **pnew;
const gchar *string, *flags_str = NULL;
@@ -262,6 +265,7 @@ lua_regexp_create_cached (lua_State *L)
static int
lua_regexp_get_pattern (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_regexp *re = lua_check_regexp (L);
if (re && re->re && !IS_DESTROYED (re)) {
@@ -283,6 +287,7 @@ lua_regexp_get_pattern (lua_State *L)
static int
lua_regexp_set_limit (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_regexp *re = lua_check_regexp (L);
gint64 lim;
@@ -309,6 +314,7 @@ lua_regexp_set_limit (lua_State *L)
static int
lua_regexp_set_max_hits (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_regexp *re = lua_check_regexp (L);
guint lim;
@@ -332,6 +338,7 @@ lua_regexp_set_max_hits (lua_State *L)
static int
lua_regexp_get_max_hits (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_regexp *re = lua_check_regexp (L);
if (re && re->re && !IS_DESTROYED (re)) {
@@ -374,6 +381,7 @@ lua_regexp_get_max_hits (lua_State *L)
static int
lua_regexp_search (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_regexp *re = lua_check_regexp (L);
const gchar *data = NULL;
struct rspamd_lua_text *t;
@@ -467,6 +475,7 @@ lua_regexp_search (lua_State *L)
static int
lua_regexp_match (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_regexp *re = lua_check_regexp (L);
struct rspamd_lua_text *t;
const gchar *data = NULL;
@@ -524,6 +533,7 @@ lua_regexp_match (lua_State *L)
static int
lua_regexp_matchn (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_regexp *re = lua_check_regexp (L);
struct rspamd_lua_text *t;
const gchar *data = NULL, *start = NULL, *end = NULL;
@@ -595,6 +605,7 @@ lua_regexp_matchn (lua_State *L)
static int
lua_regexp_split (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_regexp *re = lua_check_regexp (L);
const gchar *data = NULL;
struct rspamd_lua_text *t;
@@ -690,6 +701,7 @@ lua_regexp_split (lua_State *L)
static gint
lua_regexp_destroy (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_regexp *to_del = lua_check_regexp (L);
if (to_del) {
@@ -705,6 +717,7 @@ lua_regexp_destroy (lua_State *L)
static gint
lua_regexp_gc (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_regexp *to_del = lua_check_regexp (L);
if (to_del) {
diff --git a/src/lua/lua_sqlite3.c b/src/lua/lua_sqlite3.c
index 2a451dc31..87d798666 100644
--- a/src/lua/lua_sqlite3.c
+++ b/src/lua/lua_sqlite3.c
@@ -168,6 +168,7 @@ lua_sqlite3_bind_statements (lua_State *L, gint start, gint end,
static gint
lua_sqlite3_sql (lua_State *L)
{
+ LUA_TRACE_POINT;
sqlite3 *db = lua_check_sqlite3 (L, 1);
const gchar *query = luaL_checkstring (L, 2);
sqlite3_stmt *stmt;
@@ -262,6 +263,7 @@ lua_sqlite3_push_row (lua_State *L, sqlite3_stmt *stmt)
static gint
lua_sqlite3_next_row (lua_State *L)
{
+ LUA_TRACE_POINT;
sqlite3_stmt *stmt = *(sqlite3_stmt **)lua_touserdata (L, lua_upvalueindex (1));
gint rc;
@@ -295,6 +297,7 @@ end
static gint
lua_sqlite3_rows (lua_State *L)
{
+ LUA_TRACE_POINT;
sqlite3 *db = lua_check_sqlite3 (L, 1);
const gchar *query = luaL_checkstring (L, 2);
sqlite3_stmt *stmt, **pstmt;
@@ -332,6 +335,7 @@ lua_sqlite3_rows (lua_State *L)
static gint
lua_sqlite3_close (lua_State *L)
{
+ LUA_TRACE_POINT;
sqlite3 *db = lua_check_sqlite3 (L, 1);
if (db) {
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index 83adc99a2..e4defa667 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -1117,6 +1117,7 @@ static void
lua_task_set_cached (lua_State *L, struct rspamd_task *task, const gchar *key,
gint pos, guint id)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_cached_entry *entry;
lua_pushvalue (L, pos);
@@ -1141,6 +1142,7 @@ static gboolean
lua_task_get_cached (lua_State *L, struct rspamd_task *task, const gchar *key,
guint id)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_cached_entry *entry;
entry = g_hash_table_lookup (task->lua_cache, key);
@@ -1158,6 +1160,7 @@ lua_task_get_cached (lua_State *L, struct rspamd_task *task, const gchar *key,
static int
lua_task_process_message (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
if (task != NULL) {
@@ -1184,6 +1187,7 @@ lua_task_process_message (lua_State *L)
static int
lua_task_get_cfg (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
struct rspamd_config **pcfg;
@@ -1202,6 +1206,7 @@ lua_task_get_cfg (lua_State *L)
static int
lua_task_set_cfg (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
void *ud = rspamd_lua_check_udata (L, 2, "rspamd{config}");
@@ -1219,6 +1224,7 @@ lua_task_set_cfg (lua_State *L)
static int
lua_task_destroy (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
if (task != NULL) {
@@ -1231,6 +1237,7 @@ lua_task_destroy (lua_State *L)
static int
lua_task_get_message (lua_State * L)
{
+ LUA_TRACE_POINT;
return luaL_error (L, "task:get_message is no longer supported");
}
@@ -1257,6 +1264,7 @@ lua_task_free_dtor (gpointer p)
static gint
lua_task_load_from_file (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = NULL, **ptask;
const gchar *fname = luaL_checkstring (L, 1), *err = NULL;
struct rspamd_config *cfg = NULL;
@@ -1315,6 +1323,7 @@ lua_task_load_from_file (lua_State * L)
static gint
lua_task_load_from_string (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = NULL, **ptask;
const gchar *str_message;
gsize message_len;
@@ -1354,6 +1363,7 @@ lua_task_load_from_string (lua_State * L)
static int
lua_task_get_mempool (lua_State * L)
{
+ LUA_TRACE_POINT;
rspamd_mempool_t **ppool;
struct rspamd_task *task = lua_check_task (L, 1);
@@ -1372,6 +1382,7 @@ lua_task_get_mempool (lua_State * L)
static int
lua_task_get_session (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_async_session **psession;
struct rspamd_task *task = lua_check_task (L, 1);
@@ -1389,6 +1400,7 @@ lua_task_get_session (lua_State * L)
static int
lua_task_get_ev_base (lua_State * L)
{
+ LUA_TRACE_POINT;
struct event_base **pbase;
struct rspamd_task *task = lua_check_task (L, 1);
@@ -1406,6 +1418,7 @@ lua_task_get_ev_base (lua_State * L)
static int
lua_task_get_worker (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_worker **pworker;
struct rspamd_task *task = lua_check_task (L, 1);
@@ -1429,6 +1442,7 @@ lua_task_get_worker (lua_State * L)
static gint
lua_task_insert_result (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
const gchar *symbol_name, *param;
double weight;
@@ -1487,6 +1501,7 @@ lua_task_insert_result (lua_State * L)
static gint
lua_task_adjust_result (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
const gchar *symbol_name, *param;
struct rspamd_metric_result *metric_res;
@@ -1550,6 +1565,7 @@ lua_task_adjust_result (lua_State * L)
static gint
lua_task_set_pre_result (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
gchar *action_str;
gint action = METRIC_ACTION_MAX;
@@ -1607,6 +1623,7 @@ lua_task_set_pre_result (lua_State * L)
static gint
lua_task_has_pre_result (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
if (task) {
@@ -1622,6 +1639,7 @@ lua_task_has_pre_result (lua_State * L)
static gint
lua_task_append_message (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
const gchar *message = luaL_checkstring (L, 2), *category;
@@ -1664,6 +1682,7 @@ lua_tree_url_callback (gpointer key, gpointer value, gpointer ud)
static gint
lua_task_get_urls (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
struct lua_tree_cb_data cb;
gboolean need_emails = FALSE;
@@ -1711,6 +1730,7 @@ lua_task_get_urls (lua_State * L)
static gint
lua_task_has_urls (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
gboolean need_emails = FALSE, ret = FALSE;
@@ -1739,6 +1759,7 @@ lua_task_has_urls (lua_State * L)
static gint
lua_task_get_content (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
struct rspamd_lua_text *t;
@@ -1759,6 +1780,7 @@ lua_task_get_content (lua_State * L)
static gint
lua_task_get_filename (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
if (task) {
@@ -1779,6 +1801,7 @@ lua_task_get_filename (lua_State * L)
static gint
lua_task_get_rawbody (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
struct rspamd_lua_text *t;
@@ -1808,6 +1831,7 @@ lua_task_get_rawbody (lua_State * L)
static gint
lua_task_get_emails (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
struct lua_tree_cb_data cb;
@@ -1827,6 +1851,7 @@ lua_task_get_emails (lua_State * L)
static gint
lua_task_get_text_parts (lua_State * L)
{
+ LUA_TRACE_POINT;
guint i;
struct rspamd_task *task = lua_check_task (L, 1);
struct rspamd_mime_text_part *part, **ppart;
@@ -1858,6 +1883,7 @@ lua_task_get_text_parts (lua_State * L)
static gint
lua_task_get_parts (lua_State * L)
{
+ LUA_TRACE_POINT;
guint i;
struct rspamd_task *task = lua_check_task (L, 1);
struct rspamd_mime_part *part, **ppart;
@@ -1888,6 +1914,7 @@ lua_task_get_parts (lua_State * L)
static gint
lua_task_get_request_header (lua_State *L)
{
+ LUA_TRACE_POINT;
rspamd_ftok_t *hdr;
struct rspamd_task *task = lua_check_task (L, 1);
const gchar *s;
@@ -1921,6 +1948,7 @@ lua_task_get_request_header (lua_State *L)
static gint
lua_task_set_request_header (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
const gchar *s, *v = NULL;
rspamd_fstring_t *buf;
@@ -1967,7 +1995,7 @@ gint
rspamd_lua_push_header (lua_State *L, struct rspamd_mime_header *rh,
enum rspamd_lua_task_header_type how)
{
-
+ LUA_TRACE_POINT;
switch (how) {
case RSPAMD_TASK_HEADER_PUSH_FULL:
/* Create new associated table for a header */
@@ -2023,7 +2051,7 @@ rspamd_lua_push_header_array (lua_State * L,
GPtrArray *ar,
enum rspamd_lua_task_header_type how)
{
-
+ LUA_TRACE_POINT;
struct rspamd_mime_header *rh;
guint i;
@@ -2060,6 +2088,7 @@ rspamd_lua_push_header_array (lua_State * L,
static gint
lua_task_get_header_common (lua_State *L, enum rspamd_lua_task_header_type how)
{
+ LUA_TRACE_POINT;
gboolean strong = FALSE;
struct rspamd_task *task = lua_check_task (L, 1);
const gchar *name;
@@ -2108,6 +2137,7 @@ lua_task_get_header_count (lua_State * L)
static gint
lua_task_get_raw_headers (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
struct rspamd_lua_text *t;
@@ -2129,6 +2159,7 @@ lua_task_get_raw_headers (lua_State *L)
static gint
lua_task_get_received_headers (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
struct received_header *rh;
const gchar *proto;
@@ -2250,6 +2281,7 @@ lua_task_get_received_headers (lua_State * L)
static gint
lua_task_get_queue_id (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
if (task) {
@@ -2270,6 +2302,7 @@ lua_task_get_queue_id (lua_State *L)
static gint
lua_task_get_uid (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
if (task) {
@@ -2285,6 +2318,7 @@ lua_task_get_uid (lua_State *L)
static gint
lua_task_get_resolver (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
struct rspamd_dns_resolver **presolver;
@@ -2303,6 +2337,7 @@ lua_task_get_resolver (lua_State *L)
static gint
lua_task_inc_dns_req (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
if (task != NULL) {
@@ -2318,6 +2353,7 @@ lua_task_inc_dns_req (lua_State *L)
static gint
lua_task_get_dns_req (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
if (task != NULL) {
@@ -2602,6 +2638,7 @@ lua_import_email_address (lua_State *L, struct rspamd_task *task,
static gint
lua_task_get_recipients (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
GPtrArray *ptrs = NULL;
gint what = 0;
@@ -2648,6 +2685,7 @@ lua_task_get_recipients (lua_State *L)
static gint
lua_task_set_recipients (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
GPtrArray *ptrs = NULL;
struct rspamd_email_address *addr = NULL;
@@ -2734,6 +2772,7 @@ lua_task_set_recipients (lua_State *L)
static gint
lua_task_has_from (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
gint what = 0;
gboolean ret = FALSE;
@@ -2775,6 +2814,7 @@ lua_task_has_from (lua_State *L)
static gint
lua_task_has_recipients (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
gint what = 0;
gboolean ret = FALSE;
@@ -2816,6 +2856,7 @@ lua_task_has_recipients (lua_State *L)
static gint
lua_task_get_from (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
GPtrArray *addrs = NULL;
struct rspamd_email_address *addr = NULL;
@@ -2875,6 +2916,7 @@ lua_task_get_from (lua_State *L)
static gint
lua_task_set_from (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
GPtrArray *addrs = NULL;
struct rspamd_email_address **paddr = NULL, *addr;
@@ -2954,6 +2996,7 @@ lua_task_set_from (lua_State *L)
static gint
lua_task_get_principal_recipient (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
const gchar *r;
@@ -2976,6 +3019,7 @@ lua_task_get_principal_recipient (lua_State *L)
static gint
lua_task_get_user (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
if (task) {
@@ -2996,6 +3040,7 @@ lua_task_get_user (lua_State *L)
static gint
lua_task_set_user (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
const gchar *new_user;
@@ -3037,6 +3082,7 @@ lua_task_set_user (lua_State *L)
static gint
lua_task_get_from_ip (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
if (task) {
@@ -3052,6 +3098,7 @@ lua_task_get_from_ip (lua_State *L)
static gint
lua_task_set_from_ip (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
const gchar *ip_str = luaL_checkstring (L, 2);
rspamd_inet_addr_t *addr = NULL;
@@ -3082,6 +3129,7 @@ lua_task_set_from_ip (lua_State *L)
static gint
lua_task_get_from_ip_num (lua_State *L)
{
+ LUA_TRACE_POINT;
msg_err ("this function is deprecated and should no longer be used");
lua_pushnil (L);
return 1;
@@ -3090,6 +3138,7 @@ lua_task_get_from_ip_num (lua_State *L)
static gint
lua_task_get_client_ip (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
if (task) {
@@ -3105,6 +3154,7 @@ lua_task_get_client_ip (lua_State *L)
static gint
lua_task_get_helo (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
if (task) {
@@ -3126,6 +3176,7 @@ lua_task_get_helo (lua_State *L)
static gint
lua_task_get_subject (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
if (task) {
@@ -3147,6 +3198,7 @@ lua_task_get_subject (lua_State *L)
static gint
lua_task_set_helo (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
const gchar *new_helo;
@@ -3166,6 +3218,7 @@ lua_task_set_helo (lua_State *L)
static gint
lua_task_get_hostname (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
if (task) {
@@ -3200,6 +3253,7 @@ lua_task_get_hostname (lua_State *L)
static gint
lua_task_set_hostname (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
const gchar *new_hostname;
@@ -3220,6 +3274,7 @@ lua_task_set_hostname (lua_State *L)
static gint
lua_task_get_images (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
guint nelt = 0, i;
struct rspamd_mime_part *part;
@@ -3253,6 +3308,7 @@ lua_task_get_images (lua_State *L)
static gint
lua_task_get_archives (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
guint nelt = 0, i;
struct rspamd_mime_part *part;
@@ -3370,6 +3426,7 @@ lua_push_symbol_result (lua_State *L,
static gint
lua_task_get_symbol (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
const gchar *symbol;
gboolean found = FALSE;
@@ -3403,6 +3460,7 @@ lua_task_get_symbol (lua_State *L)
static gint
lua_task_has_symbol (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
const gchar *symbol;
gboolean found = FALSE;
@@ -3423,6 +3481,7 @@ lua_task_has_symbol (lua_State *L)
static gint
lua_task_get_symbols (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
struct rspamd_metric_result *mres;
gint i = 1;
@@ -3460,6 +3519,7 @@ lua_task_get_symbols (lua_State *L)
static gint
lua_task_get_symbols_all (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
struct rspamd_metric_result *mres;
struct rspamd_symbol_result *s;
@@ -3494,6 +3554,7 @@ lua_task_get_symbols_all (lua_State *L)
static gint
lua_task_get_symbols_numeric (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
struct rspamd_metric_result *mres;
gint i = 1, id;
@@ -3567,6 +3628,7 @@ tokens_foreach_cb (gint id, const gchar *sym, gint flags, gpointer ud)
static gint
lua_task_get_symbols_tokens (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
struct tokens_foreach_cbdata cbd;
@@ -3649,6 +3711,7 @@ lua_task_detect_date_type (struct rspamd_task *task,
static gint
lua_task_get_date (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
GPtrArray *hdrs;
gdouble tim;
@@ -3728,6 +3791,7 @@ lua_task_get_date (lua_State *L)
static gint
lua_task_get_message_id (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
if (task != NULL) {
@@ -3748,6 +3812,7 @@ lua_task_get_message_id (lua_State *L)
static gint
lua_task_get_timeval (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
if (task != NULL) {
@@ -3769,6 +3834,7 @@ lua_task_get_timeval (lua_State *L)
static gint
lua_task_get_size (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
if (task != NULL) {
@@ -3814,6 +3880,7 @@ lua_task_get_size (lua_State *L)
static gint
lua_task_set_flag (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
const gchar *flag = luaL_checkstring (L, 2);
gboolean set = TRUE, found = FALSE;
@@ -3849,6 +3916,7 @@ lua_task_set_flag (lua_State *L)
static gint
lua_task_has_flag (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
const gchar *flag = luaL_checkstring (L, 2);
gboolean found = FALSE;
@@ -3884,6 +3952,7 @@ lua_task_has_flag (lua_State *L)
static gint
lua_task_get_flags (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
gint idx = 1;
guint flags, bit, i;
@@ -3958,6 +4027,7 @@ lua_task_get_flags (lua_State *L)
static gint
lua_task_get_digest (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
gchar hexbuf[33];
gint r;
@@ -3985,6 +4055,7 @@ lua_task_get_digest (lua_State *L)
static gint
lua_task_learn (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
gboolean is_spam = FALSE;
const gchar *clname = NULL;
@@ -4017,6 +4088,7 @@ lua_task_learn (lua_State *L)
static gint
lua_task_set_settings (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
ucl_object_t *settings;
const ucl_object_t *act, *elt, *metric_elt, *vars, *cur;
@@ -4086,6 +4158,7 @@ lua_task_set_settings (lua_State *L)
static gint
lua_task_set_milter_reply (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
ucl_object_t *reply, *prev;
@@ -4115,6 +4188,7 @@ lua_task_set_milter_reply (lua_State *L)
static gint
lua_task_get_settings (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
if (task != NULL) {
@@ -4136,6 +4210,7 @@ lua_task_get_settings (lua_State *L)
static gint
lua_task_lookup_settings (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
const gchar *key = NULL;
const ucl_object_t *elt;
@@ -4175,6 +4250,7 @@ lua_task_lookup_settings (lua_State *L)
static gint
lua_task_get_settings_id (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
guint32 *hp;
@@ -4198,6 +4274,7 @@ lua_task_get_settings_id (lua_State *L)
static gint
lua_task_cache_get (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
const gchar *key = luaL_checkstring (L, 2);
guint id = 0;
@@ -4221,6 +4298,7 @@ lua_task_cache_get (lua_State *L)
static gint
lua_task_cache_set (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
const gchar *key = luaL_checkstring (L, 2);
guint id = 0;
@@ -4260,6 +4338,7 @@ lua_tmp_file_dtor (gpointer p)
static gint
lua_task_store_in_file (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
gboolean force_new = FALSE, keep = FALSE;
gchar fpath[PATH_MAX];
@@ -4349,6 +4428,7 @@ lua_task_store_in_file (lua_State *L)
static gint
lua_task_process_regexp (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
struct rspamd_lua_regexp *re = NULL;
gboolean strong = FALSE;
@@ -4409,6 +4489,7 @@ lua_task_process_regexp (lua_State *L)
static gint
lua_task_get_metric_score (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
gdouble rs;
struct rspamd_metric_result *metric_res;
@@ -4436,6 +4517,7 @@ lua_task_get_metric_score (lua_State *L)
static gint
lua_task_get_metric_action (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
struct rspamd_metric_result *metric_res;
enum rspamd_action_type action;
@@ -4458,6 +4540,7 @@ lua_task_get_metric_action (lua_State *L)
static gint
lua_task_set_metric_score (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
struct rspamd_metric_result *metric_res;
gdouble nscore;
@@ -4490,6 +4573,7 @@ lua_task_set_metric_score (lua_State *L)
static gint
lua_task_disable_action (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
const gchar *action_name;
gint action;
@@ -4518,6 +4602,7 @@ lua_task_disable_action (lua_State *L)
static gint
lua_task_get_newlines_type (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
if (task) {
@@ -4619,6 +4704,7 @@ lua_push_stat_token (lua_State *L, rspamd_token_t *tok)
static gint
lua_task_get_stat_tokens (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
guint i;
rspamd_token_t *tok;
@@ -4650,6 +4736,7 @@ lua_task_get_stat_tokens (lua_State *L)
static gint
lua_task_set_metric_subject (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
const gchar *subject;
@@ -4670,6 +4757,7 @@ lua_task_set_metric_subject (lua_State *L)
static gint
lua_task_get_protocol_reply (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
guint flags = 0;
ucl_object_t *obj;
@@ -4733,6 +4821,7 @@ lua_task_get_protocol_reply (lua_State *L)
static gint
lua_task_headers_foreach (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
enum rspamd_lua_task_header_type how = RSPAMD_TASK_HEADER_PUSH_SIMPLE;
struct rspamd_lua_regexp *re = NULL;
@@ -4820,6 +4909,7 @@ lua_task_headers_foreach (lua_State *L)
static gint
lua_image_get_width (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_image *img = lua_check_image (L);
if (img != NULL) {
@@ -4835,6 +4925,7 @@ lua_image_get_width (lua_State *L)
static gint
lua_image_get_height (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_image *img = lua_check_image (L);
if (img != NULL) {
@@ -4850,6 +4941,7 @@ lua_image_get_height (lua_State *L)
static gint
lua_image_get_type (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_image *img = lua_check_image (L);
if (img != NULL) {
@@ -4865,6 +4957,7 @@ lua_image_get_type (lua_State *L)
static gint
lua_image_get_size (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_image *img = lua_check_image (L);
if (img != NULL) {
@@ -4880,6 +4973,7 @@ lua_image_get_size (lua_State *L)
static gint
lua_image_get_filename (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_image *img = lua_check_image (L);
if (img != NULL && img->filename != NULL) {
@@ -4896,6 +4990,7 @@ lua_image_get_filename (lua_State *L)
static gint
lua_archive_get_type (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_archive *arch = lua_check_archive (L);
if (arch != NULL) {
@@ -4911,6 +5006,7 @@ lua_archive_get_type (lua_State *L)
static gint
lua_archive_get_files (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_archive *arch = lua_check_archive (L);
guint i;
struct rspamd_archive_file *f;
@@ -4935,6 +5031,7 @@ lua_archive_get_files (lua_State *L)
static gint
lua_archive_get_files_full (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_archive *arch = lua_check_archive (L);
guint i;
struct rspamd_archive_file *f;
@@ -4976,6 +5073,7 @@ lua_archive_get_files_full (lua_State *L)
static gint
lua_archive_is_encrypted (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_archive *arch = lua_check_archive (L);
if (arch != NULL) {
@@ -4991,6 +5089,7 @@ lua_archive_is_encrypted (lua_State *L)
static gint
lua_archive_get_size (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_archive *arch = lua_check_archive (L);
if (arch != NULL) {
@@ -5006,6 +5105,7 @@ lua_archive_get_size (lua_State *L)
static gint
lua_archive_get_filename (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_archive *arch = lua_check_archive (L);
if (arch != NULL) {
@@ -5022,6 +5122,7 @@ lua_archive_get_filename (lua_State *L)
static gint
lua_text_len (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_text *t = lua_check_text (L, 1);
gsize l = 0;
@@ -5040,6 +5141,7 @@ lua_text_len (lua_State *L)
static gint
lua_text_str (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_text *t = lua_check_text (L, 1);
if (t != NULL) {
@@ -5055,6 +5157,7 @@ lua_text_str (lua_State *L)
static gint
lua_text_ptr (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_text *t = lua_check_text (L, 1);
if (t != NULL) {
@@ -5070,6 +5173,7 @@ lua_text_ptr (lua_State *L)
static gint
lua_text_take_ownership (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_text *t = lua_check_text (L, 1);
gchar *dest;
@@ -5096,6 +5200,7 @@ lua_text_take_ownership (lua_State *L)
static gint
lua_text_save_in_file (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_text *t = lua_check_text (L, 1);
const gchar *fname = NULL;
guint mode = 00644;
@@ -5150,6 +5255,7 @@ lua_text_save_in_file (lua_State *L)
static gint
lua_text_gc (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_text *t = lua_check_text (L, 1);
if (t != NULL) {
diff --git a/src/lua/lua_tcp.c b/src/lua/lua_tcp.c
index 884bbc2ae..6c3f6ec04 100644
--- a/src/lua/lua_tcp.c
+++ b/src/lua/lua_tcp.c
@@ -954,6 +954,7 @@ lua_tcp_arg_toiovec (lua_State *L, gint pos, struct lua_tcp_cbdata *cbd,
static gint
lua_tcp_request (lua_State *L)
{
+ LUA_TRACE_POINT;
const gchar *host;
gchar *stop_pattern = NULL;
guint port;
@@ -1280,6 +1281,7 @@ lua_tcp_request (lua_State *L)
static gint
lua_tcp_close (lua_State *L)
{
+ LUA_TRACE_POINT;
struct lua_tcp_cbdata *cbd = lua_check_tcp (L, 1);
if (cbd == NULL) {
@@ -1295,6 +1297,7 @@ lua_tcp_close (lua_State *L)
static gint
lua_tcp_set_timeout (lua_State *L)
{
+ LUA_TRACE_POINT;
struct lua_tcp_cbdata *cbd = lua_check_tcp (L, 1);
gdouble ms = lua_tonumber (L, 2);
@@ -1311,6 +1314,7 @@ lua_tcp_set_timeout (lua_State *L)
static gint
lua_tcp_add_read (lua_State *L)
{
+ LUA_TRACE_POINT;
struct lua_tcp_cbdata *cbd = lua_check_tcp (L, 1);
struct lua_tcp_handler *rh;
gchar *stop_pattern = NULL;
@@ -1351,6 +1355,7 @@ lua_tcp_add_read (lua_State *L)
static gint
lua_tcp_add_write (lua_State *L)
{
+ LUA_TRACE_POINT;
struct lua_tcp_cbdata *cbd = lua_check_tcp (L, 1);
struct lua_tcp_handler *wh;
gint cbref = -1, tp;
@@ -1434,6 +1439,7 @@ lua_tcp_add_write (lua_State *L)
static gint
lua_tcp_shift_callback (lua_State *L)
{
+ LUA_TRACE_POINT;
struct lua_tcp_cbdata *cbd = lua_check_tcp (L, 1);
if (cbd == NULL) {
diff --git a/src/lua/lua_trie.c b/src/lua/lua_trie.c
index 5911842b9..362564ce8 100644
--- a/src/lua/lua_trie.c
+++ b/src/lua/lua_trie.c
@@ -202,6 +202,7 @@ lua_trie_search_str (lua_State *L, struct rspamd_multipattern *trie,
static gint
lua_trie_match (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_multipattern *trie = lua_check_trie (L, 1);
const gchar *text;
gsize len;
@@ -249,6 +250,7 @@ lua_trie_match (lua_State *L)
static gint
lua_trie_search_mime (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_multipattern *trie = lua_check_trie (L, 1);
struct rspamd_task *task = lua_check_task (L, 2);
struct rspamd_mime_text_part *part;
@@ -286,6 +288,7 @@ lua_trie_search_mime (lua_State *L)
static gint
lua_trie_search_rawmsg (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_multipattern *trie = lua_check_trie (L, 1);
struct rspamd_task *task = lua_check_task (L, 2);
const gchar *text;
@@ -316,6 +319,7 @@ lua_trie_search_rawmsg (lua_State *L)
static gint
lua_trie_search_rawbody (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_multipattern *trie = lua_check_trie (L, 1);
struct rspamd_task *task = lua_check_task (L, 2);
const gchar *text;
diff --git a/src/lua/lua_upstream.c b/src/lua/lua_upstream.c
index 0d1246229..854bfafd9 100644
--- a/src/lua/lua_upstream.c
+++ b/src/lua/lua_upstream.c
@@ -104,6 +104,7 @@ lua_check_upstream (lua_State * L)
static gint
lua_upstream_get_addr (lua_State *L)
{
+ LUA_TRACE_POINT;
struct upstream *up = lua_check_upstream (L);
if (up) {
@@ -123,6 +124,7 @@ lua_upstream_get_addr (lua_State *L)
static gint
lua_upstream_fail (lua_State *L)
{
+ LUA_TRACE_POINT;
struct upstream *up = lua_check_upstream (L);
gboolean fail_addr = FALSE;
@@ -145,6 +147,7 @@ lua_upstream_fail (lua_State *L)
static gint
lua_upstream_ok (lua_State *L)
{
+ LUA_TRACE_POINT;
struct upstream *up = lua_check_upstream (L);
if (up) {
@@ -176,6 +179,7 @@ lua_check_upstream_list (lua_State * L)
static gint
lua_upstream_list_create (lua_State *L)
{
+ LUA_TRACE_POINT;
struct upstream_list *new = NULL, **pnew;
struct rspamd_config *cfg = NULL;
const gchar *def;
@@ -243,6 +247,7 @@ lua_upstream_list_create (lua_State *L)
static gint
lua_upstream_list_destroy (lua_State *L)
{
+ LUA_TRACE_POINT;
struct upstream_list *upl = lua_check_upstream_list (L);
rspamd_upstreams_destroy (upl);
@@ -259,6 +264,7 @@ lua_upstream_list_destroy (lua_State *L)
static gint
lua_upstream_list_get_upstream_by_hash (lua_State *L)
{
+ LUA_TRACE_POINT;
struct upstream_list *upl;
struct upstream *selected, **pselected;
const gchar *key;
@@ -298,6 +304,7 @@ lua_upstream_list_get_upstream_by_hash (lua_State *L)
static gint
lua_upstream_list_get_upstream_round_robin (lua_State *L)
{
+ LUA_TRACE_POINT;
struct upstream_list *upl;
struct upstream *selected, **pselected;
@@ -329,6 +336,7 @@ lua_upstream_list_get_upstream_round_robin (lua_State *L)
static gint
lua_upstream_list_get_upstream_master_slave (lua_State *L)
{
+ LUA_TRACE_POINT;
struct upstream_list *upl;
struct upstream *selected, **pselected;
@@ -373,6 +381,7 @@ static void lua_upstream_inserter (struct upstream *up, guint idx, void *ud)
static gint
lua_upstream_list_all_upstreams (lua_State *L)
{
+ LUA_TRACE_POINT;
struct upstream_list *upl;
upl = lua_check_upstream_list (L);
diff --git a/src/lua/lua_url.c b/src/lua/lua_url.c
index c36590e21..1507684cc 100644
--- a/src/lua/lua_url.c
+++ b/src/lua/lua_url.c
@@ -117,6 +117,7 @@ lua_check_url (lua_State * L, gint pos)
static gint
lua_url_get_length (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_url *url = lua_check_url (L, 1);
if (url != NULL) {
@@ -136,6 +137,7 @@ lua_url_get_length (lua_State *L)
static gint
lua_url_get_host (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_url *url = lua_check_url (L, 1);
if (url != NULL) {
@@ -155,6 +157,7 @@ lua_url_get_host (lua_State *L)
static gint
lua_url_get_port (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_url *url = lua_check_url (L, 1);
if (url != NULL) {
@@ -174,6 +177,7 @@ lua_url_get_port (lua_State *L)
static gint
lua_url_get_user (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_url *url = lua_check_url (L, 1);
if (url != NULL && url->url->user != NULL) {
@@ -194,6 +198,7 @@ lua_url_get_user (lua_State *L)
static gint
lua_url_get_path (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_url *url = lua_check_url (L, 1);
if (url != NULL && url->url->datalen > 0) {
@@ -214,6 +219,7 @@ lua_url_get_path (lua_State *L)
static gint
lua_url_get_query (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_url *url = lua_check_url (L, 1);
if (url != NULL && url->url->querylen > 0) {
@@ -234,6 +240,7 @@ lua_url_get_query (lua_State *L)
static gint
lua_url_get_fragment (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_url *url = lua_check_url (L, 1);
if (url != NULL && url->url->fragmentlen > 0) {
@@ -254,6 +261,7 @@ lua_url_get_fragment (lua_State *L)
static gint
lua_url_get_text (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_url *url = lua_check_url (L, 1);
if (url != NULL) {
@@ -274,6 +282,7 @@ lua_url_get_text (lua_State *L)
static gint
lua_url_get_raw (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_url *url = lua_check_url (L, 1);
if (url != NULL) {
@@ -294,6 +303,7 @@ lua_url_get_raw (lua_State *L)
static gint
lua_url_is_phished (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_url *url = lua_check_url (L, 1);
if (url != NULL) {
@@ -314,6 +324,7 @@ lua_url_is_phished (lua_State *L)
static gint
lua_url_is_redirected (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_url *url = lua_check_url (L, 1);
if (url != NULL) {
@@ -334,6 +345,7 @@ lua_url_is_redirected (lua_State *L)
static gint
lua_url_is_obscured (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_url *url = lua_check_url (L, 1);
if (url != NULL) {
@@ -355,6 +367,7 @@ lua_url_is_obscured (lua_State *L)
static gint
lua_url_is_html_displayed (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_url *url = lua_check_url (L, 1);
if (url != NULL) {
@@ -375,6 +388,7 @@ lua_url_is_html_displayed (lua_State *L)
static gint
lua_url_is_subject (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_url *url = lua_check_url (L, 1);
if (url != NULL) {
@@ -395,6 +409,7 @@ lua_url_is_subject (lua_State *L)
static gint
lua_url_get_tag (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_url *url = lua_check_url (L, 1);
guint i;
const gchar *tag = luaL_checkstring (L, 2);
@@ -440,6 +455,7 @@ lua_url_get_tag (lua_State *L)
static gint
lua_url_get_tags (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_url *url = lua_check_url (L, 1);
guint i;
GHashTableIter it;
@@ -485,6 +501,7 @@ lua_url_get_tags (lua_State *L)
static gint
lua_url_add_tag (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_url *url = lua_check_url (L, 1);
rspamd_mempool_t *mempool = rspamd_lua_check_mempool (L, 4);
const gchar *tag = luaL_checkstring (L, 2);
@@ -515,6 +532,7 @@ lua_url_add_tag (lua_State *L)
static gint
lua_url_get_phished (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_url *purl, *url = lua_check_url (L, 1);
if (url) {
@@ -542,6 +560,7 @@ lua_url_get_phished (lua_State *L)
static gint
lua_url_get_tld (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_url *url = lua_check_url (L, 1);
if (url != NULL && url->url->tldlen > 0) {
@@ -562,6 +581,7 @@ lua_url_get_tld (lua_State *L)
static gint
lua_url_get_count (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_url *url = lua_check_url (L, 1);
if (url != NULL && url->url != NULL) {
@@ -589,6 +609,7 @@ lua_url_get_count (lua_State *L)
static gint
lua_url_to_table (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_url *url = lua_check_url (L, 1);
struct rspamd_url *u;
@@ -696,6 +717,7 @@ lua_url_single_inserter (struct rspamd_url *url, gsize start_offset,
static gint
lua_url_create (lua_State *L)
{
+ LUA_TRACE_POINT;
rspamd_mempool_t *pool;
const gchar *text;
size_t length;
@@ -774,6 +796,7 @@ lua_url_table_inserter (struct rspamd_url *url, gsize start_offset,
static gint
lua_url_all (lua_State *L)
{
+ LUA_TRACE_POINT;
rspamd_mempool_t *pool = rspamd_lua_check_mempool (L, 1);
const gchar *text;
size_t length;
@@ -832,6 +855,7 @@ lua_url_all (lua_State *L)
static gint
lua_url_get_flags (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_url *url = lua_check_url (L, 1);
enum rspamd_url_flags flags;
diff --git a/src/lua/lua_util.c b/src/lua/lua_util.c
index af1c13ad2..49d643087 100644
--- a/src/lua/lua_util.c
+++ b/src/lua/lua_util.c
@@ -629,6 +629,7 @@ lua_check_int64 (lua_State * L, gint pos)
static gint
lua_util_create_event_base (lua_State *L)
{
+ LUA_TRACE_POINT;
struct event_base **pev_base;
pev_base = lua_newuserdata (L, sizeof (struct event_base *));
@@ -641,6 +642,7 @@ lua_util_create_event_base (lua_State *L)
static gint
lua_util_load_rspamd_config (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg, **pcfg;
const gchar *cfg_name;
@@ -705,6 +707,7 @@ parse_config_options (const char *str_options)
static gint
lua_util_config_from_ucl (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = NULL, **pcfg;
struct rspamd_rcl_section *top;
GError *err = NULL;
@@ -764,6 +767,7 @@ lua_util_task_fin (struct rspamd_task *task, void *ud)
static gint
lua_util_process_message (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *message;
gsize mlen;
@@ -824,6 +828,7 @@ lua_util_process_message (lua_State *L)
static gint
lua_util_encode_base64 (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_text *t;
const gchar *s = NULL;
gchar *out;
@@ -896,6 +901,7 @@ lua_util_encode_base64 (lua_State *L)
static gint
lua_util_decode_base64 (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_text *t;
const gchar *s = NULL;
gsize inlen, outlen;
@@ -952,6 +958,7 @@ lua_util_decode_base64 (lua_State *L)
static gint
lua_util_encode_base32 (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_text *t;
const gchar *s = NULL;
gchar *out;
@@ -995,6 +1002,7 @@ lua_util_encode_base32 (lua_State *L)
static gint
lua_util_decode_base32 (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_text *t;
const gchar *s = NULL;
gsize inlen, outlen;
@@ -1028,6 +1036,7 @@ lua_util_decode_base32 (lua_State *L)
static gint
lua_util_decode_url (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_text *t;
const gchar *s = NULL;
gsize inlen;
@@ -1063,6 +1072,7 @@ lua_util_decode_url (lua_State *L)
static gint
lua_util_tokenize_text (lua_State *L)
{
+ LUA_TRACE_POINT;
const gchar *in = NULL;
gsize len, pos, ex_len, i;
GList *exceptions = NULL, *cur;
@@ -1155,6 +1165,7 @@ lua_util_tokenize_text (lua_State *L)
static gint
lua_util_tanh (lua_State *L)
{
+ LUA_TRACE_POINT;
gdouble in = luaL_checknumber (L, 1);
lua_pushnumber (L, tanh (in));
@@ -1165,6 +1176,7 @@ lua_util_tanh (lua_State *L)
static gint
lua_util_parse_html (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_text *t;
const gchar *start = NULL;
gsize len;
@@ -1212,6 +1224,7 @@ lua_util_parse_html (lua_State *L)
static gint
lua_util_levenshtein_distance (lua_State *L)
{
+ LUA_TRACE_POINT;
const gchar *s1, *s2;
gsize s1len, s2len;
gint dist = 0;
@@ -1237,6 +1250,7 @@ lua_util_levenshtein_distance (lua_State *L)
static gint
lua_util_parse_addr (lua_State *L)
{
+ LUA_TRACE_POINT;
GPtrArray *addrs;
gsize len;
const gchar *str = luaL_checklstring (L, 1, &len);
@@ -1280,6 +1294,7 @@ lua_util_parse_addr (lua_State *L)
static gint
lua_util_fold_header (lua_State *L)
{
+ LUA_TRACE_POINT;
const gchar *name, *value, *how, *stop_chars = NULL;
GString *folded;
@@ -1329,6 +1344,7 @@ lua_util_fold_header (lua_State *L)
static gint
lua_util_is_uppercase (lua_State *L)
{
+ LUA_TRACE_POINT;
const gchar *str;
gsize sz;
gint32 i = 0;
@@ -1367,6 +1383,7 @@ lua_util_is_uppercase (lua_State *L)
static gint
lua_util_humanize_number (lua_State *L)
{
+ LUA_TRACE_POINT;
gdouble number = luaL_checknumber (L, 1);
gchar numbuf[32];
@@ -1380,6 +1397,7 @@ lua_util_humanize_number (lua_State *L)
static gint
lua_util_get_tld (lua_State *L)
{
+ LUA_TRACE_POINT;
const gchar *host;
gsize hostlen;
rspamd_ftok_t tld;
@@ -1405,6 +1423,7 @@ lua_util_get_tld (lua_State *L)
static gint
lua_util_glob (lua_State *L)
{
+ LUA_TRACE_POINT;
const gchar *pattern;
glob_t gl;
gint top, i, flags;
@@ -1436,6 +1455,7 @@ lua_util_glob (lua_State *L)
static gint
lua_util_parse_mail_address (lua_State *L)
{
+ LUA_TRACE_POINT;
GPtrArray *addrs;
gsize len;
const gchar *str = luaL_checklstring (L, 1, &len);
@@ -1479,6 +1499,7 @@ lua_util_parse_mail_address (lua_State *L)
static gint
lua_util_strlen_utf8 (lua_State *L)
{
+ LUA_TRACE_POINT;
const gchar *str, *end;
gsize len;
@@ -1505,6 +1526,7 @@ lua_util_strlen_utf8 (lua_State *L)
static gint
lua_util_strcasecmp_utf8 (lua_State *L)
{
+ LUA_TRACE_POINT;
const gchar *str1, *str2;
gsize len1, len2;
gint ret = -1;
@@ -1532,6 +1554,7 @@ lua_util_strcasecmp_utf8 (lua_State *L)
static gint
lua_util_strcasecmp_ascii (lua_State *L)
{
+ LUA_TRACE_POINT;
const gchar *str1, *str2;
gsize len1, len2;
gint ret = -1;
@@ -1559,6 +1582,7 @@ lua_util_strcasecmp_ascii (lua_State *L)
static gint
lua_util_strequal_caseless (lua_State *L)
{
+ LUA_TRACE_POINT;
const gchar *str1, *str2;
gsize len1, len2;
gint ret = -1;
@@ -1586,6 +1610,7 @@ lua_util_strequal_caseless (lua_State *L)
static gint
lua_util_get_ticks (lua_State *L)
{
+ LUA_TRACE_POINT;
gdouble ticks;
gboolean rdtsc = FALSE;
@@ -1602,6 +1627,7 @@ lua_util_get_ticks (lua_State *L)
static gint
lua_util_get_time (lua_State *L)
{
+ LUA_TRACE_POINT;
gdouble seconds;
struct timeval tv;
@@ -1620,6 +1646,7 @@ lua_util_get_time (lua_State *L)
static gint
lua_util_time_to_string (lua_State *L)
{
+ LUA_TRACE_POINT;
gdouble seconds;
struct timeval tv;
char timebuf[128];
@@ -1645,6 +1672,7 @@ lua_util_time_to_string (lua_State *L)
static gint
lua_util_stat (lua_State *L)
{
+ LUA_TRACE_POINT;
const gchar *fpath;
struct stat st;
@@ -1690,6 +1718,7 @@ lua_util_stat (lua_State *L)
static gint
lua_util_unlink (lua_State *L)
{
+ LUA_TRACE_POINT;
const gchar *fpath;
gint ret;
@@ -1717,6 +1746,7 @@ lua_util_unlink (lua_State *L)
static gint
lua_util_lock_file (lua_State *L)
{
+ LUA_TRACE_POINT;
const gchar *fpath;
gint fd = -1;
gboolean own = FALSE;
@@ -1775,6 +1805,7 @@ lua_util_lock_file (lua_State *L)
static gint
lua_util_unlock_file (lua_State *L)
{
+ LUA_TRACE_POINT;
gint fd = -1, ret, serrno;
gboolean do_close = TRUE;
@@ -1825,6 +1856,7 @@ lua_util_unlock_file (lua_State *L)
static gint
lua_util_create_file (lua_State *L)
{
+ LUA_TRACE_POINT;
gint fd, mode = 00644;
const gchar *fpath;
@@ -1856,6 +1888,7 @@ lua_util_create_file (lua_State *L)
static gint
lua_util_close_file (lua_State *L)
{
+ LUA_TRACE_POINT;
gint fd = -1;
if (lua_isnumber (L, 1)) {
@@ -1880,6 +1913,7 @@ lua_util_close_file (lua_State *L)
static gint
lua_util_random_hex (lua_State *L)
{
+ LUA_TRACE_POINT;
gchar *buf;
gint buflen;
@@ -1900,6 +1934,7 @@ lua_util_random_hex (lua_State *L)
static gint
lua_util_zstd_compress (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_text *t = NULL, *res, tmp;
gsize sz, r;
@@ -1947,6 +1982,7 @@ lua_util_zstd_compress (lua_State *L)
static gint
lua_util_zstd_decompress (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_text *t = NULL, *res;
gsize outlen, sz, r;
ZSTD_DStream *zstream;
@@ -2019,6 +2055,7 @@ lua_util_zstd_decompress (lua_State *L)
static gint
lua_util_gzip_compress (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_text *t = NULL, *res, tmp;
gsize sz;
z_stream strm;
@@ -2104,6 +2141,7 @@ lua_util_gzip_compress (lua_State *L)
static gint
lua_util_gzip_decompress (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_lua_text *t = NULL, *res, tmp;
gsize sz;
z_stream strm;
@@ -2185,6 +2223,7 @@ lua_util_gzip_decompress (lua_State *L)
static gint
lua_util_normalize_prob (lua_State *L)
{
+ LUA_TRACE_POINT;
gdouble x, bias = 0.5;
x = lua_tonumber (L, 1);
@@ -2201,6 +2240,7 @@ lua_util_normalize_prob (lua_State *L)
static gint
lua_util_caseless_hash (lua_State *L)
{
+ LUA_TRACE_POINT;
guint64 seed = 0xdeadbabe, h;
struct rspamd_lua_text *t = NULL;
gint64 *r;
@@ -2237,6 +2277,7 @@ lua_util_caseless_hash (lua_State *L)
static gint
lua_util_caseless_hash_fast (lua_State *L)
{
+ LUA_TRACE_POINT;
guint64 seed = 0xdeadbabe, h;
struct rspamd_lua_text *t = NULL;
gsize sz;
@@ -2280,6 +2321,7 @@ lua_util_caseless_hash_fast (lua_State *L)
static gint
lua_util_is_utf_spoofed (lua_State *L)
{
+ LUA_TRACE_POINT;
gsize l1, l2;
gint ret, nres = 2;
const gchar *s1 = lua_tolstring (L, 1, &l1),
@@ -2361,6 +2403,7 @@ lua_util_is_utf_spoofed (lua_State *L)
static gint
lua_util_get_hostname (lua_State *L)
{
+ LUA_TRACE_POINT;
gchar *hostbuf;
gsize hostlen;
@@ -2385,6 +2428,7 @@ lua_util_get_hostname (lua_State *L)
static gint
lua_util_is_valid_utf8 (lua_State *L)
{
+ LUA_TRACE_POINT;
const gchar *str;
gsize len;
@@ -2403,6 +2447,7 @@ lua_util_is_valid_utf8 (lua_State *L)
static gint
lua_util_readline (lua_State *L)
{
+ LUA_TRACE_POINT;
const gchar *prompt = NULL;
gchar *input;
@@ -2427,6 +2472,7 @@ lua_util_readline (lua_State *L)
static gint
lua_util_readpassphrase (lua_State *L)
{
+ LUA_TRACE_POINT;
gchar test_password[8192];
gsize r;
@@ -2448,6 +2494,7 @@ lua_util_readpassphrase (lua_State *L)
static gint
lua_util_file_exists (lua_State *L)
{
+ LUA_TRACE_POINT;
const gchar *fname = luaL_checkstring (L, 1);
gint serrno;
@@ -2472,6 +2519,7 @@ lua_util_file_exists (lua_State *L)
static gint
lua_util_mkdir (lua_State *L)
{
+ LUA_TRACE_POINT;
const gchar *dname = luaL_checkstring (L, 1);
gboolean recursive = FALSE;
gint r = -1;
@@ -2535,6 +2583,7 @@ lua_util_mkdir (lua_State *L)
static gint
lua_util_umask (lua_State *L)
{
+ LUA_TRACE_POINT;
mode_t mask = 0, old;
if (lua_type (L, 1) == LUA_TSTRING) {
@@ -2566,6 +2615,7 @@ lua_util_umask (lua_State *L)
static gint
lua_util_isatty (lua_State *L)
{
+ LUA_TRACE_POINT;
if (isatty (STDOUT_FILENO)) {
lua_pushboolean (L, true);
}
diff --git a/src/lua/lua_xmlrpc.c b/src/lua/lua_xmlrpc.c
index 4864dbfef..b13c98b8d 100644
--- a/src/lua/lua_xmlrpc.c
+++ b/src/lua/lua_xmlrpc.c
@@ -603,6 +603,7 @@ xmlrpc_error (GMarkupParseContext *context, GError *error, gpointer user_data)
static gint
lua_xmlrpc_parse_reply (lua_State *L)
{
+ LUA_TRACE_POINT;
const gchar *data;
GMarkupParseContext *ctx;
GError *err = NULL;
@@ -708,6 +709,7 @@ lua_xmlrpc_parse_table (lua_State *L,
static gint
lua_xmlrpc_make_request (lua_State *L)
{
+ LUA_TRACE_POINT;
gchar databuf[BUFSIZ * 2];
const gchar *func;
gint r, top, i, num;