Software /
code /
prosody
Changeset
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 |
parents | 3087:9b31e36528e0 |
children | 3089:69fb1cb6b551 |
files | core/sessionmanager.lua |
diffstat | 1 files changed, 13 insertions(+), 1 deletions(-) [+] |
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});