aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_proxy65.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2021-05-13 11:17:13 +0100
committerMatthew Wild <mwild1@gmail.com>2021-05-13 11:17:13 +0100
commit5bc8b2a379e21901429e4d7f5e10e424ca85e403 (patch)
treedc46f3423a4319e09fe85402fa76f15568ad89d1 /plugins/mod_proxy65.lua
parent37ad3b8fb2039684273b3cb63b5b573e879b04d7 (diff)
parenta95576d485eda2a273b4d66c4c2b363f88c5c43a (diff)
downloadprosody-5bc8b2a379e21901429e4d7f5e10e424ca85e403.tar.gz
prosody-5bc8b2a379e21901429e4d7f5e10e424ca85e403.zip
Merge 0.11->trunk
Diffstat (limited to 'plugins/mod_proxy65.lua')
-rw-r--r--plugins/mod_proxy65.lua16
1 files changed, 12 insertions, 4 deletions
diff --git a/plugins/mod_proxy65.lua b/plugins/mod_proxy65.lua
index bac36b55..069ce0a9 100644
--- a/plugins/mod_proxy65.lua
+++ b/plugins/mod_proxy65.lua
@@ -93,6 +93,7 @@ function module.add_host(module)
local proxy_address = module:get_option_string("proxy65_address", host);
local proxy_acl = module:get_option_array("proxy65_acl");
+ local proxy_open_access = module:get_option_boolean("proxy65_open_access", false);
-- COMPAT w/pre-0.9 where proxy65_port was specified in the components section of the config
local legacy_config = module:get_option_number("proxy65_port");
@@ -109,13 +110,20 @@ function module.add_host(module)
-- check ACL
-- using 'while' instead of 'if' so we can break out of it
- while proxy_acl and #proxy_acl > 0 do --luacheck: ignore 512
+ local allow;
+ if proxy_acl and #proxy_acl > 0 then
local jid = stanza.attr.from;
- local allow;
for _, acl in ipairs(proxy_acl) do
- if jid_compare(jid, acl) then allow = true; break; end
+ if jid_compare(jid, acl) then
+ allow = true;
+ break;
+ end
end
- if allow then break; end
+ elseif proxy_open_access or origin.type == "c2s" then
+ allow = true;
+ end
+
+ if not allow then
module:log("warn", "Denying use of proxy for %s", stanza.attr.from);
origin.send(st.error_reply(stanza, "auth", "forbidden"));
return true;