diff options
Diffstat (limited to 'util/sasl.lua')
-rw-r--r-- | util/sasl.lua | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/util/sasl.lua b/util/sasl.lua index 393a0919..0d90880d 100644 --- a/util/sasl.lua +++ b/util/sasl.lua @@ -68,13 +68,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 @@ -131,5 +135,6 @@ require "util.sasl.plain" .init(registerMechanism); require "util.sasl.digest-md5".init(registerMechanism); require "util.sasl.anonymous" .init(registerMechanism); require "util.sasl.scram" .init(registerMechanism); +require "util.sasl.external" .init(registerMechanism); return _M; |