# HG changeset patch # User Matthew Wild # Date 1458214639 0 # Node ID 9db4113d0cb5d1e4f67e71f466266cf8794b8fec # Parent 573fe9825fba968712ae648205564efad9b865f0 mod_firewall: INSPECT: Support for pattern matches (confusingly using ~= instead of =) diff -r 573fe9825fba -r 9db4113d0cb5 mod_firewall/conditions.lib.lua --- a/mod_firewall/conditions.lib.lua Thu Mar 17 11:33:57 2016 +0000 +++ b/mod_firewall/conditions.lib.lua Thu Mar 17 11:37:19 2016 +0000 @@ -95,7 +95,12 @@ function condition_handlers.INSPECT(path) if path:find("=") then - return ("stanza:find(%q) == %q"):format(path:match("(.-)=(.*)")); + local query, is_pattern_match, value = path:match("(.-)(~?)=(.*)"); + if is_pattern_match ~= "" then + return ("stanza:find(%q):match(%q)"):format(path:match("(.-)~=(.*)")); + else + return ("stanza:find(%q) == %q"):format(path:match("(.-)=(.*)")); + end end return ("stanza:find(%q)"):format(path); end