Software /
code /
prosody
Comparison
core/sessionmanager.lua @ 7784:9f70d35a1602
core.sessionmanager, mod_saslauth: Introduce intermediate session type for authenticated but unbound sessions so that resource binding is not treated as a normal stanza
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 13 Dec 2016 18:15:17 +0100 |
parent | 7496:98c8d14be4ef |
child | 7786:b62353e6a8e5 |
child | 7947:24170d74b00b |
comparison
equal
deleted
inserted
replaced
7783:f54c960240da | 7784:9f70d35a1602 |
---|---|
106 local function make_authenticated(session, username) | 106 local function make_authenticated(session, username) |
107 username = nodeprep(username); | 107 username = nodeprep(username); |
108 if not username or #username == 0 then return nil, "Invalid username"; end | 108 if not username or #username == 0 then return nil, "Invalid username"; end |
109 session.username = username; | 109 session.username = username; |
110 if session.type == "c2s_unauthed" then | 110 if session.type == "c2s_unauthed" then |
111 session.type = "c2s"; | 111 session.type = "c2s_unbound"; |
112 end | 112 end |
113 session.log("info", "Authenticated as %s@%s", username or "(unknown)", session.host or "(unknown)"); | 113 session.log("info", "Authenticated as %s@%s", username or "(unknown)", session.host or "(unknown)"); |
114 return true; | 114 return true; |
115 end | 115 end |
116 | 116 |
174 | 174 |
175 session.resource = resource; | 175 session.resource = resource; |
176 session.full_jid = session.username .. '@' .. session.host .. '/' .. resource; | 176 session.full_jid = session.username .. '@' .. session.host .. '/' .. resource; |
177 hosts[session.host].sessions[session.username].sessions[resource] = session; | 177 hosts[session.host].sessions[session.username].sessions[resource] = session; |
178 full_sessions[session.full_jid] = session; | 178 full_sessions[session.full_jid] = session; |
179 if session.type == "c2s_unbound" then | |
180 session.type = "c2s"; | |
181 end | |
179 | 182 |
180 local err; | 183 local err; |
181 session.roster, err = rm_load_roster(session.username, session.host); | 184 session.roster, err = rm_load_roster(session.username, session.host); |
182 if err then | 185 if err then |
183 full_sessions[session.full_jid] = nil; | 186 full_sessions[session.full_jid] = nil; |