SASL: Minor cleanup.
--- 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, password, self.realm);
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)