Diff

plugins/mod_auth_anonymous.lua @ 4821:deec69fc33e5

mod_auth_anonymous: Block s2s when enabled on a host (and disallow_s2s ~= false)
author Matthew Wild <mwild1@gmail.com>
date Fri, 04 May 2012 02:28:10 +0100
parent 4765:21eb0b86c904
child 4834:878f75ccc4fb
child 4838:661752889535
line wrap: on
line diff
--- a/plugins/mod_auth_anonymous.lua	Fri May 04 02:27:26 2012 +0100
+++ b/plugins/mod_auth_anonymous.lua	Fri May 04 02:28:10 2012 +0100
@@ -50,15 +50,17 @@
 	end
 	return username, host, datastore, data;
 end
-local host = hosts[module.host];
-local _saved_disallow_s2s = host.disallow_s2s;
+
+if module:get_option_boolean("disallow_s2s", true) then
+	module:hook("route/remote", function (event)
+		return false; -- Block outgoing s2s from anonymous users
+	end, 300);
+end
+
 function module.load()
-	_saved_disallow_s2s = host.disallow_s2s;
-	host.disallow_s2s = module:get_option("disallow_s2s") ~= false;
 	datamanager.add_callback(dm_callback);
 end
 function module.unload()
-	host.disallow_s2s = _saved_disallow_s2s;
 	datamanager.remove_callback(dm_callback);
 end