Software /
code /
prosody
Changeset
3155:c713fa2ba80c
SASL: Minor cleanup.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Thu, 03 Jun 2010 17:48:50 +0500 |
parents | 3154:104f05235cef |
children | 3156:89b64966f511 |
files | util/sasl.lua util/sasl/anonymous.lua util/sasl/plain.lua util/sasl/scram.lua |
diffstat | 4 files changed, 6 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/util/sasl.lua Thu Jun 03 17:47:51 2010 +0500 +++ b/util/sasl.lua Thu Jun 03 17:48:50 2010 +0500 @@ -108,11 +108,8 @@ return false; end - self.mech_i = mechanisms[mechanism] - if self.mech_i == nil then - return false; - end - return true; + self.mech_i = mechanisms[mechanism]; + return (self.mech_i ~= nil); end -- feed new messages to process into the library
--- a/util/sasl/anonymous.lua Thu Jun 03 17:47:51 2010 +0500 +++ b/util/sasl/anonymous.lua Thu Jun 03 17:48:50 2010 +0500 @@ -35,7 +35,7 @@ repeat username = generate_uuid(); until self.profile.anonymous(username, self.realm); - self["username"] = username; + self.username = username; return "success" end
--- a/util/sasl/plain.lua Thu Jun 03 17:47:51 2010 +0500 +++ b/util/sasl/plain.lua Thu Jun 03 17:48:50 2010 +0500 @@ -58,7 +58,7 @@ if self.profile.plain then local correct_password; correct_password, state = self.profile.plain(authentication, self.realm); - if correct_password == password then correct = true; else correct = false; end + correct = (correct_password == password); elseif self.profile.plain_test then correct, state = self.profile.plain_test(authentication, self.realm, password); end
--- a/util/sasl/scram.lua Thu Jun 03 17:47:51 2010 +0500 +++ b/util/sasl/scram.lua Thu Jun 03 17:48:50 2010 +0500 @@ -93,10 +93,8 @@ return username; end -local function hashprep( hashname ) - local hash = hashname:lower() - hash = hash:gsub("-", "_") - return hash +local function hashprep(hashname) + return hashname:lower():gsub("-", "_"); end function saltedPasswordSHA1(password, salt, iteration_count)