# HG changeset patch # User Matthew Wild # Date 1479221860 0 # Node ID c065ab67d8075ee9584a902115288a117d47af21 # Parent 231d47e61c813191e3015be32452464e05a34a4f mod_firewall: INSPECT: Emit compilation error when the given stanza path is used for comparison but doesn't return a string diff -r 231d47e61c81 -r c065ab67d807 mod_firewall/conditions.lib.lua --- a/mod_firewall/conditions.lib.lua Tue Nov 15 09:01:03 2016 +0100 +++ b/mod_firewall/conditions.lib.lua Tue Nov 15 14:57:40 2016 +0000 @@ -112,6 +112,9 @@ function condition_handlers.INSPECT(path) if path:find("=") then local query, is_pattern_match, value = path:match("(.-)(~?)=(.*)"); + if not(query:match("#$") or query:match("@[^/]+")) then + error("Stanza path does not return a string (append # for text content or @name for value of named attribute)", 0); + end if is_pattern_match ~= "" then return ("stanza:find(%q):match(%q)"):format(path:match("(.-)~=(.*)")); else