Software /
code /
prosody
Comparison
util/sasl.lua @ 529:631e7d16d22b
Fix for handling latin1 encoded hostnames in SASL
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Wed, 03 Dec 2008 22:08:49 +0500 |
parent | 519:cccd610a0ef9 |
child | 595:08ed4fa2f89d |
comparison
equal
deleted
inserted
replaced
524:3f9f67f1a106 | 529:631e7d16d22b |
---|---|
142 | 142 |
143 if not response["cnonce"] then return "failure", "malformed-request", "Missing entry for cnonce in SASL message." end | 143 if not response["cnonce"] then return "failure", "malformed-request", "Missing entry for cnonce in SASL message." end |
144 if not response["qop"] then response["qop"] = "auth" end | 144 if not response["qop"] then response["qop"] = "auth" end |
145 | 145 |
146 if response["realm"] == nil then response["realm"] = "" end | 146 if response["realm"] == nil then response["realm"] = "" end |
147 local raw_realm = response["realm"]; | |
147 | 148 |
148 if response["charset"] == nil then | 149 if response["charset"] == nil then |
149 response["username"] = latin1toutf8(response["username"]) | 150 response["username"] = latin1toutf8(response["username"]) |
150 response["realm"] = latin1toutf8(response["realm"]) | 151 response["realm"] = latin1toutf8(response["realm"]) |
151 elseif response["charset"] ~= "utf-8" then | 152 elseif response["charset"] ~= "utf-8" then |
161 return "failure", "malformed-request", "Missing entry for digest-uri in SASL message." | 162 return "failure", "malformed-request", "Missing entry for digest-uri in SASL message." |
162 end | 163 end |
163 | 164 |
164 --TODO maybe realm support | 165 --TODO maybe realm support |
165 self.username = response["username"] | 166 self.username = response["username"] |
166 local password_encoding, Y = self.password_handler(response["username"], response["realm"], "DIGEST-MD5") | 167 local password_encoding, Y = self.password_handler(response["username"], response["realm"], "DIGEST-MD5", raw_realm) |
167 if Y == nil then return "failure", "not-authorized" | 168 if Y == nil then return "failure", "not-authorized" |
168 elseif Y == false then return "failure", "account-disabled" end | 169 elseif Y == false then return "failure", "account-disabled" end |
169 | 170 |
170 local A1 = Y..":"..response["nonce"]..":"..response["cnonce"]--:authzid | 171 local A1 = Y..":"..response["nonce"]..":"..response["cnonce"]--:authzid |
171 local A2 = "AUTHENTICATE:"..protocol.."/"..idna_ascii(domain) | 172 local A2 = "AUTHENTICATE:"..protocol.."/"..idna_ascii(domain) |