Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
4820:c65edd3bb334 | 4821:deec69fc33e5 |
---|---|
48 if host == module.host then | 48 if host == module.host then |
49 return false; | 49 return false; |
50 end | 50 end |
51 return username, host, datastore, data; | 51 return username, host, datastore, data; |
52 end | 52 end |
53 local host = hosts[module.host]; | 53 |
54 local _saved_disallow_s2s = host.disallow_s2s; | 54 if module:get_option_boolean("disallow_s2s", true) then |
55 module:hook("route/remote", function (event) | |
56 return false; -- Block outgoing s2s from anonymous users | |
57 end, 300); | |
58 end | |
59 | |
55 function module.load() | 60 function module.load() |
56 _saved_disallow_s2s = host.disallow_s2s; | |
57 host.disallow_s2s = module:get_option("disallow_s2s") ~= false; | |
58 datamanager.add_callback(dm_callback); | 61 datamanager.add_callback(dm_callback); |
59 end | 62 end |
60 function module.unload() | 63 function module.unload() |
61 host.disallow_s2s = _saved_disallow_s2s; | |
62 datamanager.remove_callback(dm_callback); | 64 datamanager.remove_callback(dm_callback); |
63 end | 65 end |
64 | 66 |
65 module:add_item("auth-provider", new_default_provider(module.host)); | 67 module:add_item("auth-provider", new_default_provider(module.host)); |
66 | 68 |