Skip to content

Commit

Permalink
[Fix] rbl: fix exclude_local
Browse files Browse the repository at this point in the history
  • Loading branch information
fatalbanana committed Nov 3, 2023
1 parent 5ac0eed commit eeabb14
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 0 additions & 2 deletions lualib/plugins/rbl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ local default_options = {
['default_unknown'] = false,
['default_dkim_domainonly'] = true,
['default_emails_domainonly'] = false,
['default_exclude_private_ips'] = true,
['default_exclude_users'] = false,
['default_exclude_local'] = true,
['default_no_ip'] = false,
Expand Down Expand Up @@ -91,7 +90,6 @@ local rule_schema_tbl = {
emails_domainonly = ts.boolean:is_optional(),
enabled = ts.boolean:is_optional(),
exclude_local = ts.boolean:is_optional(),
exclude_private_ips = ts.boolean:is_optional(),
exclude_users = ts.boolean:is_optional(),
from = ts.boolean:is_optional(),
hash = ts.one_of { "sha1", "sha256", "sha384", "sha512", "md5", "blake2" }:is_optional(),
Expand Down
6 changes: 2 additions & 4 deletions src/plugins/lua/rbl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,7 @@ local function gen_check_rcvd_conditions(rbl, received_total)
end
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 rh.real_ip:is_local()) or
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
((rbl.exclude_local and not rh.real_ip:is_local() or is_excluded_ip(rh.real_ip)) or not rbl.exclude_local) then
return true
else
return false
Expand Down Expand Up @@ -845,7 +843,7 @@ local function gen_rbl_callback(rule)
description[#description + 1] = 'user'
end

if rule.exclude_local or rule.exclude_private_ips then
if rule.exclude_local then
pipeline[#pipeline + 1] = check_local
description[#description + 1] = 'local'
end
Expand Down

0 comments on commit eeabb14

Please sign in to comment.