comparison plugins/mod_saslauth.lua @ 6054:7a5ddbaf758d

Merge 0.9->0.10
author Matthew Wild <mwild1@gmail.com>
date Wed, 02 Apr 2014 17:41:38 +0100
parents b3ceb7627e27
children 76699a0ae4c4
comparison
equal deleted inserted replaced
6053:2f93a04564b2 6054:7a5ddbaf758d
1 -- Prosody IM 1 -- Prosody IM
2 -- Copyright (C) 2008-2010 Matthew Wild 2 -- Copyright (C) 2008-2010 Matthew Wild
3 -- Copyright (C) 2008-2010 Waqas Hussain 3 -- Copyright (C) 2008-2010 Waqas Hussain
4 -- 4 --
5 -- This project is MIT/X11 licensed. Please see the 5 -- This project is MIT/X11 licensed. Please see the
6 -- COPYING file in the source package for more information. 6 -- COPYING file in the source package for more information.
7 -- 7 --
8 8
9 9
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.encrypted 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 and origin.sasl_handler.add_cb_handler 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