Software /
code /
prosody
Comparison
plugins/mod_proxy65.lua @ 9643:bb8486491b48 0.10.3
mod_proxy65: Check what port is used at the time of the query
Could have changed between startup and time of request
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 25 Nov 2018 13:16:17 +0100 |
parent | 9642:e31053344231 |
child | 9645:cc642c9c5ad5 |
comparison
equal
deleted
inserted
replaced
9642:e31053344231 | 9643:bb8486491b48 |
---|---|
90 | 90 |
91 function module.add_host(module) | 91 function module.add_host(module) |
92 local host, name = module:get_host(), module:get_option_string("name", "SOCKS5 Bytestreams Service"); | 92 local host, name = module:get_host(), module:get_option_string("name", "SOCKS5 Bytestreams Service"); |
93 | 93 |
94 local proxy_address = module:get_option_string("proxy65_address", host); | 94 local proxy_address = module:get_option_string("proxy65_address", host); |
95 local proxy_port = next(portmanager.get_active_services():search("proxy65", nil)[1] or {}); | |
96 local proxy_acl = module:get_option_array("proxy65_acl"); | 95 local proxy_acl = module:get_option_array("proxy65_acl"); |
97 | 96 |
98 -- COMPAT w/pre-0.9 where proxy65_port was specified in the components section of the config | 97 -- COMPAT w/pre-0.9 where proxy65_port was specified in the components section of the config |
99 local legacy_config = module:get_option_number("proxy65_port"); | 98 local legacy_config = module:get_option_number("proxy65_port"); |
100 if legacy_config then | 99 if legacy_config then |
119 module:log("warn", "Denying use of proxy for %s", tostring(stanza.attr.from)); | 118 module:log("warn", "Denying use of proxy for %s", tostring(stanza.attr.from)); |
120 origin.send(st.error_reply(stanza, "auth", "forbidden")); | 119 origin.send(st.error_reply(stanza, "auth", "forbidden")); |
121 return true; | 120 return true; |
122 end | 121 end |
123 | 122 |
123 local proxy_port = next(portmanager.get_active_services():search("proxy65", nil)[1] or {}); | |
124 if not proxy_port then | 124 if not proxy_port then |
125 module:log("warn", "Not listening on any port"); | 125 module:log("warn", "Not listening on any port"); |
126 origin.send(st.error_reply(stanza, "wait", "item-not-found", "Not listening on any port")); | 126 origin.send(st.error_reply(stanza, "wait", "item-not-found", "Not listening on any port")); |
127 return true; | 127 return true; |
128 end | 128 end |