]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix custom keywords initialisation
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 13 Jul 2018 21:47:27 +0000 (22:47 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 13 Jul 2018 21:47:27 +0000 (22:47 +0100)
src/plugins/lua/ratelimit.lua

index 73f05a1cf5feb293dcbe9d4b99784fbca263c95a..a84103ff9bff6e33ed520b0b9c0612b9a7fbc83b 100644 (file)
@@ -613,22 +613,23 @@ if opts then
       'Ratelimit whitelist user map')
   end
 
+  settings.custom_keywords = {}
   if opts['custom_keywords'] then
-    local ret, res_or_err = pcall(dofile(opts['custom_keywords']))
+    local ret, res_or_err = pcall(loadfile(opts['custom_keywords']))
 
     if ret then
       opts['custom_keywords'] = {}
       if type(res_or_err) == 'table' then
         for k,hdl in pairs(res_or_err) do
-          opts['custom_keywords'][k] = hdl
+          settings['custom_keywords'][k] = hdl
         end
       elseif type(res_or_err) == 'function' then
-        opts['custom_keywords']['custom'] = res_or_err
+        settings['custom_keywords']['custom'] = res_or_err
       end
     else
       rspamd_logger.errx(rspamd_config, 'cannot execute %s: %s',
           opts['custom_keywords'], res_or_err)
-      opts['custom_keywords'] = {}
+      settings['custom_keywords'] = {}
     end
   end