util.sasl: Fix logic for when mechanisms with channel binding support are offered
authorKim Alvefur <zash@zash.se>
Sat, 22 Mar 2014 14:45:04 +0100
changeset 6036 f9e108f7db21
parent 6031 8796aa94c4b5
child 6037 7bbe22d8dd09
util.sasl: Fix logic for when mechanisms with channel binding support are offered
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