Software /
code /
prosody
Comparison
plugins/mod_auth_internal_hashed.lua @ 3216:d4d0519cd0c1
mod_auth_internal_hashed: Removed some useless code.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Wed, 09 Jun 2010 22:01:47 +0500 |
parent | 3214:a69d8021b1db |
child | 3219:fd06023cbdcc |
comparison
equal
deleted
inserted
replaced
3215:e55782f20679 | 3216:d4d0519cd0c1 |
---|---|
55 | 55 |
56 if credentials.iteration_count == nil or credentials.salt == nil or string.len(credentials.salt) == 0 then | 56 if credentials.iteration_count == nil or credentials.salt == nil or string.len(credentials.salt) == 0 then |
57 return nil, "Auth failed. Stored salt and iteration count information is not complete."; | 57 return nil, "Auth failed. Stored salt and iteration count information is not complete."; |
58 end | 58 end |
59 | 59 |
60 local valid, stored_key, server_key | |
61 | |
62 -- convert hexpass to stored_key and server_key | 60 -- convert hexpass to stored_key and server_key |
63 -- TODO: remove this in near future | 61 -- TODO: remove this in near future |
64 if credentials.hashpass then | 62 if credentials.hashpass then |
65 valid = true; | |
66 local salted_password = credentials.hashpass:gsub("..", function(x) return string.char(tonumber(x, 16)); end); | 63 local salted_password = credentials.hashpass:gsub("..", function(x) return string.char(tonumber(x, 16)); end); |
67 credentials.stored_key = sha1(hmac_sha1(salted_password, "Client Key")):gsub(".", function (c) return ("%02x"):format(c:byte()); end); | 64 credentials.stored_key = sha1(hmac_sha1(salted_password, "Client Key")):gsub(".", function (c) return ("%02x"):format(c:byte()); end); |
68 credentials.server_key = hmac_sha1(salted_password, "Server Key"):gsub(".", function (c) return ("%02x"):format(c:byte()); end); | 65 credentials.server_key = hmac_sha1(salted_password, "Server Key"):gsub(".", function (c) return ("%02x"):format(c:byte()); end); |
69 credentials.hashpass = nil | 66 credentials.hashpass = nil |
70 datamanager.store(username, host, "accounts", credentials); | 67 datamanager.store(username, host, "accounts", credentials); |