# HG changeset patch # User Waqas Hussain # Date 1275862078 -18000 # Node ID d686abb6b069a37b08c88d16452bc82ec0aaefd5 # Parent c690e3c5105c245bc0618d6b7af4befff825be27 mod_auth_internal_hashed: Added SCRAM-SHA-1 support for SASL. diff -r c690e3c5105c -r d686abb6b069 plugins/mod_auth_internal_hashed.lua --- 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);