diff options
author | Waqas Hussain <waqas20@gmail.com> | 2008-12-08 00:18:01 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2008-12-08 00:18:01 +0500 |
commit | 2e6fcdb2d0126ddf6dac449d950ffbf5c7c523ba (patch) | |
tree | bce218ffd664831d79c2e575de6ef84b3d1c1124 /util/sasl.lua | |
parent | 0595c7a86c4ebbdab236b9f3cf2de4be84f0b90d (diff) | |
download | prosody-2e6fcdb2d0126ddf6dac449d950ffbf5c7c523ba.tar.gz prosody-2e6fcdb2d0126ddf6dac449d950ffbf5c7c523ba.zip |
Latin1 support for SASL DIGEST-MD5 (second, and possibly final commit)
Diffstat (limited to 'util/sasl.lua')
-rw-r--r-- | util/sasl.lua | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/util/sasl.lua b/util/sasl.lua index 75f1da96..89980eb2 100644 --- a/util/sasl.lua +++ b/util/sasl.lua @@ -177,11 +177,10 @@ local function new_digest_md5(realm, password_handler) 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 @@ local function new_digest_md5(realm, password_handler) --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 |