diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-09-02 14:17:28 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-09-02 14:17:28 +0100 |
commit | bbd0d31d094e24039c88ad1df43069c43f39ec06 (patch) | |
tree | 6816267ba7df2d053e2509a1b425f8368b427665 /src | |
parent | 0b059629d7bb65c8ab4101c4b8d50156c03716d7 (diff) | |
download | rspamd-bbd0d31d094e24039c88ad1df43069c43f39ec06.tar.gz rspamd-bbd0d31d094e24039c88ad1df43069c43f39ec06.zip |
[Minor] Rbl: Prepare for emails move
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/lua/rbl.lua | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua index 093d6ca11..ab1ba23e9 100644 --- a/src/plugins/lua/rbl.lua +++ b/src/plugins/lua/rbl.lua @@ -460,17 +460,17 @@ local function gen_rbl_callback(rule) add_dns_request(task, email:get_tld(), false, false, requests_table, 'email', whitelist) else - if rule.hash then - -- Leave @ as is - add_dns_request(task, string.format('%s@%s', - email:get_user(), email:get_host()), false, false, - requests_table, 'email', whitelist) + local delimiter = '.' + if rule.emails_delimiter then + delimiter = rule.emails_delimiter else - -- Replace @ with . - add_dns_request(task, string.format('%s.%s', - email:get_user(), email:get_host()), false, false, - requests_table, 'email', whitelist) + if rule.hash then + delimiter = '@' + end end + add_dns_request(task, string.format('%s%s%s', + email:get_user(), delimiter, email:get_host()), false, false, + requests_table, 'email', whitelist) end end @@ -572,20 +572,20 @@ local function gen_rbl_callback(rule) lua_util.remove_email_aliases(rt[1]) rt[1].addr = rt[1].addr:lower() if rule.emails_domainonly then - add_dns_request(task, rt[1].addr, true, false, requests_table, - 'email replyto', whitelist) + add_dns_request(task, rt[1].host, true, false, requests_table, + 'email replyt', whitelist) else - if rule.hash then - -- Leave @ as is - add_dns_request(task, string.format('%s@%s', - rt[1].user, rt[1].host), false, false, - requests_table, 'email replyto', whitelist) + local delimiter = '.' + if rule.emails_delimiter then + delimiter = rule.emails_delimiter else - -- Replace @ with . - add_dns_request(task, string.format('%s.%s', - rt[1].user, rt[1].host), false, false, - requests_table, 'email replyto', whitelist) + if rule.hash then + delimiter = '@' + end end + add_dns_request(task, string.format('%s%s%s', + rt[1].user, delimiter, rt[1].host), true, false, + requests_table, 'email replyt', whitelist) end end end @@ -985,6 +985,7 @@ local rule_schema = ts.shape({ monitored_address = ts.string:is_optional(), requests_limit = (ts.integer + ts.string / tonumber):is_optional(), process_script = ts.string:is_optional(), + emails_delimiter = ts.string:is_optional(), }, { -- Covers boolean defaults extra_fields = ts.map_of(ts.string, ts.boolean) |