diff options
author | Waqas Hussain <waqas20@gmail.com> | 2010-06-07 03:07:58 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2010-06-07 03:07:58 +0500 |
commit | 21d34b1fb9c0a676b4373c769400e7587471cb01 (patch) | |
tree | eccf98c280c2efe659f5b78ad59bf6e040fe19d4 /plugins/mod_auth_internal_hashed.lua | |
parent | 9e6d86c40215fdd7ff055e3a39fe18651597c0ba (diff) | |
download | prosody-21d34b1fb9c0a676b4373c769400e7587471cb01.tar.gz prosody-21d34b1fb9c0a676b4373c769400e7587471cb01.zip |
mod_auth_internal_hashed: Added SCRAM-SHA-1 support for SASL.
Diffstat (limited to 'plugins/mod_auth_internal_hashed.lua')
-rw-r--r-- | plugins/mod_auth_internal_hashed.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/plugins/mod_auth_internal_hashed.lua b/plugins/mod_auth_internal_hashed.lua index e793add2..9cffcc6e 100644 --- a/plugins/mod_auth_internal_hashed.lua +++ b/plugins/mod_auth_internal_hashed.lua @@ -117,6 +117,16 @@ function new_hashpass_provider(host) 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); |