Software / code / prosody
Comparison
plugins/mod_auth_internal_hashed.lua @ 3243:dc7131d4e189
mod_auth_internal_hashed: Fixed a traceback in account creation.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Sun, 13 Jun 2010 04:07:38 +0500 |
| parent | 3219:fd06023cbdcc |
| child | 3267:8f5d76cc4162 |
comparison
equal
deleted
inserted
replaced
| 3242:43f9478d8119 | 3243:dc7131d4e189 |
|---|---|
| 113 end | 113 end |
| 114 | 114 |
| 115 function provider.create_user(username, password) | 115 function provider.create_user(username, password) |
| 116 if is_cyrus(host) then return nil, "Account creation/modification not available with Cyrus SASL."; end | 116 if is_cyrus(host) then return nil, "Account creation/modification not available with Cyrus SASL."; end |
| 117 local salt = generate_uuid(); | 117 local salt = generate_uuid(); |
| 118 local valid, stored_key, server_key = saltedPasswordSHA1(password, salt, iteration_count); | 118 local valid, stored_key, server_key = getAuthenticationDatabaseSHA1(password, salt, iteration_count); |
| 119 local stored_key_hex = stored_key:gsub(".", function (c) return ("%02x"):format(c:byte()); end); | 119 local stored_key_hex = stored_key:gsub(".", function (c) return ("%02x"):format(c:byte()); end); |
| 120 local server_key_hex = server_key:gsub(".", function (c) return ("%02x"):format(c:byte()); end); | 120 local server_key_hex = server_key:gsub(".", function (c) return ("%02x"):format(c:byte()); end); |
| 121 return datamanager.store(username, host, "accounts", {stored_key = stored_key_hex, server_key = server_key_hex, salt = salt, iteration_count = iteration_count}); | 121 return datamanager.store(username, host, "accounts", {stored_key = stored_key_hex, server_key = server_key_hex, salt = salt, iteration_count = iteration_count}); |
| 122 end | 122 end |
| 123 | 123 |