diff options
author | Waqas Hussain <waqas20@gmail.com> | 2010-12-27 19:57:04 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2010-12-27 19:57:04 +0500 |
commit | 1865c2454bf4037fdc992485451de1fc5214c508 (patch) | |
tree | 61b9f26137fe3dadaf8d3d422355c7e0c8c9f2bd | |
parent | c1d6450cec9153c4b6c3d46ed1127a4eee092c50 (diff) | |
download | prosody-1865c2454bf4037fdc992485451de1fc5214c508.tar.gz prosody-1865c2454bf4037fdc992485451de1fc5214c508.zip |
util.sasl.*, mod_auth_*, mod_saslauth: Pass SASL handler as first parameter to SASL profile callbacks.
-rw-r--r-- | plugins/mod_auth_anonymous.lua | 2 | ||||
-rw-r--r-- | plugins/mod_auth_internal_hashed.lua | 4 | ||||
-rw-r--r-- | plugins/mod_auth_internal_plain.lua | 2 | ||||
-rw-r--r-- | plugins/mod_saslauth.lua | 2 | ||||
-rw-r--r-- | util/sasl/anonymous.lua | 2 | ||||
-rw-r--r-- | util/sasl/digest-md5.lua | 4 | ||||
-rw-r--r-- | util/sasl/plain.lua | 4 | ||||
-rw-r--r-- | util/sasl/scram.lua | 4 |
8 files changed, 12 insertions, 12 deletions
diff --git a/plugins/mod_auth_anonymous.lua b/plugins/mod_auth_anonymous.lua index 0741a158..9d0896e5 100644 --- a/plugins/mod_auth_anonymous.lua +++ b/plugins/mod_auth_anonymous.lua @@ -36,7 +36,7 @@ function new_default_provider(host) function provider.get_sasl_handler() local realm = module:get_option("sasl_realm") or module.host; local anonymous_authentication_profile = { - anonymous = function(username, realm) + anonymous = function(sasl, username, realm) return true; -- for normal usage you should always return true here end }; diff --git a/plugins/mod_auth_internal_hashed.lua b/plugins/mod_auth_internal_hashed.lua index 300bebf8..ec8da9ab 100644 --- a/plugins/mod_auth_internal_hashed.lua +++ b/plugins/mod_auth_internal_hashed.lua @@ -138,7 +138,7 @@ function new_hashpass_provider(host) function provider.get_sasl_handler() local realm = module:get_option("sasl_realm") or module.host; local testpass_authentication_profile = { - plain_test = function(username, password, realm) + plain_test = function(sasl, username, password, realm) local prepped_username = nodeprep(username); if not prepped_username then log("debug", "NODEprep failed on username: %s", username); @@ -146,7 +146,7 @@ function new_hashpass_provider(host) end return usermanager.test_password(prepped_username, realm, password), true; end, - scram_sha_1 = function(username, realm) + scram_sha_1 = function(sasl, username, realm) local credentials = datamanager.load(username, host, "accounts"); if not credentials then return; end if credentials.password then diff --git a/plugins/mod_auth_internal_plain.lua b/plugins/mod_auth_internal_plain.lua index 4cf0edb6..3721781b 100644 --- a/plugins/mod_auth_internal_plain.lua +++ b/plugins/mod_auth_internal_plain.lua @@ -66,7 +66,7 @@ function new_default_provider(host) function provider.get_sasl_handler() local realm = module:get_option("sasl_realm") or module.host; local getpass_authentication_profile = { - plain = function(username, realm) + plain = function(sasl, username, realm) local prepped_username = nodeprep(username); if not prepped_username then log("debug", "NODEprep failed on username: %s", username); diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua index e1746c8e..65053ffa 100644 --- a/plugins/mod_saslauth.lua +++ b/plugins/mod_saslauth.lua @@ -31,7 +31,7 @@ local xmlns_stanzas ='urn:ietf:params:xml:ns:xmpp-stanzas'; local new_sasl = require "util.sasl".new; local anonymous_authentication_profile = { - anonymous = function(username, realm) + anonymous = function(sasl, username, realm) return true; -- for normal usage you should always return true here end }; diff --git a/util/sasl/anonymous.lua b/util/sasl/anonymous.lua index 6e6f0949..b9af17fe 100644 --- a/util/sasl/anonymous.lua +++ b/util/sasl/anonymous.lua @@ -34,7 +34,7 @@ local function anonymous(self, message) local username; repeat username = generate_uuid(); - until self.profile.anonymous(username, self.realm); + until self.profile.anonymous(self, username, self.realm); self.username = username; return "success" end diff --git a/util/sasl/digest-md5.lua b/util/sasl/digest-md5.lua index 2837148e..6f2c765e 100644 --- a/util/sasl/digest-md5.lua +++ b/util/sasl/digest-md5.lua @@ -181,12 +181,12 @@ local function digest(self, message) self.username = response["username"]; local Y, state; if self.profile.plain then - local password, state = self.profile.plain(response["username"], self.realm) + local password, state = self.profile.plain(self, response["username"], self.realm) if state == nil then return "failure", "not-authorized" elseif state == false then return "failure", "account-disabled" end Y = md5(response["username"]..":"..response["realm"]..":"..password); elseif self.profile["digest-md5"] then - Y, state = self.profile["digest-md5"](response["username"], self.realm, response["realm"], response["charset"]) + Y, state = self.profile["digest-md5"](self, response["username"], self.realm, response["realm"], response["charset"]) if state == nil then return "failure", "not-authorized" elseif state == false then return "failure", "account-disabled" end elseif self.profile["digest-md5-test"] then diff --git a/util/sasl/plain.lua b/util/sasl/plain.lua index 1a2ba01e..d6ebe304 100644 --- a/util/sasl/plain.lua +++ b/util/sasl/plain.lua @@ -57,10 +57,10 @@ local function plain(self, message) local correct, state = false, false; if self.profile.plain then local correct_password; - correct_password, state = self.profile.plain(authentication, self.realm); + correct_password, state = self.profile.plain(self, authentication, self.realm); correct = (correct_password == password); elseif self.profile.plain_test then - correct, state = self.profile.plain_test(authentication, password, self.realm); + correct, state = self.profile.plain_test(self, authentication, password, self.realm); end self.username = authentication diff --git a/util/sasl/scram.lua b/util/sasl/scram.lua index c846a7d1..530ef5a0 100644 --- a/util/sasl/scram.lua +++ b/util/sasl/scram.lua @@ -143,7 +143,7 @@ local function scram_gen(hash_name, H_f, HMAC_f) -- retreive credentials if self.profile.plain then - local password, state = self.profile.plain(self.state.name, self.realm) + local password, state = self.profile.plain(self, self.state.name, self.realm) if state == nil then return "failure", "not-authorized" elseif state == false then return "failure", "account-disabled" end @@ -163,7 +163,7 @@ local function scram_gen(hash_name, H_f, HMAC_f) return "failure", "temporary-auth-failure"; end elseif self.profile["scram_"..hashprep(hash_name)] then - local stored_key, server_key, iteration_count, salt, state = self.profile["scram_"..hashprep(hash_name)](self.state.name, self.realm); + local stored_key, server_key, iteration_count, salt, state = self.profile["scram_"..hashprep(hash_name)](self, self.state.name, self.realm); if state == nil then return "failure", "not-authorized" elseif state == false then return "failure", "account-disabled" end |