# HG changeset patch # User Kim Alvefur # Date 1395495904 -3600 # Node ID f9e108f7db2136eec6eba647e40cb628d5f999e3 # Parent 8796aa94c4b5b06af0bc0a4a9ab4fab6636d5fb1 util.sasl: Fix logic for when mechanisms with channel binding support are offered diff -r 8796aa94c4b5 -r f9e108f7db21 util/sasl.lua --- a/util/sasl.lua Sun Mar 09 23:47:53 2014 +0100 +++ b/util/sasl.lua Sat Mar 22 14:45:04 2014 +0100 @@ -100,14 +100,16 @@ 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