Comparison

core/sessionmanager.lua @ 930:fed53329818d

Fixed: sessionmanager: Apply nameprep on hostname passed in stream tag (part of issue #57)
author Waqas Hussain <waqas20@gmail.com>
date Mon, 30 Mar 2009 03:03:06 +0500
parent 896:2c0b9e3c11c3
child 950:a00b4269de70
comparison
equal deleted inserted replaced
929:b4f2ca7f6f00 930:fed53329818d
21 local log = require "util.logger".init("sessionmanager"); 21 local log = require "util.logger".init("sessionmanager");
22 local error = error; 22 local error = error;
23 local uuid_generate = require "util.uuid".generate; 23 local uuid_generate = require "util.uuid".generate;
24 local rm_load_roster = require "core.rostermanager".load_roster; 24 local rm_load_roster = require "core.rostermanager".load_roster;
25 local config_get = require "core.configmanager".get; 25 local config_get = require "core.configmanager".get;
26 local nameprep = require "util.encodings".stringprep.nameprep;
26 27
27 local fire_event = require "core.eventmanager".fire_event; 28 local fire_event = require "core.eventmanager".fire_event;
28 29
29 local gettime = require "socket".gettime; 30 local gettime = require "socket".gettime;
30 31
154 end 155 end
155 156
156 function streamopened(session, attr) 157 function streamopened(session, attr)
157 local send = session.send; 158 local send = session.send;
158 session.host = attr.to or error("Client failed to specify destination hostname"); 159 session.host = attr.to or error("Client failed to specify destination hostname");
160 session.host = nameprep(session.host);
159 session.version = tonumber(attr.version) or 0; 161 session.version = tonumber(attr.version) or 0;
160 session.streamid = m_random(1000000, 99999999); 162 session.streamid = m_random(1000000, 99999999);
161 (session.log or session)("debug", "Client sent opening <stream:stream> to %s", session.host); 163 (session.log or session)("debug", "Client sent opening <stream:stream> to %s", session.host);
162 164
163 165