Comparison

plugins/mod_legacyauth.lua @ 3528:5cdcd7ee6ef5

mod_legacyauth: Limit authentication to unauthenticated client connections.
author Waqas Hussain <waqas20@gmail.com>
date Sat, 16 Oct 2010 05:46:23 +0500
parent 3527:59cdb9166bd0
child 4258:ee445e658848
comparison
equal deleted inserted replaced
3527:59cdb9166bd0 3528:5cdcd7ee6ef5
29 end 29 end
30 end); 30 end);
31 31
32 module:hook("stanza/iq/jabber:iq:auth:query", function(event) 32 module:hook("stanza/iq/jabber:iq:auth:query", function(event)
33 local session, stanza = event.origin, event.stanza; 33 local session, stanza = event.origin, event.stanza;
34
35 if session.type ~= "c2s_unauthed" then
36 session.send(st.error_reply(stanza, "cancel", "service-unavailable", "Legacy authentication is only allowed for unauthenticated client connections."));
37 return true;
38 end
34 39
35 if secure_auth_only and not session.secure then 40 if secure_auth_only and not session.secure then
36 session.send(st.error_reply(stanza, "modify", "not-acceptable", "Encryption (SSL or TLS) is required to connect to this server")); 41 session.send(st.error_reply(stanza, "modify", "not-acceptable", "Encryption (SSL or TLS) is required to connect to this server"));
37 return true; 42 return true;
38 end 43 end