Comparison

plugins/mod_saslauth.lua @ 1375:50ee4b327f86

Adding a parameter for realm to the password_callback.
author Tobias Markmann <tm@ayena.de>
date Sat, 20 Jun 2009 19:34:30 +0200
parent 1217:844ef764ef0e
child 1449:6a90316a81c3
comparison
equal deleted inserted replaced
1374:e85726d084d6 1375:50ee4b327f86
62 session.sasl_handler = nil; 62 session.sasl_handler = nil;
63 session:reset_stream(); 63 session:reset_stream();
64 end 64 end
65 end 65 end
66 66
67 local function password_callback(node, host, mechanism, decoder) 67 local function password_callback(node, hostname, realm, mechanism, decoder)
68 local password = (datamanager_load(node, host, "accounts") or {}).password; -- FIXME handle hashed passwords 68 local password = (datamanager_load(node, hostname, "accounts") or {}).password; -- FIXME handle hashed passwords
69 local func = function(x) return x; end; 69 local func = function(x) return x; end;
70 if password then 70 if password then
71 if mechanism == "PLAIN" then 71 if mechanism == "PLAIN" then
72 return func, password; 72 return func, password;
73 elseif mechanism == "DIGEST-MD5" then 73 elseif mechanism == "DIGEST-MD5" then
74 if decoder then node, host, password = decoder(node), decoder(host), decoder(password); end 74 if decoder then node, hostname, password = decoder(node), decoder(hostname), decoder(password); end
75 return func, md5(node..":"..host..":"..password); 75 return func, md5(node..":"..realm..":"..password);
76 end 76 end
77 end 77 end
78 return func, nil; 78 return func, nil;
79 end 79 end
80 80