]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Add fail-safety for settings post load
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 30 Dec 2020 17:00:52 +0000 (17:00 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 30 Dec 2020 17:00:52 +0000 (17:00 +0000)
lualib/lua_settings.lua
src/lua/lua_task.c

index 5779cea85ef2e0ad31724d483d9d78e3e77fee28..e0fc58b9db522b1a796ebc78870a5c457e2ca6a4 100644 (file)
@@ -32,6 +32,10 @@ local lua_util = require "lua_util"
 local rspamd_logger = require "rspamd_logger"
 
 local function register_settings_cb(from_postload)
+  if not from_postload then
+    assert(false, 'invalid invocation')
+  end
+
   if not post_init_performed then
     all_symbols = rspamd_config:get_symbols()
 
index 9cc037796c5798170920f705a579cac6e6c052c8..38b22f48975ec79f591ec8b857162eff85bfe7e7 100644 (file)
@@ -5774,7 +5774,7 @@ lua_task_set_settings_id (lua_State *L)
                                rspamd_config_find_settings_id_ref (task->cfg, id);
 
                if (selt == NULL) {
-                       return luaL_error (L, "settings id %u is unknown", id);
+                       return luaL_error (L, "settings id %f is unknown", (lua_Number)id);
                }
                if (task->settings_elt) {
                        /* Overwrite existing settings from Lua */