Mercurial > prosody-hg
comparison plugins/mod_legacyauth.lua @ 5126:a0673b644f05
mod_legacyauth: Fix for sending error response to unauthed s2s connections
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 13 Sep 2012 18:48:35 +0100 |
| parents | 82b9fe0c79c5 |
| children | bd0ff8ae98a8 |
comparison
equal
deleted
inserted
replaced
| 5124:a4a74a0e9b9c | 5126:a0673b644f05 |
|---|---|
| 33 | 33 |
| 34 module:hook("stanza/iq/jabber:iq:auth:query", function(event) | 34 module:hook("stanza/iq/jabber:iq:auth:query", function(event) |
| 35 local session, stanza = event.origin, event.stanza; | 35 local session, stanza = event.origin, event.stanza; |
| 36 | 36 |
| 37 if session.type ~= "c2s_unauthed" then | 37 if session.type ~= "c2s_unauthed" then |
| 38 session.send(st.error_reply(stanza, "cancel", "service-unavailable", "Legacy authentication is only allowed for unauthenticated client connections.")); | 38 (session.sends2s or session.send)(st.error_reply(stanza, "cancel", "service-unavailable", "Legacy authentication is only allowed for unauthenticated client connections.")); |
| 39 return true; | 39 return true; |
| 40 end | 40 end |
| 41 | 41 |
| 42 if secure_auth_only and not session.secure then | 42 if secure_auth_only and not session.secure then |
| 43 session.send(st.error_reply(stanza, "modify", "not-acceptable", "Encryption (SSL or TLS) is required to connect to this server")); | 43 session.send(st.error_reply(stanza, "modify", "not-acceptable", "Encryption (SSL or TLS) is required to connect to this server")); |
