changeset 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 d637bc0ac604
files mod_firewall/mod_firewall.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
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