util/sasl/digest-md5.lua

changeset 2258
e4c5d0d21ac7
parent 2255
92e329e1cd99
child 2569
8474ea768c89
equal deleted inserted replaced
2257:c1a85068ca36 2258:e4c5d0d21ac7
164 return "failure", "malformed-request", "Missing entry for digest-uri in SASL message." 164 return "failure", "malformed-request", "Missing entry for digest-uri in SASL message."
165 end 165 end
166 166
167 --TODO maybe realm support 167 --TODO maybe realm support
168 self.username = response["username"]; 168 self.username = response["username"];
169 local Y, state;
169 if self.profile.plain then 170 if self.profile.plain then
170 local password, state = self.profile.plain(response["username"], self.realm) 171 local password, state = self.profile.plain(response["username"], self.realm)
171 if state == nil then return "failure", "not-authorized" 172 if state == nil then return "failure", "not-authorized"
172 elseif state == false then return "failure", "account-disabled" end 173 elseif state == false then return "failure", "account-disabled" end
173 local Y = md5(response["username"]..":"..response["realm"]..":"..password); 174 Y = md5(response["username"]..":"..response["realm"]..":"..password);
174 elseif self.profile["digest-md5"] then 175 elseif self.profile["digest-md5"] then
175 local Y, state = self.profile["digest-md5"](response["username"], self.realm, response["realm"], response["charset"]) 176 Y, state = self.profile["digest-md5"](response["username"], self.realm, response["realm"], response["charset"])
176 if state == nil then return "failure", "not-authorized" 177 if state == nil then return "failure", "not-authorized"
177 elseif state == false then return "failure", "account-disabled" end 178 elseif state == false then return "failure", "account-disabled" end
178 elseif self.profile["digest-md5-test"] then 179 elseif self.profile["digest-md5-test"] then
179 -- TODO 180 -- TODO
180 end 181 end

mercurial