aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2011-10-13 00:24:09 +0500
committerWaqas Hussain <waqas20@gmail.com>2011-10-13 00:24:09 +0500
commitafd972f05b2ef093c395e4d0b8b01adcd3ad8e3e (patch)
treea176eb52071d0485a7b1757f201b9192de2bcff3 /plugins
parent4b79571a6f529629ccf42ef10bf3f3bd097049b0 (diff)
downloadprosody-afd972f05b2ef093c395e4d0b8b01adcd3ad8e3e.tar.gz
prosody-afd972f05b2ef093c395e4d0b8b01adcd3ad8e3e.zip
mod_saslauth: Never send empty <mechanisms/>, for real this time.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_saslauth.lua10
1 files changed, 4 insertions, 6 deletions
diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua
index 8a4b84d9..9c62e5ec 100644
--- a/plugins/mod_saslauth.lua
+++ b/plugins/mod_saslauth.lua
@@ -248,15 +248,13 @@ module:hook("stream-features", function(event)
return;
end
origin.sasl_handler = usermanager_get_sasl_handler(module.host);
- local mechanisms = origin.sasl_handler:mechanisms();
- if not next(mechanisms) then return; end
- features:tag("mechanisms", mechanisms_attr);
- for mechanism in pairs(mechanisms) do
+ local mechanisms = st.stanza("mechanisms", mechanisms_attr);
+ for mechanism in pairs(origin.sasl_handler:mechanisms()) do
if mechanism ~= "PLAIN" or origin.secure or allow_unencrypted_plain_auth then
- features:tag("mechanism"):text(mechanism):up();
+ mechanisms:tag("mechanism"):text(mechanism):up();
end
end
- features:up();
+ if mechanisms[1] then features:add_child(mechanisms); end
else
features:tag("bind", bind_attr):tag("required"):up():up();
features:tag("session", xmpp_session_attr):tag("optional"):up():up();