diff options
author | Matthew Wild <mwild1@gmail.com> | 2008-11-20 01:33:25 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2008-11-20 01:33:25 +0000 |
commit | 5c7ec634b1765f8edcc8b59aff2b2b899180dc65 (patch) | |
tree | 07dbd8f7cafdc380476d8e6dd0bc478775809800 /plugins/mod_saslauth.lua | |
parent | 6a333d94d6779850451ca74249906ebf53c5f369 (diff) | |
download | prosody-5c7ec634b1765f8edcc8b59aff2b2b899180dc65.tar.gz prosody-5c7ec634b1765f8edcc8b59aff2b2b899180dc65.zip |
Use a stanza for c2s stream features instead of an array of strings. Removes a FIXME.
Diffstat (limited to 'plugins/mod_saslauth.lua')
-rw-r--r-- | plugins/mod_saslauth.lua | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua index 6ceb0be3..7ca4308b 100644 --- a/plugins/mod_saslauth.lua +++ b/plugins/mod_saslauth.lua @@ -83,19 +83,21 @@ add_handler("c2s_unauthed", "auth", xmlns_sasl, sasl_handler); add_handler("c2s_unauthed", "abort", xmlns_sasl, sasl_handler); 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' }; add_event_hook("stream-features", function (session, features) if not session.username then - t_insert(features, "<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>"); + features:tag("mechanisms", mechanisms_attr); -- TODO: Provide PLAIN only if TLS is active, this is a SHOULD from the introduction of RFC 4616. This behavior could be overridden via configuration but will issuing a warning or so. - t_insert(features, "<mechanism>PLAIN</mechanism>"); - t_insert(features, "<mechanism>DIGEST-MD5</mechanism>"); - t_insert(features, "</mechanisms>"); + features:tag("mechanism"):text("PLAIN"):up(); + features:tag("mechanism"):text("DIGEST-MD5"):up(); + features:up(); else - t_insert(features, "<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><required/></bind>"); - t_insert(features, "<session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>"); + features:tag("bind", bind_attr):tag("required"):up():up(); + features:tag("session", xmpp_session_attr):up(); end - --send [[<register xmlns="http://jabber.org/features/iq-register"/> ]] end); add_iq_handler("c2s", "urn:ietf:params:xml:ns:xmpp-bind", |