# HG changeset patch # User Waqas Hussain # Date 1274489544 -18000 # Node ID a233aa0511253c5a33776c17aef24e8a23162834 # Parent 9b31e36528e080205befe20a1c71cb82a95f1220 sessionmanager: If roster loading fails during resource bind, kick the user with an internal-server-error. diff -r 9b31e36528e0 -r a233aa051125 core/sessionmanager.lua --- 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});