50 |
50 |
51 local function handle_status(session, status) |
51 local function handle_status(session, status) |
52 if status == "failure" then |
52 if status == "failure" then |
53 session.sasl_handler = nil; |
53 session.sasl_handler = nil; |
54 elseif status == "success" then |
54 elseif status == "success" then |
55 if not session.sasl_handler.username then -- TODO move this to sessionmanager |
55 local username = nodeprep(session.sasl_handler.username); |
|
56 session.sasl_handler = nil; |
|
57 if not username then -- TODO move this to sessionmanager |
56 module:log("warn", "SASL succeeded but we didn't get a username!"); |
58 module:log("warn", "SASL succeeded but we didn't get a username!"); |
57 session.sasl_handler = nil; |
|
58 session:reset_stream(); |
59 session:reset_stream(); |
59 return; |
60 return; |
60 end |
61 end |
61 sm_make_authenticated(session, session.sasl_handler.username); |
62 sm_make_authenticated(session, username); |
62 session.sasl_handler = nil; |
|
63 session:reset_stream(); |
63 session:reset_stream(); |
64 end |
64 end |
65 end |
65 end |
66 |
66 |
67 local function password_callback(node, hostname, realm, mechanism, decoder) |
67 local function password_callback(node, hostname, realm, mechanism, decoder) |