aboutsummaryrefslogtreecommitdiffstats
path: root/core
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
commit9dd8d35ae800ee5e9977a34dc14d5cae22d3bccb (patch)
tree08a03626b7c80f9efac7cf8602e8cec04223e7fb /core
parent52cfde2f6e1d568a2e6a9ba8ce61299f2ed6c2eb (diff)
downloadprosody-9dd8d35ae800ee5e9977a34dc14d5cae22d3bccb.tar.gz
prosody-9dd8d35ae800ee5e9977a34dc14d5cae22d3bccb.zip
sessionmanager: Added resource prepping, and invalid resource checking to the bind_resource function.
Diffstat (limited to 'core')
-rw-r--r--core/sessionmanager.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua
index 69160af7..8d520d12 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