aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_saslauth.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2014-11-19 14:37:45 +0100
committerKim Alvefur <zash@zash.se>2014-11-19 14:37:45 +0100
commit1b91a0bea90fe80ef9fb399b21cb3c5e631eefd7 (patch)
tree0b8024280b6438f926b8260087302f620c377ecf /plugins/mod_saslauth.lua
parente5282813cb1a618d76c4763d69d7dd354d8c12fc (diff)
downloadprosody-1b91a0bea90fe80ef9fb399b21cb3c5e631eefd7.tar.gz
prosody-1b91a0bea90fe80ef9fb399b21cb3c5e631eefd7.zip
mod_saslauth: Keep sasl_handler in a local variable
Diffstat (limited to 'plugins/mod_saslauth.lua')
-rw-r--r--plugins/mod_saslauth.lua11
1 files changed, 6 insertions, 5 deletions
diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua
index e42adbe1..5064a21a 100644
--- a/plugins/mod_saslauth.lua
+++ b/plugins/mod_saslauth.lua
@@ -223,19 +223,20 @@ module:hook("stream-features", function(event)
if secure_auth_only and not origin.secure then
return;
end
- origin.sasl_handler = usermanager_get_sasl_handler(module.host, origin);
+ local sasl_handler = usermanager_get_sasl_handler(module.host, origin)
+ origin.sasl_handler = sasl_handler;
if origin.encrypted then
-- check wether LuaSec has the nifty binding to the function needed for tls-unique
-- FIXME: would be nice to have this check only once and not for every socket
- if origin.conn:socket().getpeerfinished and origin.sasl_handler.add_cb_handler then
- origin.sasl_handler:add_cb_handler("tls-unique", function(self)
+ if origin.conn:socket().getpeerfinished and sasl_handler.add_cb_handler then
+ sasl_handler:add_cb_handler("tls-unique", function(self)
return self.userdata:getpeerfinished();
end);
- origin.sasl_handler["userdata"] = origin.conn:socket();
+ sasl_handler["userdata"] = origin.conn:socket();
end
end
local mechanisms = st.stanza("mechanisms", mechanisms_attr);
- for mechanism in pairs(origin.sasl_handler:mechanisms()) do
+ for mechanism in pairs(sasl_handler:mechanisms()) do
if (not disabled_mechanisms:contains(mechanism)) and (origin.secure or not insecure_mechanisms:contains(mechanism)) then
mechanisms:tag("mechanism"):text(mechanism):up();
end