Software /
code /
prosody
Changeset
3189:d686abb6b069
mod_auth_internal_hashed: Added SCRAM-SHA-1 support for SASL.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Mon, 07 Jun 2010 03:07:58 +0500 |
parents | 3188:c690e3c5105c |
children | 3190:c4069680a01c |
files | plugins/mod_auth_internal_hashed.lua |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_auth_internal_hashed.lua Mon Jun 07 02:40:14 2010 +0500 +++ b/plugins/mod_auth_internal_hashed.lua Mon Jun 07 03:07:58 2010 +0500 @@ -117,6 +117,16 @@ return "", nil; end return usermanager.test_password(prepped_username, password, realm), true; + end, + scram_sha_1 = function(username, realm) + local credentials = datamanager.load(username, host, "accounts") or {}; + if credentials.password then + usermanager.set_password(username, credentials.password); + credentials = datamanager.load(username, host, "accounts") or {}; + end + local salted_password, iteration_count, salt = credentials.hashpass, credentials.iteration_count, credentials.salt; + salted_password = salted_password and salted_password:gsub("..", function(x) return string.char(tonumber(x, 16)); end); + return salted_password, iteration_count, salt, true; end }; return new_sasl(realm, testpass_authentication_profile);