aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_auth_internal_hashed.lua
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2010-06-08 14:54:47 +0200
committerTobias Markmann <tm@ayena.de>2010-06-08 14:54:47 +0200
commit392a5dc56c0fccbfe1a01d2cbafd95a405162b70 (patch)
treec2d23e21ed7c4f547fda978982919f85297a5616 /plugins/mod_auth_internal_hashed.lua
parentb31120775b59ed388bee390187d8911d8e5e4213 (diff)
downloadprosody-392a5dc56c0fccbfe1a01d2cbafd95a405162b70.tar.gz
prosody-392a5dc56c0fccbfe1a01d2cbafd95a405162b70.zip
mod_auth_internal_hashed: Store stored_key and server_key when setting a password.
Diffstat (limited to 'plugins/mod_auth_internal_hashed.lua')
-rw-r--r--plugins/mod_auth_internal_hashed.lua13
1 files changed, 9 insertions, 4 deletions
diff --git a/plugins/mod_auth_internal_hashed.lua b/plugins/mod_auth_internal_hashed.lua
index 50e0e052..c1e56ab6 100644
--- a/plugins/mod_auth_internal_hashed.lua
+++ b/plugins/mod_auth_internal_hashed.lua
@@ -53,6 +53,8 @@ function new_hashpass_provider(host)
return nil, "Auth failed. Stored salt and iteration count information is not complete.";
end
+ if credentials.saltedPasswordSHA1
+
local valid, stored_key, server_key = getAuthenticationDatabaseSHA1(password, credentials.salt, credentials.iteration_count);
local stored_key_hex = stored_key:gsub(".", function (c) return ("%02x"):format(c:byte()); end);
local server_key_hex = server_key:gsub(".", function (c) return ("%02x"):format(c:byte()); end);
@@ -75,10 +77,13 @@ function new_hashpass_provider(host)
if account.salt == nil then
account.salt = generate_uuid();
end
-
- local valid, binpass = saltedPasswordSHA1(password, account.salt, account.iteration_count);
- local hexpass = binpass:gsub(".", function (c) return ("%02x"):format(c:byte()); end);
- account.hashpass = hexpass;
+
+ local valid, stored_key, server_key = getAuthenticationDatabaseSHA1(password, credentials.salt, credentials.iteration_count);
+ local stored_key_hex = stored_key:gsub(".", function (c) return ("%02x"):format(c:byte()); end);
+ local server_key_hex = server_key:gsub(".", function (c) return ("%02x"):format(c:byte()); end);
+
+ account.stored_key = stored_key_hex
+ account.server_key = server_key_hex
account.password = nil;
return datamanager.store(username, host, "accounts", account);