# HG changeset patch # User Matthew Wild # Date 1479570461 0 # Node ID c0c2f8665c3ef44016491a987f51c74376a2863b # Parent feba6439b6fbcc6e3210283b907d563030f57e20 mod_firewall: Fix for raw code expressions that contain escape-worthy characters diff -r feba6439b6fb -r c0c2f8665c3e mod_firewall/mod_firewall.lua --- a/mod_firewall/mod_firewall.lua Sat Nov 19 19:40:29 2016 +0100 +++ b/mod_firewall/mod_firewall.lua Sat Nov 19 15:47:41 2016 +0000 @@ -49,7 +49,10 @@ -- Run quoted (%q) strings through this to allow them to contain code. e.g.: LOG=Received: $(stanza:top_tag()) function meta(s, extra) - return (s:gsub("$(%b())", [["..tostring(%1).."]]) + return (s:gsub("$(%b())", function (expr) + expr = expr:gsub("\\(.)", "%1"); + return [["..tostring(]]..expr..[[).."]]; + end) :gsub("$(%b<>)", function (expr) expr = expr:sub(2,-2); local default = expr:match("||([^|]+)$");