]> source.dussan.org Git - rspamd.git/commitdiff
Fix forged recipients plugin for the modern rspamd.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 13 May 2015 09:57:14 +0000 (10:57 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 13 May 2015 09:57:14 +0000 (10:57 +0100)
src/plugins/lua/forged_recipients.lua

index b7f283cf8d0681b35c5ce7410ef8e5c002e0d228..6c553aa0445ffdef8ef2959ccc9e1cc9d4fe6405 100644 (file)
@@ -27,10 +27,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 -- Plugin for comparing smtp dialog recipients and sender with recipients and sender
 -- in mime headers
 
+local logger = require "rspamd_logger"
 local symbol_rcpt = 'FORGED_RECIPIENTS'
 local symbol_sender = 'FORGED_SENDER'
 
-function check_forged_headers(task)
+local function check_forged_headers(task)
        local smtp_rcpt = task:get_recipients(1)
        local res = false
        
@@ -85,21 +86,12 @@ if opts then
        if opts['symbol_rcpt'] or opts['symbol_sender'] then
                if opts['symbol_rcpt'] then
                        symbol_rcpt = opts['symbol_rcpt']
-                       if type(rspamd_config.get_api_version) ~= 'nil' then
-                               rspamd_config:register_virtual_symbol(symbol_rcpt, 1.0, 'check_forged_headers')
-                       end
+                       rspamd_config:register_virtual_symbol(symbol_rcpt, 1.0, check_forged_headers)
                end
                if opts['symbol_sender'] then
                        symbol_sender = opts['symbol_sender']
-                       if type(rspamd_config.get_api_version) ~= 'nil' then
-                               rspamd_config:register_virtual_symbol(symbol_sender, 1.0)
-                       end
+                       rspamd_config:register_virtual_symbol(symbol_sender, 1.0)
                end
-               if type(rspamd_config.get_api_version) ~= 'nil' then
-                       rspamd_config:register_callback_symbol('FORGED_RECIPIENTS', 1.0, 'check_forged_headers')
-               else
-                       rspamd_config:register_symbol('FORGED_RECIPIENTS', 1.0, 'check_forged_headers')
-               end
-               
+               rspamd_config:register_callback_symbol('FORGED_RECIPIENTS', 1.0, check_forged_headers)
        end
-end
+end
\ No newline at end of file