Diff

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
line wrap: on
line diff
--- a/util/sasl.lua	Sun Nov 30 17:18:31 2008 +0100
+++ b/util/sasl.lua	Sun Nov 30 17:34:47 2008 +0100
@@ -132,6 +132,13 @@
 			
 			if response["realm"] == nil then response["realm"] = "" end
 			
+			if response["charset"] == nil then
+				response["username"] = latin1toutf8(response["username"])
+				response["realm"] = latin1toutf8(response["realm"])
+			elseif response["charset"] ~= "utf-8" then
+				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."
+			end
+			
 			local domain = ""
 			local protocol = ""
 			if response["digest-uri"] then