# HG changeset patch # User Tobias Markmann # Date 1276001687 -7200 # Node ID b350d9753804b447e5ecfaa17556ebec710dba31 # Parent ff1d3f751da157b023c6ddfd54b982fe29623527 mod_auth_internal_hashed: Store stored_key and server_key when setting a password. diff -r ff1d3f751da1 -r b350d9753804 plugins/mod_auth_internal_hashed.lua --- a/plugins/mod_auth_internal_hashed.lua Tue Jun 08 11:00:26 2010 +0200 +++ b/plugins/mod_auth_internal_hashed.lua Tue Jun 08 14:54:47 2010 +0200 @@ -53,6 +53,8 @@ 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 @@ 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);