Software /
code /
prosody
Changeset
2449:678ca4e9a479
sessionmanager: Added resource prepping, and invalid resource checking to the bind_resource function.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Mon, 11 Jan 2010 18:59:06 +0500 |
parents | 2448:542335c8a5bc |
children | 2450:03bb0e6d87d5 |
files | core/sessionmanager.lua |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/core/sessionmanager.lua Mon Jan 11 17:52:28 2010 +0500 +++ b/core/sessionmanager.lua Mon Jan 11 18:59:06 2010 +0500 @@ -24,6 +24,7 @@ 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 @@ 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