util/sasl.lua

changeset 508
4fd60ae97535
parent 507
4d3ccc6b5817
child 519
cccd610a0ef9
--- 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

mercurial