mirror of
https://github.com/bjc/prosody.git
synced 2025-04-04 21:57:45 +03:00
mod_auth_anonymous: Block s2s when enabled on a host (and disallow_s2s ~= false)
This commit is contained in:
parent
8128ac8052
commit
bbd996911b
1 changed files with 7 additions and 5 deletions
|
@ -50,15 +50,17 @@ local function dm_callback(username, host, datastore, data)
|
|||
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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue