Comparison

plugins/mod_saslauth.lua @ 449:c0a4a1e63d70

Completely switched to new hashes library from the old md5 library
author Waqas Hussain <waqas20@gmail.com>
date Fri, 28 Nov 2008 01:16:26 +0500
parent 447:c0dae734d3bf
child 519:cccd610a0ef9
comparison
equal deleted inserted replaced
448:2623519b25b0 449:c0a4a1e63d70
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 local jid_split = require "util.jid".split
11 local md5 = require "util.hashes".md5;
11 12
12 local log = require "util.logger".init("mod_saslauth"); 13 local log = require "util.logger".init("mod_saslauth");
13 14
14 local xmlns_sasl ='urn:ietf:params:xml:ns:xmpp-sasl'; 15 local xmlns_sasl ='urn:ietf:params:xml:ns:xmpp-sasl';
15 local xmlns_bind ='urn:ietf:params:xml:ns:xmpp-bind'; 16 local xmlns_bind ='urn:ietf:params:xml:ns:xmpp-bind';
48 local func = function(x) return x; end; 49 local func = function(x) return x; end;
49 if password then 50 if password then
50 if mechanism == "PLAIN" then 51 if mechanism == "PLAIN" then
51 return func, password; 52 return func, password;
52 elseif mechanism == "DIGEST-MD5" then 53 elseif mechanism == "DIGEST-MD5" then
53 return func, require "md5".sum(node..":"..host..":"..password); 54 return func, md5(node..":"..host..":"..password);
54 end 55 end
55 end 56 end
56 return func, nil; 57 return func, nil;
57 end 58 end
58 59