Check whether we support the proposed channel binding type.
authorTobias Markmann <tm@ayena.de>
Sat, 15 Jan 2011 17:59:15 +0100
changeset 5829 40c16475194e
parent 5828 24de22c01f8d
child 5830 ae48bf828f21
Check whether we support the proposed channel binding type.
util/sasl.lua
util/sasl/scram.lua
--- a/util/sasl.lua	Wed Jan 12 21:29:37 2011 +0100
+++ b/util/sasl.lua	Sat Jan 15 17:59:15 2011 +0100
@@ -27,6 +27,17 @@
 state = false : disabled
 state = true : enabled
 state = nil : non-existant
+
+Channel Binding:
+
+To enable support of channel binding in some mechanisms you need to provide appropriate callbacks in a table
+at profile.cb.
+
+Example:
+	profile.cb["tls-unique"] = function(self)
+		return self.user
+	end
+
 ]]
 
 local method = {};
--- a/util/sasl/scram.lua	Wed Jan 12 21:29:37 2011 +0100
+++ b/util/sasl/scram.lua	Sat Jan 15 17:59:15 2011 +0100
@@ -137,6 +137,11 @@
 				if string.sub(self.state.gs2_cbind_flag, 0, 1) == "y" then
 					return "failure", "malformed-request";
 				end
+				
+				-- check whether we support the proposed channel binding type
+				if not self.profile.cb[self.state.gs2_cbind_name] then
+					return "failure", "malformed-request", "Proposed channel binding type isn't supported.";
+				end
 			else
 				if self.state.gs2_cbind_flag ~= "n" and self.state.gs2_cbind_flag ~= "y" then
 					return "failure", "malformed-request";