diff options
author | Waqas Hussain <waqas20@gmail.com> | 2010-05-22 05:52:24 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2010-05-22 05:52:24 +0500 |
commit | f77c1fc2d0378297e4d31ff2f7420515291d9988 (patch) | |
tree | 41b1577be2235e97a4563ed8735d1f1965bdbd53 /core | |
parent | 2bf0d50232994a42e4a250b124fbbba01dfef57a (diff) | |
download | prosody-f77c1fc2d0378297e4d31ff2f7420515291d9988.tar.gz prosody-f77c1fc2d0378297e4d31ff2f7420515291d9988.zip |
sessionmanager: If roster loading fails during resource bind, kick the user with an internal-server-error.
Diffstat (limited to 'core')
-rw-r--r-- | core/sessionmanager.lua | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua index 6e771a84..3537d2d2 100644 --- a/core/sessionmanager.lua +++ b/core/sessionmanager.lua @@ -174,7 +174,19 @@ function bind_resource(session, resource) 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}); |