Changeset

6036:f9e108f7db21

util.sasl: Fix logic for when mechanisms with channel binding support are offered
author Kim Alvefur <zash@zash.se>
date Sat, 22 Mar 2014 14:45:04 +0100
parents 6031:8796aa94c4b5
children 6037:7bbe22d8dd09
files util/sasl.lua
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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