aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_auth_internal_hashed.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-08-22 01:00:31 +0200
committerKim Alvefur <zash@zash.se>2019-08-22 01:00:31 +0200
commitf93754de4a3bc93dc7fd563eb570b358042ad693 (patch)
tree2148727c989a126e678d0437d34f129abdd7df34 /plugins/mod_auth_internal_hashed.lua
parent00f6257046199935e7ebe526c698cfdc7ecc2687 (diff)
downloadprosody-f93754de4a3bc93dc7fd563eb570b358042ad693.tar.gz
prosody-f93754de4a3bc93dc7fd563eb570b358042ad693.zip
mod_auth_internal_hashed: Precompute SCRAM authentication profile name (thanks MattJ)
Diffstat (limited to 'plugins/mod_auth_internal_hashed.lua')
-rw-r--r--plugins/mod_auth_internal_hashed.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/plugins/mod_auth_internal_hashed.lua b/plugins/mod_auth_internal_hashed.lua
index 174e848a..be22a8d8 100644
--- a/plugins/mod_auth_internal_hashed.lua
+++ b/plugins/mod_auth_internal_hashed.lua
@@ -23,6 +23,7 @@ local accounts = module:open_store("accounts");
local hash_name = module:get_option_string("password_hash", "SHA-1");
local get_auth_db = assert(scram_hashers[hash_name], "SCRAM-"..hash_name.." not supported by SASL library");
+local scram_name = "scram_"..hash_name:gsub("%-","_"):lower();
-- Default; can be set per-user
local default_iteration_count = 4096;
@@ -117,7 +118,7 @@ function provider.get_sasl_handler()
plain_test = function(_, username, password, realm)
return usermanager.test_password(username, realm, password), true;
end,
- ["scram_"..hash_name:gsub("%-","_"):lower()] = function(_, username)
+ [scram_name] = function(_, username)
local credentials = accounts:get(username);
if not credentials then return; end
if credentials.password then