Comparison

plugins/mod_saslauth.lua @ 294:5d861d6e5bbd

Made SASL module fit the new interface.
author Tobias Markmann <tm@ayena.de>
date Sat, 15 Nov 2008 22:30:09 +0100
parent 293:b446de4e258e
child 297:15b375870b40
comparison
equal deleted inserted replaced
293:b446de4e258e 294:5d861d6e5bbd
1 1
2 local st = require "util.stanza"; 2 local st = require "util.stanza";
3 local send = require "core.sessionmanager".send_to_session; 3 local send = require "core.sessionmanager".send_to_session;
4 local sm_bind_resource = require "core.sessionmanager".bind_resource; 4 local sm_bind_resource = require "core.sessionmanager".bind_resource;
5 local jid 5 local jid
6 local base64 = require "base64"
6 7
7 local usermanager_validate_credentials = require "core.usermanager".validate_credentials; 8 local usermanager_validate_credentials = require "core.usermanager".validate_credentials;
8 local t_concat, t_insert = table.concat, table.insert; 9 local t_concat, t_insert = table.concat, table.insert;
9 local tostring = tostring; 10 local tostring = tostring;
10 local jid_split = require "util.jid".split 11 local jid_split = require "util.jid".split
99 function (session, features) 100 function (session, features)
100 if not session.username then 101 if not session.username then
101 t_insert(features, "<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>"); 102 t_insert(features, "<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>");
102 -- 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. 103 -- 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.
103 t_insert(features, "<mechanism>PLAIN</mechanism>"); 104 t_insert(features, "<mechanism>PLAIN</mechanism>");
104 -- t_insert(features, "<mechanism>DIGEST-MD5</mechanism>"); 105 t_insert(features, "<mechanism>DIGEST-MD5</mechanism>");
105 t_insert(features, "</mechanisms>"); 106 t_insert(features, "</mechanisms>");
106 else 107 else
107 t_insert(features, "<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><required/></bind>"); 108 t_insert(features, "<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><required/></bind>");
108 t_insert(features, "<session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>"); 109 t_insert(features, "<session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>");
109 end 110 end