Software /
code /
prosody-modules
Comparison
mod_host_guard/mod_host_guard.lua @ 685:19698c5f3ab3
mod_host_guard: prevent possible traces in case there isn't a conn object on the session by adding a dummy replacement function.
author | Marco Cirillo <maranda@lightwitch.org> |
---|---|
date | Sun, 27 May 2012 04:44:24 +0000 |
parent | 684:27529031890b |
child | 686:592cfa6cf5d9 |
comparison
equal
deleted
inserted
replaced
684:27529031890b | 685:19698c5f3ab3 |
---|---|
27 | 27 |
28 return nil | 28 return nil |
29 end | 29 end |
30 | 30 |
31 local function rr_hook (event) | 31 local function rr_hook (event) |
32 local from_host, to_host, send, stanza = event.from_host, event.to_host, event.origin.send, event.stanza | 32 local from_host, to_host, send, stanza = event.from_host, event.to_host, (event.origin and event.origin.send) or function() end, event.stanza |
33 | 33 |
34 if guard_blockall:contains(from_host) and not guard_ball_wl:contains(to_host) or | 34 if guard_blockall:contains(from_host) and not guard_ball_wl:contains(to_host) or |
35 guard_block_bl:contains(to_host) and guard_protect:contains(from_host) then | 35 guard_block_bl:contains(to_host) and guard_protect:contains(from_host) then |
36 module:log("info", "attempted to connect to a filtered remote host %s", to_host) | 36 module:log("info", "attempted to connect to a filtered remote host %s", to_host) |
37 if stanza.attr.type ~= "error" then send(error_reply(event.stanza, "cancel", "policy-violation", "Communicating with a filtered remote server is not allowed.")) end | 37 if stanza.attr.type ~= "error" then send(error_reply(event.stanza, "cancel", "policy-violation", "Communicating with a filtered remote server is not allowed.")) end |