Software /
code /
prosody
Comparison
plugins/mod_saslauth.lua @ 6519:367db22cf7d2
mod_saslauth: Make it easier to support multiple channel binding methonds
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 19 Nov 2014 14:45:20 +0100 |
parent | 6518:c0d221b0c94c |
child | 7298:7056bbaf81ee |
comparison
equal
deleted
inserted
replaced
6518:c0d221b0c94c | 6519:367db22cf7d2 |
---|---|
213 session.send(build_reply("failure", "aborted")); | 213 session.send(build_reply("failure", "aborted")); |
214 return true; | 214 return true; |
215 end); | 215 end); |
216 | 216 |
217 local function tls_unique(self) | 217 local function tls_unique(self) |
218 return self.userdata:getpeerfinished(); | 218 return self.userdata["tls-unique"]:getpeerfinished(); |
219 end | 219 end |
220 | 220 |
221 local mechanisms_attr = { xmlns='urn:ietf:params:xml:ns:xmpp-sasl' }; | 221 local mechanisms_attr = { xmlns='urn:ietf:params:xml:ns:xmpp-sasl' }; |
222 local bind_attr = { xmlns='urn:ietf:params:xml:ns:xmpp-bind' }; | 222 local bind_attr = { xmlns='urn:ietf:params:xml:ns:xmpp-bind' }; |
223 local xmpp_session_attr = { xmlns='urn:ietf:params:xml:ns:xmpp-session' }; | 223 local xmpp_session_attr = { xmlns='urn:ietf:params:xml:ns:xmpp-session' }; |
235 if sasl_handler.add_cb_handler then | 235 if sasl_handler.add_cb_handler then |
236 local socket = origin.conn:socket(); | 236 local socket = origin.conn:socket(); |
237 if socket.getpeerfinished then | 237 if socket.getpeerfinished then |
238 sasl_handler:add_cb_handler("tls-unique", tls_unique); | 238 sasl_handler:add_cb_handler("tls-unique", tls_unique); |
239 end | 239 end |
240 sasl_handler["userdata"] = socket; | 240 sasl_handler["userdata"] = { |
241 ["tls-unique"] = socket; | |
242 }; | |
241 end | 243 end |
242 end | 244 end |
243 local mechanisms = st.stanza("mechanisms", mechanisms_attr); | 245 local mechanisms = st.stanza("mechanisms", mechanisms_attr); |
244 for mechanism in pairs(sasl_handler:mechanisms()) do | 246 for mechanism in pairs(sasl_handler:mechanisms()) do |
245 if (not disabled_mechanisms:contains(mechanism)) and (origin.secure or not insecure_mechanisms:contains(mechanism)) then | 247 if (not disabled_mechanisms:contains(mechanism)) and (origin.secure or not insecure_mechanisms:contains(mechanism)) then |