diff options
author | Kim Alvefur <zash@zash.se> | 2014-11-19 14:37:45 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2014-11-19 14:37:45 +0100 |
commit | b47d9adc40cb05bd1a0a99fa62daca3db926666c (patch) | |
tree | 0b8024280b6438f926b8260087302f620c377ecf | |
parent | 958a4e177ba331c8a1e6ccd333ab5892a8f86bfc (diff) | |
download | prosody-b47d9adc40cb05bd1a0a99fa62daca3db926666c.tar.gz prosody-b47d9adc40cb05bd1a0a99fa62daca3db926666c.zip |
mod_saslauth: Keep sasl_handler in a local variable
-rw-r--r-- | plugins/mod_saslauth.lua | 11 |
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 |