diff options
author | Andrew Lewis <nerf@judo.za.org> | 2015-02-17 10:22:19 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2015-02-17 12:48:33 +0200 |
commit | 6088c2b15fec2aad5043a8b29b1ef250ae7d90dd (patch) | |
tree | 6cc4847c83650eb95550673eae19f073050a8d75 /src/plugins | |
parent | a1e7c618420c72364251f072e35834a48ab6a9a4 (diff) | |
download | rspamd-6088c2b15fec2aad5043a8b29b1ef250ae7d90dd.tar.gz rspamd-6088c2b15fec2aad5043a8b29b1ef250ae7d90dd.zip |
Make local/private IP exclusions work for all RBL types
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/lua/rbl.lua | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua index 198e725f4..625333f01 100644 --- a/src/plugins/lua/rbl.lua +++ b/src/plugins/lua/rbl.lua @@ -133,6 +133,20 @@ local function rbl_cb (task) end end + if (rbl['exclude_local'] or rbl['exclude_private_ips']) and not notgot['from'] then + if not havegot['from'] then + havegot['from'] = task:get_from_ip() + if not havegot['from']:is_valid() then + notgot['from'] = true + end + end + if havegot['from'] and not notgot['from'] and ((rbl['exclude_local'] and + is_excluded_ip(havegot['from'])) or (rbl['exclude_private_ips'] and + is_private_ip(havegot['from']))) then + return + end + end + if rbl['helo'] then (function() if notgot['helo'] then @@ -180,10 +194,6 @@ local function rbl_cb (task) return end end - if (rbl['exclude_private_ips'] and is_private_ip(havegot['from'])) - or (is_excluded_ip(havegot['from']) and rbl['exclude_local']) then - return - end if (havegot['from']:get_version() == 6 and rbl['ipv6']) or (havegot['from']:get_version() == 4 and rbl['ipv4']) then task:get_resolver():resolve_a(task:get_session(), task:get_mempool(), |