diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/lua/multimap.lua | 2 | ||||
-rw-r--r-- | src/plugins/lua/phishing.lua | 23 |
2 files changed, 12 insertions, 13 deletions
diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua index 98ebeb353..5d1312dc2 100644 --- a/src/plugins/lua/multimap.lua +++ b/src/plugins/lua/multimap.lua @@ -283,13 +283,13 @@ local function add_multimap_rule(params) if string.find(newrule['map'], '^cdb://.*$') then local test = cdb.create(newrule['map']) newrule['hash'] = cdb.create(newrule['map']) + newrule['cdb'] = true if newrule['hash'] then table.insert(rules, newrule) return newrule else rspamd_logger.warn('Cannot add rule: map doesn\'t exists: ' .. newrule['map']) end - newrule['cdb'] = true else if newrule['type'] == 'ip' then newrule['ips'] = rspamd_config:add_radix_map (newrule['map']) diff --git a/src/plugins/lua/phishing.lua b/src/plugins/lua/phishing.lua index 1e648768a..e3def6fd9 100644 --- a/src/plugins/lua/phishing.lua +++ b/src/plugins/lua/phishing.lua @@ -11,10 +11,10 @@ function phishing_cb (task) if urls then for _,url in ipairs(urls) do if url:is_phished() then + local found = false local purl = url:get_phished() if table.maxn(strict_domains) > 0 then local _,_,tld = string.find(purl:get_host(), '([a-zA-Z0-9%-]+\.[a-zA-Z0-9%-]+)$') - local found = false if tld then for _,rule in ipairs(strict_domains) do if rule['map']:get_key(tld) then @@ -22,20 +22,19 @@ function phishing_cb (task) found = true end end - if found then - return - end end end - if domains then - local _,_,tld = string.find(purl:get_host(), '([a-zA-Z0-9%-]+\.[a-zA-Z0-9%-]+)$') - if tld then - if domains:get_key(tld) then - task:insert_result(symbol, 1, purl:get_host()) + if not found then + if domains then + local _,_,tld = string.find(purl:get_host(), '([a-zA-Z0-9%-]+\.[a-zA-Z0-9%-]+)$') + if tld then + if domains:get_key(tld) then + task:insert_result(symbol, 1, purl:get_host()) + end end + else + task:insert_result(symbol, 1, purl:get_host()) end - else - task:insert_result(symbol, 1, purl:get_host()) end end end @@ -70,7 +69,7 @@ if opts then sd[1] = opts['strict_domains'] end for _,d in ipairs(sd) do - local s, _ = string.find(d, ':') + local s, _ = string.find(d, ':[^:]+$') if s then local sym = string.sub(d, s + 1, -1) local map = string.sub(d, 1, s - 1) |