Comparison

plugins/mod_saslauth.lua @ 599:30655c5cc531

Latin1 support for SASL DIGEST-MD5 (second, and possibly final commit)
author Waqas Hussain <waqas20@gmail.com>
date Mon, 08 Dec 2008 00:18:01 +0500
parent 595:08ed4fa2f89d
child 615:4ae3e81513f3
comparison
equal deleted inserted replaced
595:08ed4fa2f89d 599:30655c5cc531
64 session.sasl_handler = nil; 64 session.sasl_handler = nil;
65 session:reset_stream(); 65 session:reset_stream();
66 end 66 end
67 end 67 end
68 68
69 local function password_callback(node, host, mechanism, raw_host) 69 local function password_callback(node, host, mechanism, decoder)
70 log("host", host); 70 local password = (datamanager.load(node, host, "accounts") or {}).password; -- FIXME handle hashed passwords
71 log("raw_host", raw_host);
72 local password = (datamanager.load(node, raw_host, "accounts") or {}).password; -- FIXME handle hashed passwords
73 local func = function(x) return x; end; 71 local func = function(x) return x; end;
74 if password then 72 if password then
75 if mechanism == "PLAIN" then 73 if mechanism == "PLAIN" then
76 return func, password; 74 return func, password;
77 elseif mechanism == "DIGEST-MD5" then 75 elseif mechanism == "DIGEST-MD5" then
76 if decoder then node, host, password = decoder(node), decoder(host), decoder(password); end
78 return func, md5(node..":"..host..":"..password); 77 return func, md5(node..":"..host..":"..password);
79 end 78 end
80 end 79 end
81 return func, nil; 80 return func, nil;
82 end 81 end