Comparison

plugins/mod_saslauth.lua @ 1449:6a90316a81c3

Making sure the node is in unicode when passing it to password lookup function.
author Tobias Markmann <tm@ayena.de>
date Wed, 01 Jul 2009 15:14:44 +0200
parent 1375:50ee4b327f86
child 1484:80e4f1d731c2
comparison
equal deleted inserted replaced
1448:700ea94e1769 1449:6a90316a81c3
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;
15 16
16 local datamanager_load = require "util.datamanager".load; 17 local datamanager_load = require "util.datamanager".load;
17 local usermanager_validate_credentials = require "core.usermanager".validate_credentials; 18 local usermanager_validate_credentials = require "core.usermanager".validate_credentials;
18 local t_concat, t_insert = table.concat, table.insert; 19 local t_concat, t_insert = table.concat, table.insert;
19 local tostring = tostring; 20 local tostring = tostring;
63 session:reset_stream(); 64 session:reset_stream();
64 end 65 end
65 end 66 end
66 67
67 local function password_callback(node, hostname, realm, mechanism, decoder) 68 local function password_callback(node, hostname, realm, mechanism, decoder)
68 local password = (datamanager_load(node, hostname, "accounts") or {}).password; -- FIXME handle hashed passwords 69 local password = (datamanager_load(node, to_unicode(hostname), "accounts") or {}).password; -- FIXME handle hashed passwords
69 local func = function(x) return x; end; 70 local func = function(x) return x; end;
70 if password then 71 if password then
71 if mechanism == "PLAIN" then 72 if mechanism == "PLAIN" then
72 return func, password; 73 return func, password;
73 elseif mechanism == "DIGEST-MD5" then 74 elseif mechanism == "DIGEST-MD5" then