Software /
code /
prosody
Comparison
plugins/mod_saslauth.lua @ 3240:9782a222e941
Merge 0.7->trunk
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 12 Jun 2010 02:39:18 +0100 |
parent | 3188:c690e3c5105c |
parent | 3238:362b94fa5a30 |
child | 3350:f0e312c9da01 |
comparison
equal
deleted
inserted
replaced
3235:651139e831b1 | 3240:9782a222e941 |
---|---|
93 local function handle_status(session, status, ret, err_msg) | 93 local function handle_status(session, status, ret, err_msg) |
94 if status == "failure" then | 94 if status == "failure" then |
95 session.sasl_handler = session.sasl_handler:clean_clone(); | 95 session.sasl_handler = session.sasl_handler:clean_clone(); |
96 elseif status == "success" then | 96 elseif status == "success" then |
97 local username = nodeprep(session.sasl_handler.username); | 97 local username = nodeprep(session.sasl_handler.username); |
98 if not username then -- TODO move this to sessionmanager | |
99 module:log("warn", "SASL succeeded but we didn't get a username!"); | |
100 session.sasl_handler = nil; | |
101 session:reset_stream(); | |
102 return status, ret, err_msg; | |
103 end | |
104 | 98 |
105 if not(require_provisioning) or usermanager_user_exists(username, session.host) then | 99 if not(require_provisioning) or usermanager_user_exists(username, session.host) then |
106 sm_make_authenticated(session, session.sasl_handler.username); | 100 local aret, err = sm_make_authenticated(session, session.sasl_handler.username); |
107 session.sasl_handler = nil; | 101 if aret then |
108 session:reset_stream(); | 102 session.sasl_handler = nil; |
103 session:reset_stream(); | |
104 else | |
105 module:log("warn", "SASL succeeded but username was invalid"); | |
106 session.sasl_handler = session.sasl_handler:clean_clone(); | |
107 return "failure", "not-authorized", "User authenticated successfully, but username was invalid"; | |
108 end | |
109 else | 109 else |
110 module:log("warn", "SASL succeeded but we don't have an account provisioned for %s", username); | 110 module:log("warn", "SASL succeeded but we don't have an account provisioned for %s", username); |
111 session.sasl_handler = session.sasl_handler:clean_clone(); | 111 session.sasl_handler = session.sasl_handler:clean_clone(); |
112 return "failure", "not-authorized", "User authenticated successfully, but not provisioned for XMPP"; | 112 return "failure", "not-authorized", "User authenticated successfully, but not provisioned for XMPP"; |
113 end | 113 end |