Comparison

core/s2smanager.lua @ 931:4514ed5ee943

Fixed: s2smanager: Apply nameprep on hostnames passed in stream tag (part of issue #57)
author Waqas Hussain <waqas20@gmail.com>
date Mon, 30 Mar 2009 03:06:01 +0500
parent 896:2c0b9e3c11c3
child 938:663f75dd7b42
comparison
equal deleted inserted replaced
930:fed53329818d 931:4514ed5ee943
22 local connlisteners_get = require "net.connlisteners".get; 22 local connlisteners_get = require "net.connlisteners".get;
23 local wrapclient = require "net.server".wrapclient; 23 local wrapclient = require "net.server".wrapclient;
24 local modulemanager = require "core.modulemanager"; 24 local modulemanager = require "core.modulemanager";
25 local st = require "stanza"; 25 local st = require "stanza";
26 local stanza = st.stanza; 26 local stanza = st.stanza;
27 local nameprep = require "util.encodings".stringprep.nameprep;
27 28
28 local uuid_gen = require "util.uuid".generate; 29 local uuid_gen = require "util.uuid".generate;
29 30
30 local logger_init = require "util.logger".init; 31 local logger_init = require "util.logger".init;
31 32
209 log("warn", (session.to_host or "(unknown)").." failed to specify 'to' or 'from' hostname as per RFC"); 210 log("warn", (session.to_host or "(unknown)").." failed to specify 'to' or 'from' hostname as per RFC");
210 end 211 end
211 212
212 if session.direction == "incoming" then 213 if session.direction == "incoming" then
213 -- Send a reply stream header 214 -- Send a reply stream header
214 session.to_host = attr.to; 215 session.to_host = nameprep(attr.to);
215 session.from_host = attr.from; 216 session.from_host = nameprep(attr.from);
216 217
217 session.streamid = uuid_gen(); 218 session.streamid = uuid_gen();
218 (session.log or log)("debug", "incoming s2s received <stream:stream>"); 219 (session.log or log)("debug", "incoming s2s received <stream:stream>");
219 send("<?xml version='1.0'?>"); 220 send("<?xml version='1.0'?>");
220 send(stanza("stream:stream", { xmlns='jabber:server', ["xmlns:db"]='jabber:server:dialback', 221 send(stanza("stream:stream", { xmlns='jabber:server', ["xmlns:db"]='jabber:server:dialback',