comparison mod_firewall/actions.lib.lua @ 2531:9d2bfff515b8

mod_firewall: Add 'ADD TO' action for adding to lists
author Matthew Wild <mwild1@gmail.com>
date Mon, 20 Feb 2017 09:47:58 +0000
parents d4bc434a60a4
children 76f03d514b13
comparison
equal deleted inserted replaced
2530:84e103fd8039 2531:9d2bfff515b8
185 185
186 function action_handlers.UNMARK_ORIGIN(name) 186 function action_handlers.UNMARK_ORIGIN(name)
187 return [[session.firewall_marked_]]..idsafe(name)..[[ = nil;]] 187 return [[session.firewall_marked_]]..idsafe(name)..[[ = nil;]]
188 end 188 end
189 189
190 function action_handlers.ADD_TO(spec)
191 local list_name, value = spec:match("(%S+) (.+)");
192 local meta_deps = {};
193 value = meta(("%q"):format(value), meta_deps);
194 return ("list_%s:add(%s);"):format(list_name, value), { "list:"..list_name, unpack(meta_deps) };
195 end
196
190 return action_handlers; 197 return action_handlers;