X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=util%2Fsasl.lua;h=b91e29a6cd51c4c8da4b54e8e4fec318f4c20488;hb=95dfe4b0aaaf26ee4651c09eb9757c56210a135a;hp=0d90880dcda40a6f15b70e768e5132a8c4bbd706;hpb=37105ec863ddbb6fe6885269d816e0a48f82bbf5;p=prosody.git diff --git a/util/sasl.lua b/util/sasl.lua index 0d90880d..b91e29a6 100644 --- a/util/sasl.lua +++ b/util/sasl.lua @@ -18,7 +18,6 @@ local type = type local setmetatable = setmetatable; local assert = assert; local require = require; -local print = print module "sasl" @@ -48,7 +47,7 @@ local backend_mechanism = {}; local mechanism_channelbindings = {}; -- register a new SASL mechanims -local function registerMechanism(name, backends, f, cb_backends) +function registerMechanism(name, backends, f, cb_backends) assert(type(name) == "string", "Parameter name MUST be a string."); assert(type(backends) == "string" or type(backends) == "table", "Parameter backends MUST be either a string or a table."); assert(type(f) == "function", "Parameter f MUST be a function."); @@ -101,14 +100,16 @@ end function method:mechanisms() local current_mechs = {}; for mech, _ in pairs(self.mechs) do - if mechanism_channelbindings[mech] and self.profile.cb then - local ok = false; - for cb_name, _ in pairs(self.profile.cb) do - if mechanism_channelbindings[mech][cb_name] then - ok = true; + if mechanism_channelbindings[mech] then + if self.profile.cb then + local ok = false; + for cb_name, _ in pairs(self.profile.cb) do + if mechanism_channelbindings[mech][cb_name] then + ok = true; + end end + if ok == true then current_mechs[mech] = true; end end - if ok == true then current_mechs[mech] = true; end else current_mechs[mech] = true; end