# HG changeset patch # User Waqas Hussain # Date 1275569330 -18000 # Node ID bb4286962d69db4f1052be33670828c08ef359ad # Parent 6459166ed8f3b9e1456ca269643d470e85bb5c02 SASL: Minor cleanup. diff -r 6459166ed8f3 -r bb4286962d69 util/sasl.lua --- 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 diff -r 6459166ed8f3 -r bb4286962d69 util/sasl/anonymous.lua --- 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 diff -r 6459166ed8f3 -r bb4286962d69 util/sasl/plain.lua --- 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, password, self.realm); end diff -r 6459166ed8f3 -r bb4286962d69 util/sasl/scram.lua --- 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)