# HG changeset patch # User Kim Alvefur # Date 1566428431 -7200 # Node ID d58925bb74ca16f1fe54f9105c8852125bc25ae1 # Parent e458578ddfd3c9330fefb50fdfe2bf67cab00313 mod_auth_internal_hashed: Precompute SCRAM authentication profile name (thanks MattJ) diff -r e458578ddfd3 -r d58925bb74ca plugins/mod_auth_internal_hashed.lua --- a/plugins/mod_auth_internal_hashed.lua Sun Jan 13 14:02:56 2019 +0100 +++ b/plugins/mod_auth_internal_hashed.lua Thu Aug 22 01:00:31 2019 +0200 @@ -23,6 +23,7 @@ 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 @@ 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