Software /
code /
prosody
Comparison
core/s2smanager.lua @ 3383:c7acddf80583
s2smanager: Handle disallow_s2s for incoming streams as well as outgoing
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 16 Jul 2010 22:47:26 +0100 |
parent | 3329:9adafeeadecb |
child | 3431:c499f4752cd8 |
comparison
equal
deleted
inserted
replaced
3382:fea0f8e19e4c | 3383:c7acddf80583 |
---|---|
388 session.to_host = attr.to and nameprep(attr.to); | 388 session.to_host = attr.to and nameprep(attr.to); |
389 session.from_host = attr.from and nameprep(attr.from); | 389 session.from_host = attr.from and nameprep(attr.from); |
390 | 390 |
391 session.streamid = uuid_gen(); | 391 session.streamid = uuid_gen(); |
392 (session.log or log)("debug", "incoming s2s received <stream:stream>"); | 392 (session.log or log)("debug", "incoming s2s received <stream:stream>"); |
393 if session.to_host and not hosts[session.to_host] then | 393 if session.to_host then |
394 -- Attempting to connect to a host we don't serve | 394 if not hosts[session.to_host] then |
395 session:close({ condition = "host-unknown"; text = "This host does not serve "..session.to_host }); | 395 -- Attempting to connect to a host we don't serve |
396 return; | 396 session:close({ |
397 condition = "host-unknown"; | |
398 text = "This host does not serve "..session.to_host | |
399 }); | |
400 return; | |
401 elseif hosts[session.to_host].disallow_s2s then | |
402 -- Attempting to connect to a host that disallows s2s | |
403 session:close({ | |
404 condition = "policy-violation"; | |
405 text = "Server-to-server communication is not allowed to this host"; | |
406 }); | |
407 return; | |
408 end | |
397 end | 409 end |
398 send("<?xml version='1.0'?>"); | 410 send("<?xml version='1.0'?>"); |
399 send(stanza("stream:stream", { xmlns='jabber:server', ["xmlns:db"]='jabber:server:dialback', | 411 send(stanza("stream:stream", { xmlns='jabber:server', ["xmlns:db"]='jabber:server:dialback', |
400 ["xmlns:stream"]='http://etherx.jabber.org/streams', id=session.streamid, from=session.to_host, to=session.from_host, version=(session.version > 0 and "1.0" or nil) }):top_tag()); | 412 ["xmlns:stream"]='http://etherx.jabber.org/streams', id=session.streamid, from=session.to_host, to=session.from_host, version=(session.version > 0 and "1.0" or nil) }):top_tag()); |
401 if session.version >= 1.0 then | 413 if session.version >= 1.0 then |