diff mod_firewall/mod_firewall.lua @ 2539:1510b66a43fc

mod_firewall: Allow using spaces instead of underscores in actions, as well as conditions
author Matthew Wild <mwild1@gmail.com>
date Tue, 21 Feb 2017 10:38:14 +0000
parents a1b6a6b0aabb
children 3c16f0a8d66c
line wrap: on
line diff
--- a/mod_firewall/mod_firewall.lua	Tue Feb 21 10:37:53 2017 +0000
+++ b/mod_firewall/mod_firewall.lua	Tue Feb 21 10:38:14 2017 +0000
@@ -366,7 +366,7 @@
 				active_definitions[what] = {};
 			end
 			active_definitions[what][name] = ret;
-		elseif line:find("^[^%s:]+[%.=]") then
+		elseif line:find("^[%w_ ]+[%.=]") then
 			-- Action
 			if state == nil then
 				-- This is a standalone action with no conditions
@@ -374,7 +374,7 @@
 			end
 			state = "actions";
 			-- Action handlers?
-			local action = line:match("^[%w_]+");
+			local action = line:match("^[%w_ ]+"):upper():gsub(" ", "_");
 			if not action_handlers[action] then
 				return nil, ("Unknown action on line %d: %s"):format(line_no, action or "<unknown>");
 			end