Software /
code /
prosody
Comparison
plugins/mod_saslauth.lua @ 1846:fdb43fc1bafc
mod_saslauth: Prep username used for authenticating a session
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 29 Sep 2009 19:54:31 +0100 |
parent | 1721:1dcfb2c64302 |
child | 1847:1842da566c7d |
comparison
equal
deleted
inserted
replaced
1844:a4a8fe2a560c | 1846:fdb43fc1bafc |
---|---|
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) |