Software /
code /
prosody-modules
Comparison
mod_component_roundrobin/mod_component_roundrobin.lua @ 1252:08e50d742392
mod_component_roundrobin: Fix handshake (Thanks Julien)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 18 Dec 2013 18:13:03 +0100 |
parent | 406:a6d215c73c47 |
child | 1253:19cf607111fb |
comparison
equal
deleted
inserted
replaced
1251:280adf09ae12 | 1252:08e50d742392 |
---|---|
56 | 56 |
57 --- Handle authentication attempts by components | 57 --- Handle authentication attempts by components |
58 function handle_component_auth(event) | 58 function handle_component_auth(event) |
59 local session, stanza = event.origin, event.stanza; | 59 local session, stanza = event.origin, event.stanza; |
60 | 60 |
61 if session.type ~= "component" then return; end | 61 if session.type ~= "component_unauthed" then return; end |
62 if sessions[session] then return; end | 62 if sessions[session] then return; end |
63 | 63 |
64 if (not session.host) or #stanza.tags > 0 then | 64 if (not session.host) or #stanza.tags > 0 then |
65 (session.log or log)("warn", "Invalid component handshake for host: %s", session.host); | 65 (session.log or log)("warn", "Invalid component handshake for host: %s", session.host); |
66 session:close("not-authorized"); | 66 session:close("not-authorized"); |
90 session.send(st.stanza("handshake")); | 90 session.send(st.stanza("handshake")); |
91 | 91 |
92 return true; | 92 return true; |
93 end | 93 end |
94 | 94 |
95 module:hook("stanza/jabber:component:accept:handshake", handle_component_auth); | 95 module:hook("stanza/jabber:component:accept:handshake", handle_component_auth, 10); |