Software /
code /
prosody-modules
Changeset
6117:b4a4f4094337
mod_anti_spam: Fix traceback on missing/invalid session IP and log warning
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 28 Dec 2024 18:03:32 +0000 |
parents | 6116:edf10a1bee7d |
children | 6118:8338f42d2bc5 |
files | mod_anti_spam/mod_anti_spam.lua |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_anti_spam/mod_anti_spam.lua Sat Dec 28 16:00:25 2024 +0000 +++ b/mod_anti_spam/mod_anti_spam.lua Sat Dec 28 18:03:32 2024 +0000 @@ -63,8 +63,11 @@ if spam_source_domains:contains(session.from_host) then return true; end - local origin_ip = ip.new_ip(session.ip); - if spam_source_ips:contains_ip(origin_ip) then + local raw_ip = session.ip; + local parsed_ip = raw_ip and ip.new_ip(session.ip); + if not parsed_ip then + session.log("warn", "mod_anti_spam: Unable to determine IP address (missing/invalid)"); + elseif spam_source_ips:contains_ip(parsed_ip) then return true; end end