aboutsummaryrefslogtreecommitdiffstats
path: root/core/s2smanager.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-07-16 22:47:26 +0100
committerMatthew Wild <mwild1@gmail.com>2010-07-16 22:47:26 +0100
commite2772919dd1b2f0f0396f1f5437629ec81c0c4e8 (patch)
tree6070a36a9a77f2170c1a4ca8233d0a578d9b048e /core/s2smanager.lua
parentb0c03f83ced2271d0939cdd57324db469d75e31a (diff)
downloadprosody-e2772919dd1b2f0f0396f1f5437629ec81c0c4e8.tar.gz
prosody-e2772919dd1b2f0f0396f1f5437629ec81c0c4e8.zip
s2smanager: Handle disallow_s2s for incoming streams as well as outgoing
Diffstat (limited to 'core/s2smanager.lua')
-rw-r--r--core/s2smanager.lua20
1 files changed, 16 insertions, 4 deletions
diff --git a/core/s2smanager.lua b/core/s2smanager.lua
index f3cde4b7..e5fb699b 100644
--- a/core/s2smanager.lua
+++ b/core/s2smanager.lua
@@ -390,10 +390,22 @@ function streamopened(session, attr)
session.streamid = uuid_gen();
(session.log or log)("debug", "incoming s2s received <stream:stream>");
- if session.to_host and not hosts[session.to_host] then
- -- Attempting to connect to a host we don't serve
- session:close({ condition = "host-unknown"; text = "This host does not serve "..session.to_host });
- return;
+ if session.to_host then
+ if not hosts[session.to_host] then
+ -- Attempting to connect to a host we don't serve
+ session:close({
+ condition = "host-unknown";
+ text = "This host does not serve "..session.to_host
+ });
+ return;
+ elseif hosts[session.to_host].disallow_s2s then
+ -- Attempting to connect to a host that disallows s2s
+ session:close({
+ condition = "policy-violation";
+ text = "Server-to-server communication is not allowed to this host";
+ });
+ return;
+ end
end
send("<?xml version='1.0'?>");
send(stanza("stream:stream", { xmlns='jabber:server', ["xmlns:db"]='jabber:server:dialback',