Comparison

mod_firewall/actions.lib.lua @ 2415:07d7036040ee

mod_firewall: Insert semicolons after some statements to prevent ambiguous syntax in output (fixes #797)
author Kim Alvefur <zash@zash.se>
date Tue, 13 Dec 2016 16:57:16 +0100
parent 2129:26334f4a8eb9
child 2519:d4bc434a60a4
comparison
equal deleted inserted replaced
2414:97b4229982f5 2415:07d7036040ee
112 112
113 113
114 local function route_modify(make_new, to, drop) 114 local function route_modify(make_new, to, drop)
115 local reroute, deps = "session.send(newstanza)", { "st" }; 115 local reroute, deps = "session.send(newstanza)", { "st" };
116 if to then 116 if to then
117 reroute = ("newstanza.attr.to = %q; core_post_stanza(session, newstanza)"):format(to); 117 reroute = ("newstanza.attr.to = %q; core_post_stanza(session, newstanza);"):format(to);
118 deps[#deps+1] = "core_post_stanza"; 118 deps[#deps+1] = "core_post_stanza";
119 end 119 end
120 return ([[local newstanza = st.%s; %s;%s]]) 120 return ([[local newstanza = st.%s; %s;%s]])
121 :format(make_new, reroute, drop and " return true;" or ""), deps; 121 :format(make_new, reroute, drop and " return true;" or ""), deps;
122 end 122 end
156 end 156 end
157 157
158 function action_handlers.LOG(string) 158 function action_handlers.LOG(string)
159 local level = string:match("^%[(%a+)%]") or "info"; 159 local level = string:match("^%[(%a+)%]") or "info";
160 string = string:gsub("^%[%a+%] ?", ""); 160 string = string:gsub("^%[%a+%] ?", "");
161 return meta(("(session.log or log)(%q, %q)"):format(level, string)); 161 return meta(("(session.log or log)(%q, %q);"):format(level, string));
162 end 162 end
163 163
164 function action_handlers.RULEDEP(dep) 164 function action_handlers.RULEDEP(dep)
165 return "", { dep }; 165 return "", { dep };
166 end 166 end