]> source.dussan.org Git - rspamd.git/commitdiff
[Project] Encourage dependencies registration by name only
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 15 Mar 2018 16:24:04 +0000 (16:24 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 15 Mar 2018 16:24:04 +0000 (16:24 +0000)
src/plugins/lua/arc.lua
src/plugins/lua/dmarc.lua
src/plugins/lua/force_actions.lua
src/plugins/lua/mid.lua
src/plugins/lua/ratelimit.lua
src/plugins/lua/rbl.lua
src/plugins/lua/reputation.lua
src/plugins/lua/whitelist.lua

index 29faa12589c6d27c3f1cf73201742af5bea120f7..e04e2c067e6ad1806994a4b73927eb3695147523 100644 (file)
@@ -341,8 +341,8 @@ rspamd_config:register_symbol({
   group = 'policies',
 })
 
-rspamd_config:register_dependency(id, symbols['spf_allow_symbol'])
-rspamd_config:register_dependency(id, symbols['dkim_allow_symbol'])
+rspamd_config:register_dependency('ARC_CALLBACK', symbols['spf_allow_symbol'])
+rspamd_config:register_dependency('ARC_CALLBACK', symbols['dkim_allow_symbol'])
 
 local function arc_sign_seal(task, params, header)
   local fold_type = "crlf"
@@ -565,4 +565,4 @@ id = rspamd_config:register_symbol({
 })
 
 -- Do not sign unless valid
-rspamd_config:register_dependency(id, 'ARC_CALLBACK')
+rspamd_config:register_dependency(settings['sign_symbol'], 'ARC_CALLBACK')
index c6e998429e88a51d546a84b11b9cb4894754258f..652526d693fb7ac2fe40b0fb5e26cf3f2010df03 100644 (file)
@@ -1260,6 +1260,6 @@ rspamd_config:register_symbol({
   type = 'virtual'
 })
 
-rspamd_config:register_dependency(id, symbols['spf_allow_symbol'])
-rspamd_config:register_dependency(id, symbols['dkim_allow_symbol'])
+rspamd_config:register_dependency('DMARC_CALLBACK', symbols['spf_allow_symbol'])
+rspamd_config:register_dependency('DMARC_CALLBACK', symbols['dkim_allow_symbol'])
 
index ca960a2e442d2cba59ab34fe00ccb8feaddb5edb..d607e3343b05895304769ceab0b1820697289231 100644 (file)
@@ -121,7 +121,7 @@ local function configure_module()
                 flags = 'empty',
               })
               for _, a in ipairs(atoms) do
-                rspamd_config:register_dependency(id, a)
+                rspamd_config:register_dependency(name, a)
               end
               rspamd_logger.infox(rspamd_config, 'Registered symbol %1 <%2> with dependencies [%3]', name, expr, table.concat(atoms, ','))
             end
@@ -155,7 +155,7 @@ local function configure_module()
           local id = rspamd_config:register_symbol(t)
           if t.type == 'normal' then
             for _, a in ipairs(atoms) do
-              rspamd_config:register_dependency(id, a)
+              rspamd_config:register_dependency(t.name, a)
             end
             rspamd_logger.infox(rspamd_config, 'Registered symbol %1 <%2> with dependencies [%3]', name, expr, table.concat(atoms, ','))
           else
index e1dd9ed5d1fbcbbf5059f1caa326346ad58f65a4..4baa8867cc9f3ba59e2efc6c5ccd763b218613e4 100644 (file)
@@ -96,7 +96,7 @@ if opts then
     rspamd_config:add_composite(settings['csymbol_missing_mid_allowed'],
       settings['symbol_known_no_mid'] .. ' & ' .. settings['symbol_missing_mid'])
 
-    rspamd_config:register_dependency(id, settings['symbol_dkim_allow'])
+    rspamd_config:register_dependency('KNOWN_MID_CALLBACK', settings['symbol_dkim_allow'])
   else
     rspamd_logger.infox(rspamd_config, 'source is not specified, disabling module')
     lua_util.disable_module(N, "config")
index 3bd595d77588ed0574535e99734a1832ade6a748..d2aa1abb104b621473c73bc3c42d327d0b490d42 100644 (file)
@@ -725,7 +725,7 @@ if opts then
     end
     local id = rspamd_config:register_symbol(s)
     if use_ip_score then
-      rspamd_config:register_dependency(id, 'IP_SCORE')
+      rspamd_config:register_dependency(s.name, 'IP_SCORE')
     end
     for _, v in pairs(custom_keywords) do
       if type(v) == 'table' and type(v['init']) == 'function' then
index c3c4e7136a3f22bb04e8b9965a9972c9a0457ab2..588a315673bd5e05fefe39fd0ff0400fc98c4800 100644 (file)
@@ -527,6 +527,7 @@ local need_dkim = false
 local id = rspamd_config:register_symbol({
   type = 'callback',
   callback = rbl_cb,
+  name = 'RBL_CALLBACK',
   flags = 'empty,nice'
 })
 
@@ -652,5 +653,5 @@ for _, w in pairs(white_symbols) do
   end
 end
 if need_dkim then
-  rspamd_config:register_dependency(id, symbols['dkim_allow_symbol'])
+  rspamd_config:register_dependency('RBL_CALLBACK', symbols['dkim_allow_symbol'])
 end
index 251a4cf6467a7be1cfc04d764af3a8d20353d632..1969729acd9b7a258be328bfe734644c3db781d7 100644 (file)
@@ -998,7 +998,7 @@ local function parse_rule(name, tbl)
 
   if rule.selector.dependencies then
     fun.each(function(d)
-      rspamd_config:register_dependency(id, d)
+      rspamd_config:register_dependency(symbol, d)
     end, rule.selector.dependencies)
   end
 
index 8155547662bb70198c0f6229985792ad4014971f..89f382946f17e1a22b5a9f668ff9004b8bb512df 100644 (file)
@@ -264,21 +264,21 @@ local configure_whitelist_module = function()
         local spf_dep = false
         local dkim_dep = false
         if rule['valid_spf'] then
-          rspamd_config:register_dependency(id, options['spf_allow_symbol'])
+          rspamd_config:register_dependency(symbol, options['spf_allow_symbol'])
           spf_dep = true
         end
         if rule['valid_dkim'] then
-          rspamd_config:register_dependency(id, options['dkim_allow_symbol'])
+          rspamd_config:register_dependency(symbol, options['dkim_allow_symbol'])
           dkim_dep = true
         end
         if rule['valid_dmarc'] then
           if not spf_dep then
-            rspamd_config:register_dependency(id, options['spf_allow_symbol'])
+            rspamd_config:register_dependency(symbol, options['spf_allow_symbol'])
           end
           if not dkim_dep then
-            rspamd_config:register_dependency(id, options['dkim_allow_symbol'])
+            rspamd_config:register_dependency(symbol, options['dkim_allow_symbol'])
           end
-          rspamd_config:register_dependency(id, 'DMARC_CALLBACK')
+          rspamd_config:register_dependency(symbol, 'DMARC_CALLBACK')
         end
 
         if rule['score'] then