diff options
author | Matthew Wild <mwild1@gmail.com> | 2010-06-12 02:39:18 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2010-06-12 02:39:18 +0100 |
commit | 06982adcd24eabee31abcebc167411430697d55a (patch) | |
tree | 986567d378b68a194e49c780a06ac427f82054bc /plugins | |
parent | fdb9749df9dbd15aab3607a5b09c2f6652877e6e (diff) | |
parent | bc718af42e21112f168a114eb9840b54976f6179 (diff) | |
download | prosody-06982adcd24eabee31abcebc167411430697d55a.tar.gz prosody-06982adcd24eabee31abcebc167411430697d55a.zip |
Merge 0.7->trunk
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_saslauth.lua | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua index 99be8c34..acfb57f6 100644 --- a/plugins/mod_saslauth.lua +++ b/plugins/mod_saslauth.lua @@ -95,17 +95,17 @@ local function handle_status(session, status, ret, err_msg) session.sasl_handler = session.sasl_handler:clean_clone(); elseif status == "success" then local username = nodeprep(session.sasl_handler.username); - if not username then -- TODO move this to sessionmanager - module:log("warn", "SASL succeeded but we didn't get a username!"); - session.sasl_handler = nil; - session:reset_stream(); - return status, ret, err_msg; - end if not(require_provisioning) or usermanager_user_exists(username, session.host) then - sm_make_authenticated(session, session.sasl_handler.username); - session.sasl_handler = nil; - session:reset_stream(); + local aret, err = sm_make_authenticated(session, session.sasl_handler.username); + if aret then + session.sasl_handler = nil; + session:reset_stream(); + else + module:log("warn", "SASL succeeded but username was invalid"); + session.sasl_handler = session.sasl_handler:clean_clone(); + return "failure", "not-authorized", "User authenticated successfully, but username was invalid"; + end else module:log("warn", "SASL succeeded but we don't have an account provisioned for %s", username); session.sasl_handler = session.sasl_handler:clean_clone(); |