Software /
code /
prosody
Diff
util/sasl.lua @ 599:30655c5cc531
Latin1 support for SASL DIGEST-MD5 (second, and possibly final commit)
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Mon, 08 Dec 2008 00:18:01 +0500 |
parent | 595:08ed4fa2f89d |
child | 602:a977227aa9e6 |
line wrap: on
line diff
--- a/util/sasl.lua Sun Dec 07 23:43:08 2008 +0500 +++ b/util/sasl.lua Mon Dec 08 00:18:01 2008 +0500 @@ -177,11 +177,10 @@ if not response["qop"] then response["qop"] = "auth" end if response["realm"] == nil then response["realm"] = "" end - local raw_realm = response["realm"]; + local decoder; if response["charset"] == nil then - response["username"] = latin1toutf8(response["username"]) - response["realm"] = utf8tolatin1ifpossible(response["realm"]) + decoder = utf8tolatin1ifpossible; 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 @@ -197,7 +196,7 @@ --TODO maybe realm support self.username = response["username"] - local password_encoding, Y = self.password_handler(response["username"], response["realm"], "DIGEST-MD5", raw_realm) + local password_encoding, Y = self.password_handler(response["username"], response["realm"], "DIGEST-MD5", decoder) if Y == nil then return "failure", "not-authorized" elseif Y == false then return "failure", "account-disabled" end