Comparison

plugins/mod_auth_internal_hashed.lua @ 3289:180a0b3b018d

mod_auth_internal_hashed: Update TODO comments to COMPAT
author Matthew Wild <mwild1@gmail.com>
date Tue, 22 Jun 2010 20:54:15 +0100
parent 3288:1a84d7d6f667
child 3335:f13306ce3417
comparison
equal deleted inserted replaced
3288:1a84d7d6f667 3289:180a0b3b018d
20 local generate_uuid = require "util.uuid".generate; 20 local generate_uuid = require "util.uuid".generate;
21 local new_sasl = require "util.sasl".new; 21 local new_sasl = require "util.sasl".new;
22 local nodeprep = require "util.encodings".stringprep.nodeprep; 22 local nodeprep = require "util.encodings".stringprep.nodeprep;
23 local hosts = hosts; 23 local hosts = hosts;
24 24
25 -- TODO: remove these two lines in near future 25 -- COMPAT w/old trunk: remove these two lines before 0.8 release
26 local hmac_sha1 = require "util.hmac".sha1; 26 local hmac_sha1 = require "util.hmac".sha1;
27 local sha1 = require "util.hashes".sha1; 27 local sha1 = require "util.hashes".sha1;
28 28
29 local to_hex; 29 local to_hex;
30 do 30 do
74 if credentials.iteration_count == nil or credentials.salt == nil or string.len(credentials.salt) == 0 then 74 if credentials.iteration_count == nil or credentials.salt == nil or string.len(credentials.salt) == 0 then
75 return nil, "Auth failed. Stored salt and iteration count information is not complete."; 75 return nil, "Auth failed. Stored salt and iteration count information is not complete.";
76 end 76 end
77 77
78 -- convert hexpass to stored_key and server_key 78 -- convert hexpass to stored_key and server_key
79 -- TODO: remove this in near future 79 -- COMPAT w/old trunk: remove before 0.8 release
80 if credentials.hashpass then 80 if credentials.hashpass then
81 local salted_password = from_hex(credentials.hashpass); 81 local salted_password = from_hex(credentials.hashpass);
82 credentials.stored_key = sha1(hmac_sha1(salted_password, "Client Key"), true); 82 credentials.stored_key = sha1(hmac_sha1(salted_password, "Client Key"), true);
83 credentials.server_key = to_hex(hmac_sha1(salted_password, "Server Key")); 83 credentials.server_key = to_hex(hmac_sha1(salted_password, "Server Key"));
84 credentials.hashpass = nil 84 credentials.hashpass = nil
153 usermanager.set_password(username, credentials.password, host); 153 usermanager.set_password(username, credentials.password, host);
154 credentials = datamanager.load(username, host, "accounts") or {}; 154 credentials = datamanager.load(username, host, "accounts") or {};
155 end 155 end
156 156
157 -- convert hexpass to stored_key and server_key 157 -- convert hexpass to stored_key and server_key
158 -- TODO: remove this in near future 158 -- COMPAT w/old trunk: remove before 0.8 release
159 if credentials.hashpass then 159 if credentials.hashpass then
160 local salted_password = from_hex(credentials.hashpass); 160 local salted_password = from_hex(credentials.hashpass);
161 credentials.stored_key = sha1(hmac_sha1(salted_password, "Client Key"), true); 161 credentials.stored_key = sha1(hmac_sha1(salted_password, "Client Key"), true);
162 credentials.server_key = to_hex(hmac_sha1(salted_password, "Server Key")); 162 credentials.server_key = to_hex(hmac_sha1(salted_password, "Server Key"));
163 credentials.hashpass = nil 163 credentials.hashpass = nil