Software / code / prosody
Comparison
plugins/mod_register_limits.lua @ 10765:294923f45e25
mod_register_limits: Fix order of arguments to util.error (fix #1539 p1) (thanks Ge0rG)
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 23 Apr 2020 19:00:40 +0200 |
| parent | 10364:66943afdd7f3 |
| child | 10766:00d2a577204c |
comparison
equal
deleted
inserted
replaced
| 10764:1fbfcc2f6805 | 10765:294923f45e25 |
|---|---|
| 80 if not ip then | 80 if not ip then |
| 81 log("warn", "IP not known; can't apply blacklist/whitelist"); | 81 log("warn", "IP not known; can't apply blacklist/whitelist"); |
| 82 elseif ip_in_set(blacklisted_ips, ip) then | 82 elseif ip_in_set(blacklisted_ips, ip) then |
| 83 log("debug", "Registration disallowed by blacklist"); | 83 log("debug", "Registration disallowed by blacklist"); |
| 84 event.allowed = false; | 84 event.allowed = false; |
| 85 event.error = errors.new("blacklisted", err_registry, event); | 85 event.error = errors.new("blacklisted", event, err_registry); |
| 86 elseif (whitelist_only and not ip_in_set(whitelisted_ips, ip)) then | 86 elseif (whitelist_only and not ip_in_set(whitelisted_ips, ip)) then |
| 87 log("debug", "Registration disallowed by whitelist"); | 87 log("debug", "Registration disallowed by whitelist"); |
| 88 event.allowed = false; | 88 event.allowed = false; |
| 89 event.error = errors.new("not_whitelisted", err_registry, event); | 89 event.error = errors.new("not_whitelisted", event, err_registry); |
| 90 elseif throttle_max and not ip_in_set(whitelisted_ips, ip) then | 90 elseif throttle_max and not ip_in_set(whitelisted_ips, ip) then |
| 91 if not check_throttle(ip) then | 91 if not check_throttle(ip) then |
| 92 log("debug", "Registrations over limit for ip %s", ip or "?"); | 92 log("debug", "Registrations over limit for ip %s", ip or "?"); |
| 93 event.allowed = false; | 93 event.allowed = false; |
| 94 event.error = errors.new("throttle", err_registry, event); | 94 event.error = errors.new("throttle", event, err_registry); |
| 95 end | 95 end |
| 96 end | 96 end |
| 97 if event.error then | 97 if event.error then |
| 98 -- COMPAT pre-util.error | 98 -- COMPAT pre-util.error |
| 99 event.reason = event.error.text; | 99 event.reason = event.error.text; |