From: Andrew Lewis Date: Mon, 16 Feb 2015 15:39:39 +0000 (+0200) Subject: Fix incorrect processing of exclusions X-Git-Tag: 0.9.0~687^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F174%2Fhead;p=rspamd.git Fix incorrect processing of exclusions --- diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua index ab00ade64..82955f13c 100644 --- a/src/plugins/lua/rbl.lua +++ b/src/plugins/lua/rbl.lua @@ -178,13 +178,15 @@ local function rbl_cb (task) end if not havegot['from'] then havegot['from'] = task:get_from_ip() - if not havegot['from']:is_valid() or - (rbl['exclude_private_ips'] and is_private_ip(havegot['from'])) - or (is_excluded_ip(havegot['from']) and rbl['exclude_local']) then + if not havegot['from']:is_valid() then notgot['from'] = true 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(), @@ -210,8 +212,8 @@ local function rbl_cb (task) if ((rh['real_ip']:get_version() == 6 and rbl['ipv6']) or (rh['real_ip']:get_version() == 4 and rbl['ipv4'])) and ((rbl['exclude_private_ips'] and not is_private_ip(rh['real_ip'])) or - not rbl['exclude_private_ips']) and not (is_excluded_ip(rh['real_ip']) - or not rbl['exclude_local']) then + not rbl['exclude_private_ips']) and ((rbl['exclude_local_ips'] and + not is_excluded_ip(rh['real_ip'])) or not rbl['exclude_local_ips']) then task:get_resolver():resolve_a(task:get_session(), task:get_mempool(), ip_to_rbl(rh['real_ip'], rbl['rbl']), rbl_dns_cb, k) end