# HG changeset patch # User Tobias Markmann <tm@ayena.de> # Date 1295110755 -3600 # Node ID 40c16475194e36ab1647fb4f5d9c3846da350489 # Parent 24de22c01f8d9a0f855db39634f649aefbfeec01 Check whether we support the proposed channel binding type. diff -r 24de22c01f8d -r 40c16475194e util/sasl.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 = {}; diff -r 24de22c01f8d -r 40c16475194e util/sasl/scram.lua --- 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";