Software /
code /
prosody
Comparison
util/sasl/scram.lua @ 4049:fe6f4a255fd8
util.sasl.*, mod_auth_*, mod_saslauth: Pass SASL handler as first parameter to SASL profile callbacks.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Mon, 27 Dec 2010 19:57:04 +0500 |
parent | 3540:bc139431830b |
child | 4113:65482a852c4d |
child | 5828:24de22c01f8d |
comparison
equal
deleted
inserted
replaced
4048:c64b0aefb922 | 4049:fe6f4a255fd8 |
---|---|
141 | 141 |
142 self.state["servernonce"] = generate_uuid(); | 142 self.state["servernonce"] = generate_uuid(); |
143 | 143 |
144 -- retreive credentials | 144 -- retreive credentials |
145 if self.profile.plain then | 145 if self.profile.plain then |
146 local password, state = self.profile.plain(self.state.name, self.realm) | 146 local password, state = self.profile.plain(self, self.state.name, self.realm) |
147 if state == nil then return "failure", "not-authorized" | 147 if state == nil then return "failure", "not-authorized" |
148 elseif state == false then return "failure", "account-disabled" end | 148 elseif state == false then return "failure", "account-disabled" end |
149 | 149 |
150 password = saslprep(password); | 150 password = saslprep(password); |
151 if not password then | 151 if not password then |
161 if not succ then | 161 if not succ then |
162 log("error", "Generating authentication database failed. Reason: %s", self.state.stored_key); | 162 log("error", "Generating authentication database failed. Reason: %s", self.state.stored_key); |
163 return "failure", "temporary-auth-failure"; | 163 return "failure", "temporary-auth-failure"; |
164 end | 164 end |
165 elseif self.profile["scram_"..hashprep(hash_name)] then | 165 elseif self.profile["scram_"..hashprep(hash_name)] then |
166 local stored_key, server_key, iteration_count, salt, state = self.profile["scram_"..hashprep(hash_name)](self.state.name, self.realm); | 166 local stored_key, server_key, iteration_count, salt, state = self.profile["scram_"..hashprep(hash_name)](self, self.state.name, self.realm); |
167 if state == nil then return "failure", "not-authorized" | 167 if state == nil then return "failure", "not-authorized" |
168 elseif state == false then return "failure", "account-disabled" end | 168 elseif state == false then return "failure", "account-disabled" end |
169 | 169 |
170 self.state.stored_key = stored_key; | 170 self.state.stored_key = stored_key; |
171 self.state.server_key = server_key; | 171 self.state.server_key = server_key; |