Mercurial > prosody-modules
comparison mod_host_guard/mod_host_guard.lua @ 831:0c3638673464
Merge upstream with my local LDAP work
author | Rob Hoelz <rob@hoelz.ro> |
---|---|
date | Tue, 18 Sep 2012 00:31:42 +0200 |
parents | bf23a8966e20 |
children | 21e99dc949ee |
comparison
equal
deleted
inserted
replaced
830:f160166612c2 | 831:0c3638673464 |
---|---|
40 return nil | 40 return nil |
41 end | 41 end |
42 | 42 |
43 local function handle_activation (host, u) | 43 local function handle_activation (host, u) |
44 if guard_blockall:contains(host) or guard_protect:contains(host) then | 44 if guard_blockall:contains(host) or guard_protect:contains(host) then |
45 if hosts[host] and hosts[host].events then | 45 if hosts[host] and config.get(host, "core", "authentication") ~= "anonymous" then |
46 hosts[host].events.add_handler("s2sin-established", s2s_hook, 500) | 46 hosts[host].events.add_handler("s2sin-established", s2s_hook, 500) |
47 hosts[host].events.add_handler("route/remote", rr_hook, 500) | 47 hosts[host].events.add_handler("route/remote", rr_hook, 500) |
48 hosts[host].events.add_handler("stanza/jabber:server:dialback:result", s2s_hook, 500) | 48 hosts[host].events.add_handler("stanza/jabber:server:dialback:result", s2s_hook, 500) |
49 if not u then | 49 if not u then |
50 module:log ("debug", "adding host protection for: "..host) | 50 module:log ("debug", "adding host protection for: "..host) |
55 end | 55 end |
56 end | 56 end |
57 | 57 |
58 local function handle_deactivation (host, u, i) | 58 local function handle_deactivation (host, u, i) |
59 if guard_blockall:contains(host) or guard_protect:contains(host) then | 59 if guard_blockall:contains(host) or guard_protect:contains(host) then |
60 if hosts[host] and hosts[host].events then | 60 if hosts[host] and config.get(host, "core", "authentication") ~= "anonymous" then |
61 hosts[host].events.remove_handler("s2sin-established", s2s_hook) | 61 hosts[host].events.remove_handler("s2sin-established", s2s_hook) |
62 hosts[host].events.remove_handler("route/remote", rr_hook) | 62 hosts[host].events.remove_handler("route/remote", rr_hook) |
63 hosts[host].events.remove_handler("stanza/jabber:server:dialback:result", s2s_hook) | 63 hosts[host].events.remove_handler("stanza/jabber:server:dialback:result", s2s_hook) |
64 if not u and not i then module:log ("debug", "removing host protection for: "..host) end | 64 if not u and not i then module:log ("debug", "removing host protection for: "..host) end |
65 end | 65 end |