]> source.dussan.org Git - rspamd.git/commitdiff
Revert "[Feature] Add common way to disable Lua modules"
authorAndrew Lewis <nerf@judo.za.org>
Mon, 5 Sep 2016 06:48:00 +0000 (08:48 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Mon, 5 Sep 2016 07:03:11 +0000 (09:03 +0200)
This reverts commit f552edd887794a5086dcf93d36f8f82d83553196.

Conflicts:
src/plugins/lua/antivirus.lua
src/plugins/lua/asn.lua
src/plugins/lua/dcc.lua
src/plugins/lua/dmarc.lua
src/plugins/lua/emails.lua
src/plugins/lua/forged_recipients.lua
src/plugins/lua/greylist.lua
src/plugins/lua/hfilter.lua
src/plugins/lua/ip_score.lua
src/plugins/lua/maillist.lua
src/plugins/lua/mime_types.lua
src/plugins/lua/multimap.lua
src/plugins/lua/once_received.lua
src/plugins/lua/ratelimit.lua
src/plugins/lua/rbl.lua
src/plugins/lua/replies.lua
src/plugins/lua/rspamd_update.lua
src/plugins/lua/trie.lua
src/plugins/lua/whitelist.lua

23 files changed:
src/plugins/lua/antivirus.lua
src/plugins/lua/asn.lua
src/plugins/lua/dcc.lua
src/plugins/lua/dmarc.lua
src/plugins/lua/emails.lua
src/plugins/lua/fann_scores.lua
src/plugins/lua/forged_recipients.lua
src/plugins/lua/greylist.lua
src/plugins/lua/hfilter.lua
src/plugins/lua/ip_score.lua
src/plugins/lua/maillist.lua
src/plugins/lua/mime_types.lua
src/plugins/lua/multimap.lua
src/plugins/lua/once_received.lua
src/plugins/lua/phishing.lua
src/plugins/lua/ratelimit.lua
src/plugins/lua/rbl.lua
src/plugins/lua/replies.lua
src/plugins/lua/rspamd_update.lua
src/plugins/lua/settings.lua
src/plugins/lua/spamassassin.lua
src/plugins/lua/trie.lua
src/plugins/lua/whitelist.lua

index 19466678ef9033468f39a3d8d5f3192df9789e20..96a723fe0a18d0881be1e42bc72bc52ed9c83fe1 100644 (file)
@@ -273,10 +273,6 @@ end
 -- Registration
 local opts = rspamd_config:get_all_opt('antivirus')
 if opts and type(opts) == 'table' then
-  if opts['enabled'] == false then
-    rspamd_logger.infox(rspamd_config, 'module is disabled')
-    return
-  end
   redis_params = rspamd_parse_redis_server('antivirus')
   for k, m in pairs(opts) do
     if type(m) == 'table' and m['type'] then
index 74672af271bebf87d8f3433f30f71c3e78aad552..25b684dc47ebd34c9e1aa878549b32c260c135be 100644 (file)
@@ -74,10 +74,6 @@ end
 local configure_asn_module = function()
   local opts =  rspamd_config:get_all_opt('asn')
   if opts then
-    if opts['enabled'] == false then
-      rspamd_logger.infox(rspamd_config, 'module is disabled')
-      return
-    end
     for k,v in pairs(opts) do
       options[k] = v
     end
index 7c3616073c1042c8b14f871e051c6cb4d3a931a2..216139fabd238d585d1d00a64b395e1b19a19b10 100644 (file)
@@ -116,10 +116,6 @@ end
 
 -- Configuration
 if opts and opts['host'] then
-  if opts['enabled'] == false then
-    logger.infox(rspamd_config, 'module is disabled')
-    return
-  end
   rspamd_config:register_symbol({
     name = symbol_bulk,
     callback = check_dcc
index f2faef89fd2ec6d4933039709ca0cc925b8423cc..fc85c47662e2dbf0ecbd91254cb9cf63447c6eab 100644 (file)
@@ -328,11 +328,6 @@ if not opts or type(opts) ~= 'table' then
   return
 end
 
-if opts['enabled'] == false then
-  rspamd_logger.infox(rspamd_config, 'module is disabled')
-  return
-end
-
 if opts['symbols'] then
   for k,_ in pairs(dmarc_symbols) do
     if opts['symbols'][k] then
index 3d0fddd6aa945893066c7d342b4aca3770b24f65..9d9a54d03c2bda3437a28b170705ade2fce99e09 100644 (file)
@@ -81,10 +81,6 @@ end
 
 local opts =  rspamd_config:get_all_opt('emails', 'rule')
 if opts and type(opts) == 'table' then
-  if opts['enabled'] == false then
-    logger.infox(rspamd_config, 'module is disabled')
-    return
-  end
   local r = opts['rule']
 
   if r then
index cafa5befa73a20a9e7ce181ecf97587fb74f6970..fc9ea59c983f5361a8584f6767fb843efe53f2cc 100644 (file)
@@ -39,10 +39,7 @@ local max_epoch = 100
 local use_settings = false
 local opts = rspamd_config:get_all_opt("fann_scores")
 if not (opts and type(opts) == 'table') then
-  rspamd_logger.infox('Module is unconfigured')
-  return
-elseif opts['enabled'] == false then
-  rspamd_logger.info('Module is disabled')
+  rspamd_logger.infox(rspamd_config, 'Module is unconfigured')
   return
 end
 
index 4c52295b9d94f35f10b2645513a342bf057d88fd..957491a56df4f898a28b738ec07d0b27f28aea6c 100644 (file)
@@ -72,10 +72,6 @@ end
 -- Configuration
 local opts =  rspamd_config:get_all_opt('forged_recipients')
 if opts then
-  if opts['enabled'] == false then
-    logger.infox(rspamd_config, 'Module is disabled')
-    return
-  end
   if opts['symbol_rcpt'] or opts['symbol_sender'] then
     local id = rspamd_config:register_symbol({
       callback = check_forged_headers,
index 71a8a86cae23cf65776c0b7af51fe701d7bcad3c..05afaeab6875d4245ed6cd15c4b2896de82d233f 100644 (file)
@@ -321,10 +321,6 @@ end
 
 local opts =  rspamd_config:get_all_opt('greylist')
 if opts then
-  if opts['enabled'] == false then
-    rspamd_logger.infox(rspamd_config, 'module is disabled')
-    return
-  end
   if opts['whitelisted_ip'] then
     whitelisted_ip = rspamd_config:add_radix_map(opts['whitelisted_ip'],
       'Greylist whitelist ip map')
index b11b567b74fe1b64c364832c2e68eb2fa59576c4..34a679641581a42d9a1dceee8cd04758548f61d9 100644 (file)
@@ -481,10 +481,6 @@ local symbols_from = {
 
 local opts = rspamd_config:get_all_opt('hfilter')
 if opts then
-  if opts['enabled'] == false then
-    rspamd_logger.infox(rspamd_config, 'module is disabled')
-    return
-  end
   for k,v in pairs(opts) do
     config[k] = v
   end
index bb6119bdafb0acf5d3e7b662cc2fe7815c652be7..6b6ac900a6141f57fd028bde9eb94284e85c22f9 100644 (file)
@@ -317,10 +317,6 @@ end
 local configure_ip_score_module = function()
   local opts =  rspamd_config:get_all_opt('ip_score')
   if opts then
-    if opts['enabled'] == false then
-      rspamd_logger.infox(rspamd_config, 'module is disabled')
-      return
-    end
     for k,v in pairs(opts) do
       options[k] = v
     end
index 4ec0a41f17dcade0251a0af77eb45d7bdb92a0f4..1e4c104ded3d3498668dfa4f74aa0bab28ffda9f 100644 (file)
@@ -272,10 +272,6 @@ end
 -- Configuration
 local opts =  rspamd_config:get_all_opt('maillist')
 if opts then
-  if opts['enabled'] == false then
-    rspamd_logger.infox(rspamd_config, 'module is disabled')
-    return
-  end
   if opts['symbol'] then
     symbol = opts['symbol']
     rspamd_config:register_symbol({
index ad725820b7d1e7070675c9c6352b0e516ec040ef..e1b2123f44aea9d91995bf49235df9bb0917af04 100644 (file)
@@ -200,10 +200,6 @@ end
 
 local opts =  rspamd_config:get_all_opt('mime_types')
 if opts then
-  if opts['enabled'] == false then
-    rspamd_logger.infox(rspamd_config, 'module is disabled')
-    return
-  end
   for k,v in pairs(opts) do
     settings[k] = v
   end
index a1333d7d9a1b8bf4f1037bf4af789d06972fcb1d..f21bc5b117ca40ff35e6e27e184d8a98af380fd7 100644 (file)
@@ -774,10 +774,6 @@ end
 -- Registration
 local opts =  rspamd_config:get_all_opt('multimap')
 if opts and type(opts) == 'table' then
-  if opts['enabled'] == false then
-    rspamd_logger.infox(rspamd_config, 'module is disabled')
-    return
-  end
   redis_params = rspamd_parse_redis_server('multimap')
   for k,m in pairs(opts) do
     if type(m) == 'table' and m['type'] then
index 84b0e48b4453ba94c34f86f0be8d94b7dd144973..63de22776be059cfe0b64165ca895ff83729daba 100644 (file)
@@ -142,10 +142,6 @@ end
 -- Configuration
 local opts =  rspamd_config:get_all_opt('once_received')
 if opts then
-  if opts['enabled'] == false then
-    rspamd_logger.infox(rspamd_config, 'module is disabled')
-    return
-  end
   if opts['symbol'] then
     local symbol = opts['symbol']
 
index e38ceeac9777d09a18c4030e77a5b9093c0c9e56..adddce2559815cff3a3ac5a76265bfb0643b4799 100644 (file)
@@ -36,10 +36,7 @@ local rspamd_logger = require "rspamd_logger"
 local util = require "rspamd_util"
 local opts = rspamd_config:get_all_opt('phishing')
 if not (opts and type(opts) == 'table') then
-  rspamd_logger.info('Module is unconfigured')
-  return
-elseif opts['enabled'] == false then
-  rspamd_logger.info('Module is disabled')
+  rspamd_logger.infox(rspamd_config, 'Module is unconfigured')
   return
 end
 
@@ -334,9 +331,6 @@ local function phishtank_json_cb(string)
 end
 
 if opts then
-  if opts['enabled'] == false then
-    rspamd_logger.infox(rspamd_config, 'module is disabled')
-  end
   if opts['symbol'] then
     symbol = opts['symbol']
     -- Register symbol's callback
index 2e67a55244525baa8b033c82dd4e31673804884c..48052502f887cea1b8d07a0356f7f7321bf76bd1 100644 (file)
@@ -442,10 +442,6 @@ end
 
 local opts = rspamd_config:get_all_opt('ratelimit')
 if opts then
-  if opts['enabled'] == false then
-    rspamd_logger.infox(rspamd_config, 'module is disabled')
-    return
-  end
   local rates = opts['limit']
   if rates and type(rates) == 'table' then
     fun.each(parse_limit, rates)
index f22199b63ada8b7f2e1fc93913651f9b4227a392..50a49adcdaeff0bcc80694f5061e26103ac51e40 100644 (file)
@@ -386,9 +386,7 @@ end
 -- Configuration
 local opts = rspamd_config:get_all_opt('rbl')
 if not (opts and type(opts) == 'table') then
-  rspamd_logger.info('Module is unconfigured')
-elseif opts['enabled'] == false then
-  rspamd_logger.infox(rspamd_config, 'module is disabled')
+  rspamd_logger.infox(rspamd_config, 'Module is unconfigured')
   return
 end
 
index d6793a3d87f4077158a599eaa685cde472aa6e20..9916dc3cf6d384684eb587f0949d072d375a06ef 100644 (file)
@@ -108,14 +108,11 @@ local function replies_set(task)
 end
 
 local opts = rspamd_config:get_all_opt('replies')
+if not (opts and type(opts) == 'table') then
+  rspamd_logger.infox(rspamd_config, 'module is unconfigured')
+  return 
+end
 if opts then
-  if not (opts and type(opts) == 'table') then
-    rspamd_logger.infox(rspamd_config, 'module is unconfigured')
-    return
-  elseif opts['enabled'] == false then
-    rspamd_logger.infox(rspamd_config, 'module is disabled')
-    return
-  end
   redis_params = rspamd_parse_redis_server('replies')
   if not redis_params then
     rspamd_logger.infox(rspamd_config, 'no servers are specified, disabling module')
index 779cec2ddc93f9ef79b78286b5f281b2f08cc19a..19e481019d8bed86dfdc142f5d3c71cfaeea48ef 100644 (file)
@@ -125,10 +125,6 @@ end
 -- Configuration part
 local section = rspamd_config:get_all_opt("rspamd_update")
 if section then
-  if section['enabled'] == false then
-    rspamd_logger.infox(rspamd_config, 'module is disabled')
-    return
-  end
   local trusted_key
   each(function(k, elt)
     if k == 'priority' then
@@ -158,5 +154,5 @@ if section then
     end
   end, maps)
 else
-  rspamd_logger.infox('Module is unconfigured')
+  rspamd_logger.infox(rspamd_config, 'Module is unconfigured')
 end
index e857d7f8ec3db2933779b865963cd2640377131b..b25698f279f48c1a31f84b9b4f72d04fe2edb210 100644 (file)
@@ -21,10 +21,7 @@ limitations under the License.
 local rspamd_logger = require "rspamd_logger"
 local set_section = rspamd_config:get_all_opt("settings")
 if not (set_section and type(set_section) == 'table') then
-  rspamd_logger.infox('Module is unconfigured')
-elseif set_section['enabled'] == false then
-  rspamd_logger.infox('Module is disabled')
-  return
+  rspamd_logger.infox(rspamd_config, 'Module is unconfigured')
 end
 
 local settings = {
index 533b83864fdce64cd25d1eb7de90c241a5b4b4f7..a752f67a50b8ba655841a14c23e8fe6f9d6e3277 100644 (file)
@@ -115,10 +115,7 @@ local sa_lists = {
 local func_cache = {}
 local section = rspamd_config:get_all_opt("spamassassin")
 if not (section and type(section) == 'table') then
-  rspamd_logger.info('Module is unconfigured')
-elseif section['enabled'] == false then
-  rspamd_logger.info('Module is disabled')
-  return
+  rspamd_logger.infox(rspamd_config, 'Module is unconfigured')
 end
 
 -- Minimum score to treat symbols as meta
index 927efbc26c987a685dd78ebcfc6920eba384275a..ebc4e2a7e43fa4af56c919d6f8059f4bd2d1a5d2 100644 (file)
@@ -130,10 +130,6 @@ end
 
 local opts =  rspamd_config:get_all_opt("trie")
 if opts then
-  if opts['enabled'] == false then
-    rspamd_logger.infox(rspamd_config, 'module is disabled')
-    return
-  end
   for sym, opt in pairs(opts) do
      process_trie_conf(sym, opt)
   end
@@ -173,5 +169,5 @@ if opts then
     end
   end
 else
-  rspamd_logger.info("Module is unconfigured")
+  rspamd_logger.infox(rspamd_config, "Module is unconfigured")
 end
index 7344a1d67ae825a784d7ffccd92a4682b46ead5c..517b4e63b030bb48c8879cf777a0c8ddce41d3a7 100644 (file)
@@ -185,10 +185,6 @@ end
 local configure_whitelist_module = function()
   local opts =  rspamd_config:get_all_opt('whitelist')
   if opts then
-    if opts['enabled'] == false then
-      rspamd_logger.infox(rspamd_config, 'module is disabled')
-      return
-    end
     for k,v in pairs(opts) do
       options[k] = v
     end