aboutsummaryrefslogtreecommitdiffstats
path: root/util/sasl.lua
diff options
context:
space:
mode:
Diffstat (limited to 'util/sasl.lua')
-rw-r--r--util/sasl.lua26
1 files changed, 13 insertions, 13 deletions
diff --git a/util/sasl.lua b/util/sasl.lua
index 306acc0c..5d1b9f17 100644
--- a/util/sasl.lua
+++ b/util/sasl.lua
@@ -88,18 +88,21 @@ end
-- get a list of possible SASL mechanims to use
function method:mechanisms()
- local mechanisms = {}
- for backend, f in pairs(self.profile) do
- if backend_mechanism[backend] then
- for _, mechanism in ipairs(backend_mechanism[backend]) do
- if not self.restrict:contains(mechanism) then
- mechanisms[mechanism] = true;
+ local mechanisms = self.mechs;
+ if not mechanisms then
+ mechanisms = {}
+ for backend, f in pairs(self.profile) do
+ if backend_mechanism[backend] then
+ for _, mechanism in ipairs(backend_mechanism[backend]) do
+ if not self.restrict:contains(mechanism) then
+ mechanisms[mechanism] = true;
+ end
end
end
end
+ self.mechs = mechanisms;
end
- self["possible_mechanisms"] = mechanisms;
- return array.collect(keys(mechanisms));
+ return mechanisms;
end
-- select a mechanism to use
@@ -108,11 +111,8 @@ function method:select(mechanism)
return false;
end
- self.mech_i = mechanisms[mechanism]
- if self.mech_i == nil then
- return false;
- end
- return true;
+ self.mech_i = mechanisms[self:mechanisms()[mechanism] and mechanism];
+ return (self.mech_i ~= nil);
end
-- feed new messages to process into the library