aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_saslauth.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2010-11-02 22:23:07 +0500
committerWaqas Hussain <waqas20@gmail.com>2010-11-02 22:23:07 +0500
commit5f992383c5d661069201d337b5fd3ca4aced6351 (patch)
tree53fe6663504a4e67d45569acdf9864a71ab8350f /plugins/mod_saslauth.lua
parentf5e1cfc3b639855f18cb56105f001d55d8683a40 (diff)
downloadprosody-5f992383c5d661069201d337b5fd3ca4aced6351.tar.gz
prosody-5f992383c5d661069201d337b5fd3ca4aced6351.zip
mod_saslauth: Allow restarting SASL negotiation from scratch.
Diffstat (limited to 'plugins/mod_saslauth.lua')
-rw-r--r--plugins/mod_saslauth.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua
index 236ab856..c6ead31a 100644
--- a/plugins/mod_saslauth.lua
+++ b/plugins/mod_saslauth.lua
@@ -95,7 +95,16 @@ module:hook("stanza/urn:ietf:params:xml:ns:xmpp-sasl:auth", function(event)
local session, stanza = event.origin, event.stanza;
if session.type ~= "c2s_unauthed" then return; end
- -- FIXME ignoring duplicates because ejabberd does
+ if session.sasl_handler and session.sasl_handler.selected then
+ session.sasl_handler = nil; -- allow starting a new SASL negotiation before completing an old one
+ end
+ if not session.sasl_handler then
+ if anonymous_login then
+ session.sasl_handler = new_sasl(module.host, anonymous_authentication_profile);
+ else
+ session.sasl_handler = usermanager_get_sasl_handler(module.host);
+ end
+ end
local mechanism = stanza.attr.mechanism;
if anonymous_login then
if mechanism ~= "ANONYMOUS" then