Software /
code /
prosody
Changeset
6517:e733e98a348a
mod_saslauth: Keep sasl_handler in a local variable
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 19 Nov 2014 14:37:45 +0100 |
parents | 6515:c9a72c64c3e2 |
children | 6518:c0d221b0c94c |
files | plugins/mod_saslauth.lua |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_saslauth.lua Thu Nov 20 09:01:45 2014 +0000 +++ b/plugins/mod_saslauth.lua Wed Nov 19 14:37:45 2014 +0100 @@ -223,19 +223,20 @@ 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