aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-11-16 17:14:53 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-11-16 17:14:53 +0000
commit4df47d1cb8c262116508f6d7b424754ea4dd13dd (patch)
tree4e5098d137c48bec0abe395105af2e97c3946e16 /src/plugins/lua
parent58037bbffc0e3fd7873b6b411ea2c3aeb0f3ea91 (diff)
downloadrspamd-4df47d1cb8c262116508f6d7b424754ea4dd13dd.tar.gz
rspamd-4df47d1cb8c262116508f6d7b424754ea4dd13dd.zip
[Minor] Rbl: Add url_full_hostname option
Diffstat (limited to 'src/plugins/lua')
-rw-r--r--src/plugins/lua/rbl.lua14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua
index 3d0e02529..8743f125d 100644
--- a/src/plugins/lua/rbl.lua
+++ b/src/plugins/lua/rbl.lua
@@ -457,7 +457,8 @@ local function gen_rbl_callback(rule)
-- We check merely mime from
mime_from_domain = ((task:get_from('mime') or E)[1] or E).domain
if mime_from_domain then
- local mime_from_domain_tld = rspamd_util.get_tld(mime_from_domain)
+ local mime_from_domain_tld = rule.url_full_hostname and
+ rspamd_util.get_tld(mime_from_domain) or mime_from_domain
if rule.url_compose_map then
mime_from_domain = rule.url_compose_map:process_url(task, mime_from_domain_tld, mime_from_domain)
@@ -482,6 +483,8 @@ local function gen_rbl_callback(rule)
if rule.url_compose_map then
domain_tld = rule.url_compose_map:process_url(task, domain_tld, domain)
+ elseif rule.url_full_hostname then
+ domain_tld = domain
end
end
@@ -494,6 +497,8 @@ local function gen_rbl_callback(rule)
local domain_tld = rspamd_util.get_tld(domain)
if rule.url_compose_map then
domain_tld = rule.url_compose_map:process_url(task, domain_tld, domain)
+ elseif rule.url_full_hostname then
+ domain_tld = domain
end
add_dns_request(task, domain_tld,
false, false, requests_table, 'dkim', whitelist)
@@ -555,9 +560,10 @@ local function gen_rbl_callback(rule)
add_dns_request(task, to_resolve, false,
false, requests_table, 'url', whitelist)
else
- local url_tld = u:get_tld()
+ local url_hostname = u:get_host()
+ local url_tld = rule.url_full_hostname and u:get_tld() or url_hostname
if rule.url_compose_map then
- url_tld = rule.url_compose_map:process_url(task, url_tld, u:get_host())
+ url_tld = rule.url_compose_map:process_url(task, url_tld, url_hostname)
end
add_dns_request(task, url_tld, false,
false, requests_table, 'url', whitelist)
@@ -683,7 +689,7 @@ local function gen_rbl_callback(rule)
for _,email in ipairs(emails) do
local domain
- if rule.emails_domainonly then
+ if rule.emails_domainonly and not rule.url_full_hostname then
if rule.url_compose_map then
domain = rule.url_compose_map:process_url(task, email:get_tld(), email:get_host())
else