Comparison

mod_firewall/mod_firewall.lua @ 2573:24dbad147aef

mod_firewall: Fix meta functions with to/from that weren't JID-based
author Matthew Wild <mwild1@gmail.com>
date Sat, 25 Feb 2017 15:46:01 +0000
parent 2562:78efd064aef3
child 2574:f65c5927ee8e
comparison
equal deleted inserted replaced
2572:f20dd383093a 2573:24dbad147aef
95 else 95 else
96 code = ("stanza:find(%q)"):format(expr); 96 code = ("stanza:find(%q)"):format(expr);
97 end 97 end
98 if func_chain then 98 if func_chain then
99 for func_name in func_chain:gmatch("|(%w+)") do 99 for func_name in func_chain:gmatch("|(%w+)") do
100 if code == "to" or code == "from" then 100 -- to/from are already available in local variables, use those if possible
101 if func_name == "bare" then 101 if (code == "to" or code == "from") and func_name == "bare" then
102 code = "bare_"..code; 102 code = "bare_"..code;
103 table.insert(deps, code); 103 table.insert(deps, code);
104 elseif func_name == "node" or func_name == "host" or func_name == "resource" then 104 elseif (code == "to" or code == "from") and (func_name == "node" or func_name == "host" or func_name == "resource") then
105 table.insert(deps, "split_"..code); 105 table.insert(deps, "split_"..code);
106 code = code.."_"..func_name; 106 code = code.."_"..func_name;
107 end
108 else 107 else
109 assert(meta_funcs[func_name], "unknown function: "..func_name); 108 assert(meta_funcs[func_name], "unknown function: "..func_name);
110 local new_code, new_deps = meta_funcs[func_name](code); 109 local new_code, new_deps = meta_funcs[func_name](code);
111 code = new_code; 110 code = new_code;
112 if new_deps and #new_deps > 0 then 111 if new_deps and #new_deps > 0 then