diff mod_firewall/definitions.lib.lua @ 2528:44a71584521d

mod_firewall: Add SEARCH, PATTERN definitions and SCAN condition to check tokenized stanza:find() against a list
author Matthew Wild <mwild1@gmail.com>
date Mon, 20 Feb 2017 09:31:30 +0000
parents a3a18d09ae8a
children 84e103fd8039
line wrap: on
line diff
--- a/mod_firewall/definitions.lib.lua	Mon Feb 20 09:29:38 2017 +0000
+++ b/mod_firewall/definitions.lib.lua	Mon Feb 20 09:31:30 2017 +0000
@@ -170,4 +170,16 @@
 	return create_list(list_backend, list_definition:match("^%S+"), opts);
 end
 
+function definition_handlers.PATTERN(name, pattern)
+	local ok, err = pcall(string.match, "", pattern);
+	if not ok then
+		error("Invalid pattern '"..name.."': "..err);
+	end
+	return pattern;
+end
+
+function definition_handlers.SEARCH(name, pattern)
+	return pattern;
+end
+
 return definition_handlers;