plugins/mod_saslauth.lua

changeset 1486
3e04efa8af7e
parent 1484
80e4f1d731c2
child 1523
841d61be198f
equal deleted inserted replaced
1485:fbefd16d2955 1486:3e04efa8af7e
10 10
11 local st = require "util.stanza"; 11 local st = require "util.stanza";
12 local sm_bind_resource = require "core.sessionmanager".bind_resource; 12 local sm_bind_resource = require "core.sessionmanager".bind_resource;
13 local sm_make_authenticated = require "core.sessionmanager".make_authenticated; 13 local sm_make_authenticated = require "core.sessionmanager".make_authenticated;
14 local base64 = require "util.encodings".base64; 14 local base64 = require "util.encodings".base64;
15 local to_unicode = require "util.encodings".idna.to_unicode;
16 15
17 local datamanager_load = require "util.datamanager".load; 16 local datamanager_load = require "util.datamanager".load;
18 local usermanager_validate_credentials = require "core.usermanager".validate_credentials; 17 local usermanager_validate_credentials = require "core.usermanager".validate_credentials;
19 local t_concat, t_insert = table.concat, table.insert; 18 local t_concat, t_insert = table.concat, table.insert;
20 local tostring = tostring; 19 local tostring = tostring;
64 session:reset_stream(); 63 session:reset_stream();
65 end 64 end
66 end 65 end
67 66
68 local function password_callback(node, hostname, realm, mechanism, decoder) 67 local function password_callback(node, hostname, realm, mechanism, decoder)
69 local password = (datamanager_load(node, to_unicode(hostname), "accounts") or {}).password; -- FIXME handle hashed passwords 68 local password = (datamanager_load(node, hostname, "accounts") or {}).password; -- FIXME handle hashed passwords
70 local func = function(x) return x; end; 69 local func = function(x) return x; end;
71 if password then 70 if password then
72 if mechanism == "PLAIN" then 71 if mechanism == "PLAIN" then
73 return func, password; 72 return func, password;
74 elseif mechanism == "DIGEST-MD5" then 73 elseif mechanism == "DIGEST-MD5" then

mercurial