]> source.dussan.org Git - rspamd.git/commitdiff
Fix incorrect processing of exclusions 174/head
authorAndrew Lewis <nerf@judo.za.org>
Mon, 16 Feb 2015 15:39:39 +0000 (17:39 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Mon, 16 Feb 2015 18:00:48 +0000 (20:00 +0200)
src/plugins/lua/rbl.lua

index ab00ade64ab60aa3e1f9819fb3626aafafae522d..82955f13c429d7856c539011c8cadc1ab1814c09 100644 (file)
@@ -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