aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2010-01-11 18:59:06 +0500
committerWaqas Hussain <waqas20@gmail.com>2010-01-11 18:59:06 +0500
commit909e439525e41721abd91b227c7f9078aeda504b (patch)
tree9ef03469c267e5e2bdedbea69bb7e0b142d0b832
parent0e67359b5c5444db608af5d07821811e08c4f95f (diff)
downloadprosody-909e439525e41721abd91b227c7f9078aeda504b.tar.gz
prosody-909e439525e41721abd91b227c7f9078aeda504b.zip
sessionmanager: Added resource prepping, and invalid resource checking to the bind_resource function.
-rw-r--r--core/sessionmanager.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua
index 9aafe0bf..df144f07 100644
--- a/core/sessionmanager.lua
+++ b/core/sessionmanager.lua
@@ -24,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;
@@ -105,7 +106,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