Comparison

plugins/mod_saslauth.lua @ 5843:fb6573e191cf

Merge Tobias SCRAM-PLUS work
author Kim Alvefur <zash@zash.se>
date Sun, 22 Sep 2013 00:44:20 +0200
parent 5776:bd0ff8ae98a8
parent 5838:a2659baf8332
child 5860:87e2fafba5df
comparison
equal deleted inserted replaced
5827:ae16bf17785d 5843:fb6573e191cf
240 if not origin.username then 240 if not origin.username then
241 if secure_auth_only and not origin.secure then 241 if secure_auth_only and not origin.secure then
242 return; 242 return;
243 end 243 end
244 origin.sasl_handler = usermanager_get_sasl_handler(module.host, origin); 244 origin.sasl_handler = usermanager_get_sasl_handler(module.host, origin);
245 if origin.secure then
246 -- check wether LuaSec has the nifty binding to the function needed for tls-unique
247 -- FIXME: would be nice to have this check only once and not for every socket
248 if origin.conn:socket().getpeerfinished then
249 origin.sasl_handler:add_cb_handler("tls-unique", function(self)
250 return self.userdata:getpeerfinished();
251 end);
252 origin.sasl_handler["userdata"] = origin.conn:socket();
253 end
254 end
245 local mechanisms = st.stanza("mechanisms", mechanisms_attr); 255 local mechanisms = st.stanza("mechanisms", mechanisms_attr);
246 for mechanism in pairs(origin.sasl_handler:mechanisms()) do 256 for mechanism in pairs(origin.sasl_handler:mechanisms()) do
247 if mechanism ~= "PLAIN" or origin.secure or allow_unencrypted_plain_auth then 257 if mechanism ~= "PLAIN" or origin.secure or allow_unencrypted_plain_auth then
248 mechanisms:tag("mechanism"):text(mechanism):up(); 258 mechanisms:tag("mechanism"):text(mechanism):up();
249 end 259 end