Comparison

util/sasl/scram.lua @ 2255:92e329e1cd99

Make some more variables to locals.
author Tobias Markmann <tm@ayena.de>
date Sat, 28 Nov 2009 18:32:41 +0100
parent 2210:78c9b5255b27
child 2265:7fe644057dc2
comparison
equal deleted inserted replaced
2254:f966c8699f5b 2255:92e329e1cd99
52 -- hash algorithm independent Hi(PBKDF2) implementation 52 -- hash algorithm independent Hi(PBKDF2) implementation
53 local function Hi(hmac, str, salt, i) 53 local function Hi(hmac, str, salt, i)
54 local Ust = hmac(str, salt.."\0\0\0\1"); 54 local Ust = hmac(str, salt.."\0\0\0\1");
55 local res = Ust; 55 local res = Ust;
56 for n=1,i-1 do 56 for n=1,i-1 do
57 Und = hmac(str, Ust) 57 local Und = hmac(str, Ust)
58 res = binaryXOR(res, Und) 58 res = binaryXOR(res, Und)
59 Ust = Und 59 Ust = Und
60 end 60 end
61 return res 61 return res
62 end 62 end
116 return "failure", "malformed-request", "Missing an attribute(p, r or c) in SASL message."; 116 return "failure", "malformed-request", "Missing an attribute(p, r or c) in SASL message.";
117 end 117 end
118 118
119 local password; 119 local password;
120 if self.profile.plain then 120 if self.profile.plain then
121 password, state = self.profile.plain(self.state.name, self.realm) 121 local password, state = self.profile.plain(self.state.name, self.realm)
122 if state == nil then return "failure", "not-authorized" 122 if state == nil then return "failure", "not-authorized"
123 elseif state == false then return "failure", "account-disabled" end 123 elseif state == false then return "failure", "account-disabled" end
124 password = saslprep(password); 124 password = saslprep(password);
125 if not password then 125 if not password then
126 log("debug", "Password violates SASLprep."); 126 log("debug", "Password violates SASLprep.");