]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Check received for not more than 5 recipients.
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 28 May 2012 13:33:54 +0000 (17:33 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 28 May 2012 13:33:54 +0000 (17:33 +0400)
Install lua configuration by default (as user's one should be in rspamd.local.lua).

CMakeLists.txt
conf/lua/regexp/headers.lua

index 690ac352d423b850470be1f686e22bccdf963696..025b6ff0f8836a7d7a5ed839be035e506e160373 100644 (file)
@@ -1006,9 +1006,7 @@ FILE(GLOB_RECURSE LUA_CONFIGS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/conf/lua" "$
 FOREACH(LUA_CONF ${LUA_CONFIGS})
        GET_FILENAME_COMPONENT(_rp ${LUA_CONF} PATH)
        INSTALL(CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}${ETC_PREFIX}/rspamd/lua/${_rp})")
-       IF(NOT EXISTS ${DESTDIR}/${ETC_PREFIX}/rspamd/lua/${LUA_CONF} OR BUILD_PORT)
-               INSTALL(FILES "conf/lua/${LUA_CONF}" DESTINATION ${ETC_PREFIX}/rspamd/lua/${_rp})
-       ENDIF(NOT EXISTS ${DESTDIR}/${ETC_PREFIX}/rspamd/lua/${LUA_CONF} OR BUILD_PORT)
+       INSTALL(FILES "conf/lua/${LUA_CONF}" DESTINATION ${ETC_PREFIX}/rspamd/lua/${_rp})
 ENDFOREACH(LUA_CONF)
 
 # Manual pages
index 11460961da5b7d5b1b886d1a320027d10a21c0c5..196a6bc27a8e1295ba324236b6beb84e6d70c406 100644 (file)
@@ -432,8 +432,9 @@ end
 reconf['INVALID_POSTFIX_RECEIVED'] =   'Received=/ \\(Postfix\\) with ESMTP id [A-Z\\d]+([\\s\\r\\n]+for <\\S+?>)?;[\\s\\r\\n]*[A-Z][a-z]{2}, \\d{1,2} [A-Z][a-z]{2} \\d\\d\\d\\d \\d\\d:\\d\\d:\\d\\d [\\+\\-]\\d\\d\\d\\d$/X'
 
 reconf['INVALID_EXIM_RECEIVED'] = function (task)
+       local checked = 0
        local headers_to = task:get_message():get_header('To')
-       if headers_to and table.maxn(headers_to) < 5 then
+       if headers_to then
                local headers_recv = task:get_raw_header('Received')
                local regexp_text = '^[^\\n]*?<?\\S+?\\@(\\S+)>?\\|.*from \\d+\\.\\d+\\.\\d+\\.\\d+ \\(HELO \\S+\\)[\\s\\r\\n]*by \\1 with esmtp \\(\\S*?[\\?\\@\\(\\)\\s\\.\\+\\*\'\'\\/\\\\,]\\S*\\)[\\s\\r\\n]+id \\S*?[\\)\\(<>\\/\\\\,\\-:=]'
                local re = regexp.get_cached(regexp_text)
@@ -445,6 +446,11 @@ reconf['INVALID_EXIM_RECEIVED'] = function (task)
                                return true
                                end
                                end
+                               checked = checked + 1
+                               if checked > 5 then
+                                       -- Stop on 5 rcpt
+                                       return false
+                               end
                        end
                end
        end
@@ -452,8 +458,9 @@ reconf['INVALID_EXIM_RECEIVED'] = function (task)
 end
 
 reconf['INVALID_EXIM_RECEIVED2'] = function (task)
+       local checked = 0
        local headers_to = task:get_message():get_header('To')
-       if headers_to and table.maxn(headers_to) < 5 then
+       if headers_to then
                local headers_recv = task:get_raw_header('Received')
                local regexp_text = '^[^\\n]*?<?\\S+?\\@(\\S+)>?\\|.*from \\d+\\.\\d+\\.\\d+\\.\\d+ \\(HELO \\S+\\)[\\s\\r\\n]*by \\1 with esmtp \\([A-Z]{9,12} [A-Z]{5,6}\\)[\\s\\r\\n]+id [a-zA-Z\\d]{6}-[a-zA-Z\\d]{6}-[a-zA-Z\\d]{2}[\\s\\r\\n]+'
                local re = regexp.get_cached(regexp_text)
@@ -465,6 +472,11 @@ reconf['INVALID_EXIM_RECEIVED2'] = function (task)
                                return true
                                end
                                end
+                               checked = checked + 1
+                               if checked > 5 then
+                                       -- Stop on 5 rcpt
+                                       return false
+                               end
                        end
                end
        end