Comparison

plugins/mod_proxy65.lua @ 4921:9a01c6bc435e

mod_proxy65: Fix ACL
author Kim Alvefur <zash@zash.se>
date Tue, 29 May 2012 17:20:02 +0200
parent 4917:d1dca1d12d53
child 5336:eeb24f1e2c84
comparison
equal deleted inserted replaced
4920:e27adbf4e743 4921:9a01c6bc435e
122 local origin, stanza = event.origin, event.stanza; 122 local origin, stanza = event.origin, event.stanza;
123 123
124 -- check ACL 124 -- check ACL
125 while proxy_acl and #proxy_acl > 0 do -- using 'while' instead of 'if' so we can break out of it 125 while proxy_acl and #proxy_acl > 0 do -- using 'while' instead of 'if' so we can break out of it
126 local jid = stanza.attr.from; 126 local jid = stanza.attr.from;
127 local allow;
127 for _, acl in ipairs(proxy_acl) do 128 for _, acl in ipairs(proxy_acl) do
128 if jid_compare(jid, acl) then break; end 129 if jid_compare(jid, acl) then allow = true; break; end
129 end 130 end
131 if allow then break; end
130 module:log("warn", "Denying use of proxy for %s", tostring(stanza.attr.from)); 132 module:log("warn", "Denying use of proxy for %s", tostring(stanza.attr.from));
131 origin.send(st.error_reply(stanza, "auth", "forbidden")); 133 origin.send(st.error_reply(stanza, "auth", "forbidden"));
132 return true; 134 return true;
133 end 135 end
134 136