Software /
code /
prosody
Comparison
util/sasl/scram.lua @ 2995:175002d404b8
util.sasl.scram: Adjusting authentication backend name to conform with the style already used by the plain module.
author | Tobias Markmann <tm@ayena.de> |
---|---|
date | Sun, 28 Feb 2010 22:58:43 +0100 |
parent | 2993:06d06fdd190b |
child | 2996:b0515ed4d9d7 |
comparison
equal
deleted
inserted
replaced
2994:b8448e181487 | 2995:175002d404b8 |
---|---|
127 return "failure", "not-authorized", "Invalid password." | 127 return "failure", "not-authorized", "Invalid password." |
128 end | 128 end |
129 self.state.salt = generate_uuid(); | 129 self.state.salt = generate_uuid(); |
130 self.state.iteration_count = default_i; | 130 self.state.iteration_count = default_i; |
131 self.state.salted_password = Hi(HMAC_f, password, self.state.salt, default_i); | 131 self.state.salted_password = Hi(HMAC_f, password, self.state.salt, default_i); |
132 elseif self.profile["scram-"..hash_name] then | 132 elseif self.profile["scram_"..hash_name] then |
133 salted_password, iteration_count, salt, state = self.profile["scram-"..hash_name](self.state.name, self.realm); | 133 salted_password, iteration_count, salt, state = self.profile["scram-"..hash_name](self.state.name, self.realm); |
134 if state == nil then return "failure", "not-authorized" | 134 if state == nil then return "failure", "not-authorized" |
135 elseif state == false then return "failure", "account-disabled" end | 135 elseif state == false then return "failure", "account-disabled" end |
136 | 136 |
137 self.state.salted_password = salted_password; | 137 self.state.salted_password = salted_password; |
175 return scram_hash; | 175 return scram_hash; |
176 end | 176 end |
177 | 177 |
178 function init(registerMechanism) | 178 function init(registerMechanism) |
179 local function registerSCRAMMechanism(hash_name, hash, hmac_hash) | 179 local function registerSCRAMMechanism(hash_name, hash, hmac_hash) |
180 registerMechanism("SCRAM-"..hash_name, {"plain", "scram-"..(hash_name:lower())}, scram_gen(hash_name:lower(), hash, hmac_hash)); | 180 registerMechanism("SCRAM-"..hash_name, {"plain", "scram_"..(hash_name:lower())}, scram_gen(hash_name:lower(), hash, hmac_hash)); |
181 end | 181 end |
182 | 182 |
183 registerSCRAMMechanism("SHA-1", sha1, hmac_sha1); | 183 registerSCRAMMechanism("SHA-1", sha1, hmac_sha1); |
184 end | 184 end |
185 | 185 |