diff options
author | Waqas Hussain <waqas20@gmail.com> | 2010-06-03 17:48:50 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2010-06-03 17:48:50 +0500 |
commit | 27869c5ecb1a8a0e0c969bc9ecc829cb61f186d4 (patch) | |
tree | 6b45f90c547092d95093ce7a5d5febba3f4f5c0c /util | |
parent | ff82c8510b8b301b09ca095fd3eceddaa3582677 (diff) | |
download | prosody-27869c5ecb1a8a0e0c969bc9ecc829cb61f186d4.tar.gz prosody-27869c5ecb1a8a0e0c969bc9ecc829cb61f186d4.zip |
SASL: Minor cleanup.
Diffstat (limited to 'util')
-rw-r--r-- | util/sasl.lua | 7 | ||||
-rw-r--r-- | util/sasl/anonymous.lua | 2 | ||||
-rw-r--r-- | util/sasl/plain.lua | 2 | ||||
-rw-r--r-- | util/sasl/scram.lua | 6 |
4 files changed, 6 insertions, 11 deletions
diff --git a/util/sasl.lua b/util/sasl.lua index 306acc0c..c9225f0d 100644 --- a/util/sasl.lua +++ b/util/sasl.lua @@ -108,11 +108,8 @@ function method:select(mechanism) 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 --git a/util/sasl/anonymous.lua b/util/sasl/anonymous.lua index f3e31a7f..6e6f0949 100644 --- a/util/sasl/anonymous.lua +++ b/util/sasl/anonymous.lua @@ -35,7 +35,7 @@ local function anonymous(self, message) repeat username = generate_uuid(); until self.profile.anonymous(username, self.realm); - self["username"] = username; + self.username = username; return "success" end diff --git a/util/sasl/plain.lua b/util/sasl/plain.lua index 39821182..eaf03d83 100644 --- a/util/sasl/plain.lua +++ b/util/sasl/plain.lua @@ -58,7 +58,7 @@ local function plain(self, message) 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 diff --git a/util/sasl/scram.lua b/util/sasl/scram.lua index 1340423c..c366a152 100644 --- a/util/sasl/scram.lua +++ b/util/sasl/scram.lua @@ -93,10 +93,8 @@ local function validate_username(username) 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) |