Software /
code /
prosody
Diff
core/sessionmanager.lua @ 3088:a233aa051125
sessionmanager: If roster loading fails during resource bind, kick the user with an internal-server-error.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Sat, 22 May 2010 05:52:24 +0500 |
parent | 2925:692b3c6c5bd2 |
child | 3089:69fb1cb6b551 |
line wrap: on
line diff
--- a/core/sessionmanager.lua Sat May 22 05:50:47 2010 +0500 +++ b/core/sessionmanager.lua Sat May 22 05:52:24 2010 +0500 @@ -174,7 +174,19 @@ hosts[session.host].sessions[session.username].sessions[resource] = session; full_sessions[session.full_jid] = session; - session.roster = rm_load_roster(session.username, session.host); + local err; + session.roster, err = rm_load_roster(session.username, session.host); + if err then + full_sessions[session.full_jid] = nil; + hosts[session.host].sessions[session.username].sessions[resource] = nil; + session.full_jid = nil; + session.resource = nil; + if next(bare_sessions[session.username..'@'..session.host]) == nil then + bare_sessions[session.username..'@'..session.host] = nil; + hosts[session.host].sessions[session.username] = nil; + end + return nil, "cancel", "internal-server-error", "Error loading roster"; + end hosts[session.host].events.fire_event("resource-bind", {session=session});