Mercurial > prosody-hg
comparison plugins/mod_s2s/mod_s2s.lua @ 4834:878f75ccc4fb
mod_s2s, mod_auth_anonymous, hostmanager: Remove disallow_s2s flag, deprecate the config option of the same name (disable mod_s2s instead), and add 'allow_anonymous_s2s' to separately control s2s for anonymous users
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 11 May 2012 00:56:18 +0100 |
| parents | 5ef05f32bc42 |
| children | ea44fad88715 |
comparison
equal
deleted
inserted
replaced
| 4833:b7a6e86ab87d | 4834:878f75ccc4fb |
|---|---|
| 123 return true; | 123 return true; |
| 124 end | 124 end |
| 125 | 125 |
| 126 function module.add_host(module) | 126 function module.add_host(module) |
| 127 if module:get_option_boolean("disallow_s2s", false) then | 127 if module:get_option_boolean("disallow_s2s", false) then |
| 128 module:log("warn", "The 'disallow_s2s' config option is deprecated, please see http://prosody.im/doc/s2s#disabling"); | |
| 128 return nil, "This host has disallow_s2s set"; | 129 return nil, "This host has disallow_s2s set"; |
| 129 end | 130 end |
| 130 module:hook("route/remote", route_to_existing_session, 200); | 131 module:hook("route/remote", route_to_existing_session, 200); |
| 131 module:hook("route/remote", route_to_new_session, 100); | 132 module:hook("route/remote", route_to_new_session, 100); |
| 132 end | 133 end |
| 224 session:close({ | 225 session:close({ |
| 225 condition = "host-unknown"; | 226 condition = "host-unknown"; |
| 226 text = "This host does not serve "..to | 227 text = "This host does not serve "..to |
| 227 }); | 228 }); |
| 228 return; | 229 return; |
| 229 elseif hosts[to].disallow_s2s then | 230 elseif not hosts[to].modules.s2s then |
| 230 -- Attempting to connect to a host that disallows s2s | 231 -- Attempting to connect to a host that disallows s2s |
| 231 session:close({ | 232 session:close({ |
| 232 condition = "policy-violation"; | 233 condition = "policy-violation"; |
| 233 text = "Server-to-server communication is not allowed to this host"; | 234 text = "Server-to-server communication is disabled for this host"; |
| 234 }); | 235 }); |
| 235 return; | 236 return; |
| 236 end | 237 end |
| 237 end | 238 end |
| 238 | 239 |
