Software /
code /
prosody
Comparison
util/sasl.lua @ 1485:fbefd16d2955
Move to-unicode conversion from mod_saslauth.lua to sasl.lua.
author | Tobias Markmann <tm@ayena.de> |
---|---|
date | Sun, 05 Jul 2009 19:02:55 +0200 |
parent | 1376:13587cf24435 |
child | 1518:9707dfa80980 |
comparison
equal
deleted
inserted
replaced
1484:80e4f1d731c2 | 1485:fbefd16d2955 |
---|---|
17 local tostring = tostring; | 17 local tostring = tostring; |
18 local st = require "util.stanza"; | 18 local st = require "util.stanza"; |
19 local generate_uuid = require "util.uuid".generate; | 19 local generate_uuid = require "util.uuid".generate; |
20 local t_insert, t_concat = table.insert, table.concat; | 20 local t_insert, t_concat = table.insert, table.concat; |
21 local to_byte, to_char = string.byte, string.char; | 21 local to_byte, to_char = string.byte, string.char; |
22 local to_unicode = require "util.encodings".idna.to_unicode; | |
22 local s_match = string.match; | 23 local s_match = string.match; |
23 local gmatch = string.gmatch | 24 local gmatch = string.gmatch |
24 local string = string | 25 local string = string |
25 local math = require "math" | 26 local math = require "math" |
26 local type = type | 27 local type = type |
197 return "failure", "malformed-request", "Missing entry for digest-uri in SASL message." | 198 return "failure", "malformed-request", "Missing entry for digest-uri in SASL message." |
198 end | 199 end |
199 | 200 |
200 --TODO maybe realm support | 201 --TODO maybe realm support |
201 self.username = response["username"]; | 202 self.username = response["username"]; |
202 local password_encoding, Y = self.password_handler(response["username"], domain, response["realm"], "DIGEST-MD5", decoder); | 203 local password_encoding, Y = self.password_handler(response["username"], to_unicode(domain), response["realm"], "DIGEST-MD5", decoder); |
203 if Y == nil then return "failure", "not-authorized" | 204 if Y == nil then return "failure", "not-authorized" |
204 elseif Y == false then return "failure", "account-disabled" end | 205 elseif Y == false then return "failure", "account-disabled" end |
205 local A1 = ""; | 206 local A1 = ""; |
206 if response.authzid then | 207 if response.authzid then |
207 if response.authzid == self.username.."@"..self.realm then | 208 if response.authzid == self.username.."@"..self.realm then |