5 local jid |
5 local jid |
6 |
6 |
7 local usermanager_validate_credentials = require "core.usermanager".validate_credentials; |
7 local usermanager_validate_credentials = require "core.usermanager".validate_credentials; |
8 local t_concat, t_insert = table.concat, table.insert; |
8 local t_concat, t_insert = table.concat, table.insert; |
9 local tostring = tostring; |
9 local tostring = tostring; |
|
10 local jid_split = require "util.jid".split |
10 |
11 |
11 local log = require "util.logger".init("mod_saslauth"); |
12 local log = require "util.logger".init("mod_saslauth"); |
12 |
13 |
13 local xmlns_sasl ='urn:ietf:params:xml:ns:xmpp-sasl'; |
14 local xmlns_sasl ='urn:ietf:params:xml:ns:xmpp-sasl'; |
14 local xmlns_bind ='urn:ietf:params:xml:ns:xmpp-bind'; |
15 local xmlns_bind ='urn:ietf:params:xml:ns:xmpp-bind'; |
63 return; |
64 return; |
64 end |
65 end |
65 end |
66 end |
66 local status, ret = session.sasl_handler:feed(text); |
67 local status, ret = session.sasl_handler:feed(text); |
67 handle_status(session, status); |
68 handle_status(session, status); |
68 session.send(build_reply(status, ret)); |
69 local s = build_reply(status, ret); |
|
70 log("debug", "sasl reply: "..tostring(s)); |
|
71 session.send(s); |
69 end |
72 end |
70 |
73 |
71 add_handler("c2s_unauthed", "auth", xmlns_sasl, |
74 add_handler("c2s_unauthed", "auth", xmlns_sasl, |
72 function (session, stanza) |
75 function (session, stanza) |
73 if not session.sasl_handler then |
76 if not session.sasl_handler then |