Changeset

4834:878f75ccc4fb

mod_s2s, mod_auth_anonymous, hostmanager: Remove disallow_s2s flag, deprecate the config option of the same name (disable mod_s2s instead), and add 'allow_anonymous_s2s' to separately control s2s for anonymous users
author Matthew Wild <mwild1@gmail.com>
date Fri, 11 May 2012 00:56:18 +0100
parents 4833:b7a6e86ab87d
children 4846:3bc3498df0a0
files core/hostmanager.lua plugins/mod_auth_anonymous.lua plugins/mod_s2s/mod_s2s.lua
diffstat 3 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/core/hostmanager.lua	Thu May 10 23:10:56 2012 +0100
+++ b/core/hostmanager.lua	Fri May 11 00:56:18 2012 +0100
@@ -74,7 +74,6 @@
 		s2sout = {};
 		events = events_new();
 		dialback_secret = configmanager.get(host, "core", "dialback_secret") or uuid_gen();
-		disallow_s2s = configmanager.get(host, "core", "disallow_s2s");
 		send = host_send;
 	};
 	if not host_config.core.component_module then -- host
--- a/plugins/mod_auth_anonymous.lua	Thu May 10 23:10:56 2012 +0100
+++ b/plugins/mod_auth_anonymous.lua	Fri May 11 00:56:18 2012 +0100
@@ -51,7 +51,7 @@
 	return username, host, datastore, data;
 end
 
-if module:get_option_boolean("disallow_s2s", true) then
+if not module:get_option_boolean("allow_anonymous_s2s", false) then
 	module:hook("route/remote", function (event)
 		return false; -- Block outgoing s2s from anonymous users
 	end, 300);
--- a/plugins/mod_s2s/mod_s2s.lua	Thu May 10 23:10:56 2012 +0100
+++ b/plugins/mod_s2s/mod_s2s.lua	Fri May 11 00:56:18 2012 +0100
@@ -125,6 +125,7 @@
 
 function module.add_host(module)
 	if module:get_option_boolean("disallow_s2s", false) then
+		module:log("warn", "The 'disallow_s2s' config option is deprecated, please see http://prosody.im/doc/s2s#disabling");
 		return nil, "This host has disallow_s2s set";
 	end
 	module:hook("route/remote", route_to_existing_session, 200);
@@ -226,11 +227,11 @@
 					text = "This host does not serve "..to
 				});
 				return;
-			elseif hosts[to].disallow_s2s then
+			elseif not hosts[to].modules.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";
+					text = "Server-to-server communication is disabled for this host";
 				});
 				return;
 			end