Mercurial > prosody-modules
changeset 2385:c0c2f8665c3e
mod_firewall: Fix for raw code expressions that contain escape-worthy characters
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 19 Nov 2016 15:47:41 +0000 (2016-11-19) |
parents | feba6439b6fb |
children | 00eed68f63bf |
files | mod_firewall/mod_firewall.lua |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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("||([^|]+)$");