diff options
author | Matthew Wild <mwild1@gmail.com> | 2010-03-03 22:05:05 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2010-03-03 22:05:05 +0000 |
commit | 8862e1b27eb767c99a068d13bd15c77c2c9e1471 (patch) | |
tree | 067f338a5f8e31a6b1fb6ca706562a044af80024 /core/sessionmanager.lua | |
parent | 87ff54c75266ffa37f716d1c7a542e956bbe54b3 (diff) | |
parent | 5d9b9b6b30f06a3e3aa957279357dd42ae19ddf4 (diff) | |
download | prosody-8862e1b27eb767c99a068d13bd15c77c2c9e1471.tar.gz prosody-8862e1b27eb767c99a068d13bd15c77c2c9e1471.zip |
Merge 0.6.2/waqas with 0.6.2/MattJ
Diffstat (limited to 'core/sessionmanager.lua')
-rw-r--r-- | core/sessionmanager.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua index 5e7fe06d..2dd0070b 100644 --- a/core/sessionmanager.lua +++ b/core/sessionmanager.lua @@ -10,7 +10,6 @@ local tonumber, tostring = tonumber, tostring; local ipairs, pairs, print, next= ipairs, pairs, print, next; -local collectgarbage = collectgarbage; local format = import("string", "format"); local hosts = hosts; @@ -25,6 +24,7 @@ local uuid_generate = require "util.uuid".generate; local rm_load_roster = require "core.rostermanager".load_roster; local config_get = require "core.configmanager".get; local nameprep = require "util.encodings".stringprep.nameprep; +local resourceprep = require "util.encodings".stringprep.resourceprep; local fire_event = require "core.eventmanager".fire_event; local add_task = require "util.timer".add_task; @@ -66,6 +66,8 @@ function new_session(conn) return session; end +local function null_data_handler(conn, data) log("debug", "Discarding data from destroyed c2s session: %s", data); end + function destroy_session(session, err) (session.log or log)("info", "Destroying session for %s (%s@%s)", session.full_jid or "(unknown)", session.username or "(unknown)", session.host or "(unknown)"); @@ -88,6 +90,7 @@ function destroy_session(session, err) session[k] = nil; end end + session.data = null_data_handler; end function make_authenticated(session, username) @@ -106,7 +109,8 @@ function bind_resource(session, resource) if session.resource then return nil, "cancel", "already-bound", "Cannot bind multiple resources on a single connection"; end -- We don't support binding multiple resources - resource = resource or uuid_generate(); + resource = resourceprep(resource); + resource = resource ~= "" and resource or uuid_generate(); --FIXME: Randomly-generated resources must be unique per-user, and never conflict with existing if not hosts[session.host].sessions[session.username] then |