Changeset

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
parents 507:4d3ccc6b5817
children 509:32899c8a6fe5
files util/sasl.lua
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
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