]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Lua_task: Log when an unknown symbol is inserted from Lua
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 11 Jun 2020 13:46:59 +0000 (14:46 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 11 Jun 2020 13:46:59 +0000 (14:46 +0100)
src/lua/lua_task.c

index 6437b0dadae2a4c26440f537274812f91f172f11..75c2f0a9982a1e7508e0037f2532be205ac9ae65 100644 (file)
@@ -1944,6 +1944,15 @@ lua_task_insert_result_common (lua_State * L, struct rspamd_scan_result *result,
 
                /* Get additional options */
                if (s) {
+                       if (s->sym == NULL) {
+                               /* Unknown symbol, print traceback */
+                               lua_pushfstring (L, "unknown symbol %s", symbol_name);
+                               rspamd_lua_traceback (L);
+
+                               msg_info_task ("symbol insertion issue: %s", lua_tostring (L, -1));
+
+                               lua_pop (L, 1); /* Traceback string */
+                       }
                        for (i = args_start + 2; i <= top; i++) {
                                gint ltype = lua_type (L, i);
 
@@ -2013,6 +2022,14 @@ lua_task_insert_result_common (lua_State * L, struct rspamd_scan_result *result,
                                }
                        }
                }
+               else {
+                       lua_pushfstring (L, "insertion failed for %s", symbol_name);
+                       rspamd_lua_traceback (L);
+
+                       msg_info_task ("symbol insertion issue: %s", lua_tostring (L, -1));
+
+                       lua_pop (L, 2); /* Traceback string + error string */
+               }
 
        }
        else {