# HG changeset patch # User Kim Alvefur # Date 1365100281 -7200 # Node ID bec5b6e2eab8ff2f30641f4176275b76b64edfde # Parent 2c38d7d8b332bc123cf4f0e6b9fba5d7e4e5e7b6 mod_firewall: Add INSPECT conditional, for deeper inspection of stanzas diff -r 2c38d7d8b332 -r bec5b6e2eab8 mod_firewall/conditions.lib.lua --- a/mod_firewall/conditions.lib.lua Wed Apr 03 20:29:48 2013 +0200 +++ b/mod_firewall/conditions.lib.lua Thu Apr 04 20:31:21 2013 +0200 @@ -75,6 +75,14 @@ return ("stanza:get_child(nil, %q)"):format(payload_ns); end +function condition_handlers.INSPECT(path) + if path:find("=") then + local path, match = path:match("(.-)=(.*)"); + return ("stanza:find(%q) == %q"):format(path, match); + end + return ("stanza:find(%q)"):format(path); +end + function condition_handlers.FROM_GROUP(group_name) return ("group_contains(%q, bare_from)"):format(group_name), { "group_contains", "bare_from" }; end