Software /
code /
prosody
Comparison
plugins/mod_saslauth.lua @ 7896:1a2674123c1c
mod_saslauth: Cache logger in local for less typing
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 15 Feb 2017 22:59:19 +0100 |
parent | 7784:9f70d35a1602 |
child | 7897:08bde6a6fd56 |
comparison
equal
deleted
inserted
replaced
7895:1e1c18012048 | 7896:1a2674123c1c |
---|---|
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' }; |
224 module:hook("stream-features", function(event) | 224 module:hook("stream-features", function(event) |
225 local origin, features = event.origin, event.features; | 225 local origin, features = event.origin, event.features; |
226 local log = origin.log or log; | |
226 if not origin.username then | 227 if not origin.username then |
227 if secure_auth_only and not origin.secure then | 228 if secure_auth_only and not origin.secure then |
228 return; | 229 return; |
229 end | 230 end |
230 local sasl_handler = usermanager_get_sasl_handler(module.host, origin) | 231 local sasl_handler = usermanager_get_sasl_handler(module.host, origin) |
249 end | 250 end |
250 end | 251 end |
251 if mechanisms[1] then | 252 if mechanisms[1] then |
252 features:add_child(mechanisms); | 253 features:add_child(mechanisms); |
253 else | 254 else |
254 (origin.log or log)("warn", "No SASL mechanisms to offer"); | 255 log("warn", "No SASL mechanisms to offer"); |
255 end | 256 end |
256 else | 257 else |
257 features:tag("bind", bind_attr):tag("required"):up():up(); | 258 features:tag("bind", bind_attr):tag("required"):up():up(); |
258 features:tag("session", xmpp_session_attr):tag("optional"):up():up(); | 259 features:tag("session", xmpp_session_attr):tag("optional"):up():up(); |
259 end | 260 end |