comparison mod_firewall/actions.lib.lua @ 2581:0116672348c4

mod_firewall: Fix syntax error in generated code with some route modification actions
author Matthew Wild <mwild1@gmail.com>
date Sat, 25 Feb 2017 18:36:21 +0000
parents fda47e2135e5
children 8fd37f0e108c
comparison
equal deleted inserted replaced
2580:aaff2716f022 2581:0116672348c4
120 120
121 121
122 local function route_modify(make_new, to, drop) 122 local function route_modify(make_new, to, drop)
123 local reroute, deps = "session.send(newstanza)", { "st" }; 123 local reroute, deps = "session.send(newstanza)", { "st" };
124 if to then 124 if to then
125 reroute = ("newstanza.attr.to = %q; core_post_stanza(session, newstanza);"):format(to); 125 reroute = ("newstanza.attr.to = %q; core_post_stanza(session, newstanza)"):format(to);
126 deps[#deps+1] = "core_post_stanza"; 126 deps[#deps+1] = "core_post_stanza";
127 end 127 end
128 return ([[local newstanza = st.%s; %s;%s]]) 128 return ([[do local newstanza = st.%s; %s;%s end]])
129 :format(make_new, reroute, drop and " do return true end" or ""), deps; 129 :format(make_new, reroute, drop and " return true" or ""), deps;
130 end 130 end
131 131
132 function action_handlers.BOUNCE(with) 132 function action_handlers.BOUNCE(with)
133 local error = with and with:match("^%S+") or "service-unavailable"; 133 local error = with and with:match("^%S+") or "service-unavailable";
134 local error_type = error:match(":(%S+)"); 134 local error_type = error:match(":(%S+)");