Software /
code /
prosody
Comparison
plugins/mod_saslauth.lua @ 3553:1f0af8572f15
mod_saslauth: Allow restarting SASL negotiation from scratch.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Tue, 02 Nov 2010 22:23:07 +0500 |
parent | 3552:8ad09efc19cc |
child | 3651:337391d34b70 |
child | 4029:fb027b2811c2 |
comparison
equal
deleted
inserted
replaced
3552:8ad09efc19cc | 3553:1f0af8572f15 |
---|---|
93 | 93 |
94 module:hook("stanza/urn:ietf:params:xml:ns:xmpp-sasl:auth", function(event) | 94 module:hook("stanza/urn:ietf:params:xml:ns:xmpp-sasl:auth", function(event) |
95 local session, stanza = event.origin, event.stanza; | 95 local session, stanza = event.origin, event.stanza; |
96 if session.type ~= "c2s_unauthed" then return; end | 96 if session.type ~= "c2s_unauthed" then return; end |
97 | 97 |
98 -- FIXME ignoring duplicates because ejabberd does | 98 if session.sasl_handler and session.sasl_handler.selected then |
99 session.sasl_handler = nil; -- allow starting a new SASL negotiation before completing an old one | |
100 end | |
101 if not session.sasl_handler then | |
102 if anonymous_login then | |
103 session.sasl_handler = new_sasl(module.host, anonymous_authentication_profile); | |
104 else | |
105 session.sasl_handler = usermanager_get_sasl_handler(module.host); | |
106 end | |
107 end | |
99 local mechanism = stanza.attr.mechanism; | 108 local mechanism = stanza.attr.mechanism; |
100 if anonymous_login then | 109 if anonymous_login then |
101 if mechanism ~= "ANONYMOUS" then | 110 if mechanism ~= "ANONYMOUS" then |
102 session.send(build_reply("failure", "invalid-mechanism")); | 111 session.send(build_reply("failure", "invalid-mechanism")); |
103 return true; | 112 return true; |