mod_firewall: Don't add empty conditions check when no conditions are listed in a rule
--- 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