aboutsummaryrefslogtreecommitdiffstats
path: root/util/sasl.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2010-12-29 18:45:31 +0500
committerWaqas Hussain <waqas20@gmail.com>2010-12-29 18:45:31 +0500
commitd057082fc6a397348da8bacfcec1af37e931af70 (patch)
treee01172d11e53cdfabb1e05e13bd7f5991ddf6330 /util/sasl.lua
parent86cea8a5d8797089558309b92ffeeb34ff0ad08b (diff)
downloadprosody-d057082fc6a397348da8bacfcec1af37e931af70.tar.gz
prosody-d057082fc6a397348da8bacfcec1af37e931af70.zip
util.sasl: Cache the calculated mechanisms set for SASL profiles (profile.mechanisms table).
Diffstat (limited to 'util/sasl.lua')
-rw-r--r--util/sasl.lua14
1 files changed, 9 insertions, 5 deletions
diff --git a/util/sasl.lua b/util/sasl.lua
index 93b79a86..17d10b80 100644
--- a/util/sasl.lua
+++ b/util/sasl.lua
@@ -48,13 +48,17 @@ end
-- create a new SASL object which can be used to authenticate clients
function new(realm, profile)
- local mechanisms = {};
- for backend, f in pairs(profile) do
- if backend_mechanism[backend] then
- for _, mechanism in ipairs(backend_mechanism[backend]) do
- mechanisms[mechanism] = true;
+ local mechanisms = profile.mechanisms;
+ if not mechanisms then
+ mechanisms = {};
+ for backend, f in pairs(profile) do
+ if backend_mechanism[backend] then
+ for _, mechanism in ipairs(backend_mechanism[backend]) do
+ mechanisms[mechanism] = true;
+ end
end
end
+ profile.mechanisms = mechanisms;
end
return setmetatable({ profile = profile, realm = realm, mechs = mechanisms }, method);
end