Comparison

util/sasl.lua @ 508:4fd60ae97535

Converting latin encoded responsed to utf-8 when needed.
author Tobias Markmann <tm@ayena.de>
date Sun, 30 Nov 2008 17:34:47 +0100
parent 507:4d3ccc6b5817
child 519:cccd610a0ef9
comparison
equal deleted inserted replaced
507:4d3ccc6b5817 508:4fd60ae97535
130 if not response["cnonce"] then return "failure", "malformed-request", "Missing entry for cnonce in SASL message." end 130 if not response["cnonce"] then return "failure", "malformed-request", "Missing entry for cnonce in SASL message." end
131 if not response["qop"] then response["qop"] = "auth" end 131 if not response["qop"] then response["qop"] = "auth" end
132 132
133 if response["realm"] == nil then response["realm"] = "" end 133 if response["realm"] == nil then response["realm"] = "" end
134 134
135 if response["charset"] == nil then
136 response["username"] = latin1toutf8(response["username"])
137 response["realm"] = latin1toutf8(response["realm"])
138 elseif response["charset"] ~= "utf-8" then
139 return "failure", "incorrect-encoding", "The client's response uses "..response["charset"].." for encoding with isn't supported by sasl.lua. Supported encodings are latin or utf-8."
140 end
141
135 local domain = "" 142 local domain = ""
136 local protocol = "" 143 local protocol = ""
137 if response["digest-uri"] then 144 if response["digest-uri"] then
138 protocol, domain = response["digest-uri"]:match("(%w+)/(.*)$") 145 protocol, domain = response["digest-uri"]:match("(%w+)/(.*)$")
139 if protocol == nil or domain == nil then return "failure", "malformed-request" end 146 if protocol == nil or domain == nil then return "failure", "malformed-request" end