aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_saslauth.lua
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/mod_saslauth.lua')
-rw-r--r--plugins/mod_saslauth.lua17
1 files changed, 9 insertions, 8 deletions
diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua
index 75ee9f04..beb59dd2 100644
--- a/plugins/mod_saslauth.lua
+++ b/plugins/mod_saslauth.lua
@@ -144,21 +144,22 @@ module:add_handler("c2s_unauthed", "response", xmlns_sasl, sasl_handler);
local mechanisms_attr = { xmlns='urn:ietf:params:xml:ns:xmpp-sasl' };
local bind_attr = { xmlns='urn:ietf:params:xml:ns:xmpp-bind' };
local xmpp_session_attr = { xmlns='urn:ietf:params:xml:ns:xmpp-session' };
-module:add_event_hook("stream-features", function(session, features)
- if not session.username then
- if secure_auth_only and not session.secure then
+module:hook("stream-features", function(event)
+ local origin, features = event.origin, event.features;
+ if not origin.username then
+ if secure_auth_only and not origin.secure then
return;
end
if module:get_option("anonymous_login") then
- session.sasl_handler = new_sasl(session.host, anonymous_authentication_profile);
+ origin.sasl_handler = new_sasl(origin.host, anonymous_authentication_profile);
else
- session.sasl_handler = new_sasl(session.host, default_authentication_profile);
- if not (module:get_option("allow_unencrypted_plain_auth")) and not session.secure then
- session.sasl_handler:forbidden({"PLAIN"});
+ origin.sasl_handler = new_sasl(origin.host, default_authentication_profile);
+ if not (module:get_option("allow_unencrypted_plain_auth")) and not origin.secure then
+ origin.sasl_handler:forbidden({"PLAIN"});
end
end
features:tag("mechanisms", mechanisms_attr);
- for k, v in pairs(session.sasl_handler:mechanisms()) do
+ for k, v in pairs(origin.sasl_handler:mechanisms()) do
features:tag("mechanism"):text(v):up();
end
features:up();