aboutsummaryrefslogtreecommitdiffstats
path: root/util/sasl/scram.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2013-10-13 01:36:28 +0200
committerKim Alvefur <zash@zash.se>2013-10-13 01:36:28 +0200
commit1b7af47f88fd23f56aede33c5759cba16622071f (patch)
tree034ee0d0b63fdea563450ab5e0cf81715a7d2cf9 /util/sasl/scram.lua
parentd25f399ec597164f35f2edc7691f375e4deb8683 (diff)
downloadprosody-1b7af47f88fd23f56aede33c5759cba16622071f.tar.gz
prosody-1b7af47f88fd23f56aede33c5759cba16622071f.zip
util.sasl.scram: Cache profile name instead of concatenating when used
Diffstat (limited to 'util/sasl/scram.lua')
-rw-r--r--util/sasl/scram.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/util/sasl/scram.lua b/util/sasl/scram.lua
index 11fa4e7c..e1404b3b 100644
--- a/util/sasl/scram.lua
+++ b/util/sasl/scram.lua
@@ -101,6 +101,7 @@ function getAuthenticationDatabaseSHA1(password, salt, iteration_count)
end
local function scram_gen(hash_name, H_f, HMAC_f)
+ local profile_name = "scram_" .. hashprep(hash_name);
local function scram_hash(self, message)
local support_channel_binding = false;
if self.profile.cb then support_channel_binding = true; end
@@ -168,9 +169,9 @@ local function scram_gen(hash_name, H_f, HMAC_f)
log("error", "Generating authentication database failed. Reason: %s", stored_key);
return "failure", "temporary-auth-failure";
end
- elseif self.profile["scram_"..hashprep(hash_name)] then
+ elseif self.profile[profile_name] then
local state;
- stored_key, server_key, iteration_count, salt, state = self.profile["scram_"..hashprep(hash_name)](self, name, self.realm);
+ stored_key, server_key, iteration_count, salt, state = self.profile[profile_name](self, name, self.realm);
if state == nil then return "failure", "not-authorized"
elseif state == false then return "failure", "account-disabled" end
end