Software /
code /
prosody
Changeset
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 |
parents | 4820:c65edd3bb334 |
children | 4822:5ef05f32bc42 4823:a61e78b4a2b3 4835:751510cd558d |
files | plugins/mod_auth_anonymous.lua |
diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
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