]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Return nil if unknown processor was used 2514/head
authorMikhail Galanin <mgalanin@mimecast.com>
Fri, 21 Sep 2018 11:24:41 +0000 (12:24 +0100)
committerMikhail Galanin <mgalanin@mimecast.com>
Fri, 21 Sep 2018 11:24:41 +0000 (12:24 +0100)
lualib/lua_selectors.lua

index 7de1a10d891138b80330267f2d25f356e93e0a4a..21efc4573dbc60b37ea951b31d628355633f902a 100644 (file)
@@ -772,6 +772,7 @@ exports.parse_selector = function(cfg, str)
     lua_util.debugm(M, cfg, 'processed selector %s, args: %s',
         res.selector.name, res.selector.args)
 
+    local it_happened = false
     -- Now process processors pipe
     fun.each(function(proc_tbl)
       local proc_name = proc_tbl[1]
@@ -804,6 +805,7 @@ exports.parse_selector = function(cfg, str)
 
         if not transform_function[proc_name] then
           logger.errx(cfg, 'processor %s is unknown', proc_name)
+          it_happened = true
           return nil
         end
         local processor = lua_util.shallowcopy(transform_function[proc_name])
@@ -815,6 +817,11 @@ exports.parse_selector = function(cfg, str)
       end
     end, fun.tail(sel))
 
+    if it_happened then
+      logger.errx(cfg, 'unknown processor used, exiting')
+      return nil
+    end
+
     table.insert(output, res)
   end