Changeset

967:a88f33fe6970

mod_firewall: Don't add empty conditions check when no conditions are listed in a rule
author Matthew Wild <mwild1@gmail.com>
date Sat, 06 Apr 2013 14:03:02 +0100
parents 966:a65df6e97d94
children 968:f3b0ddeebd9d
files mod_firewall/mod_firewall.lua
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mod_firewall/mod_firewall.lua	Sat Apr 06 14:02:38 2013 +0100
+++ b/mod_firewall/mod_firewall.lua	Sat Apr 06 14:03:02 2013 +0100
@@ -256,9 +256,12 @@
 			for _, dep in ipairs(rule.deps) do
 				include_dep(dep, code);
 			end
-			local rule_code = "if ("..table.concat(rule.conditions, ") and (")..") then\n\t"
-			..table.concat(rule.actions, "\n\t")
-			.."\n end\n";
+			local rule_code = table.concat(rule.actions, "\n\t");
+			if #rule.conditions > 0 then
+				rule_code = "if ("..table.concat(rule.conditions, ") and (")..") then\n\t"
+				..rule_code
+				.."\n end\n";
+			end
 			table.insert(code, rule_code);
 		end