# HG changeset patch # User Matthew Wild # Date 1336094890 -3600 # Node ID deec69fc33e58e501c69bc96eaa91cfd7c090415 # Parent c65edd3bb334cceae53b3858d0a3733241069053 mod_auth_anonymous: Block s2s when enabled on a host (and disallow_s2s ~= false) diff -r c65edd3bb334 -r deec69fc33e5 plugins/mod_auth_anonymous.lua --- 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