Comparison

util/sasl.lua @ 505:1b938e00412c

Remove that idn stuff for realm because it's either an ugly hack that the password_handler isn't ready for or something worse.
author Tobias Markmann <tm@ayena.de>
date Sun, 30 Nov 2008 02:26:37 +0100
parent 496:b3251b137d68
child 507:4d3ccc6b5817
comparison
equal deleted inserted replaced
496:b3251b137d68 505:1b938e00412c
86 if (self.step == 1) then 86 if (self.step == 1) then
87 local challenge = serialize({ nonce = object.nonce, 87 local challenge = serialize({ nonce = object.nonce,
88 qop = "auth", 88 qop = "auth",
89 charset = "utf-8", 89 charset = "utf-8",
90 algorithm = "md5-sess", 90 algorithm = "md5-sess",
91 realm = idna_ascii(self.realm)}); 91 realm = self.realm});
92 return "challenge", challenge 92 return "challenge", challenge
93 elseif (self.step == 2) then 93 elseif (self.step == 2) then
94 local response = parse(message) 94 local response = parse(message)
95 -- check for replay attack 95 -- check for replay attack
96 if response["nc"] then 96 if response["nc"] then
125 return "failure", "malformed-request", "Missing entry for digest-uri in SASL message." 125 return "failure", "malformed-request", "Missing entry for digest-uri in SASL message."
126 end 126 end
127 127
128 --TODO maybe realm support 128 --TODO maybe realm support
129 self.username = response["username"] 129 self.username = response["username"]
130 local password_encoding, Y = self.password_handler(response["username"], idna_unicode(response["realm"]), "DIGEST-MD5") 130 local password_encoding, Y = self.password_handler(response["username"], response["realm"], "DIGEST-MD5")
131 if Y == nil then return "failure", "not-authorized" 131 if Y == nil then return "failure", "not-authorized"
132 elseif Y == false then return "failure", "account-disabled" end 132 elseif Y == false then return "failure", "account-disabled" end
133 133
134 local A1 = Y..":"..response["nonce"]..":"..response["cnonce"]--:authzid 134 local A1 = Y..":"..response["nonce"]..":"..response["cnonce"]--:authzid
135 local A2 = "AUTHENTICATE:"..protocol.."/"..idna_ascii(domain) 135 local A2 = "AUTHENTICATE:"..protocol.."/"..idna_ascii(domain)