Diff

mod_firewall/mod_firewall.lua @ 2525:a35d85cfda92

mod_firewall: Fix for deps dynamically including deps
author Matthew Wild <mwild1@gmail.com>
date Mon, 20 Feb 2017 09:29:09 +0000
parent 2524:0404476ecfe3
child 2526:b2fc41001c8e
line wrap: on
line diff
--- a/mod_firewall/mod_firewall.lua	Mon Feb 20 09:28:35 2017 +0000
+++ b/mod_firewall/mod_firewall.lua	Mon Feb 20 09:29:09 2017 +0000
@@ -220,14 +220,26 @@
 	end
 	if dep_info.global_code then
 		if dep_param ~= "" then
-			table.insert(code.global_header, dep_info.global_code(dep_param));
+			local global_code, deps = dep_info.global_code(dep_param);
+			if deps then
+				for _, dep in ipairs(deps) do
+					include_dep(dep, code);
+				end
+			end
+			table.insert(code.global_header, global_code);
 		else
 			table.insert(code.global_header, dep_info.global_code);
 		end
 	end
 	if dep_info.local_code then
 		if dep_param ~= "" then
-			table.insert(code, "\n\t\t-- "..dep.."\n\t\t"..dep_info.local_code(dep_param).."\n");
+			local local_code, deps = dep_info.local_code(dep_param);
+			if deps then
+				for _, dep in ipairs(deps) do
+					include_dep(dep, code);
+				end
+			end
+			table.insert(code, "\n\t\t-- "..dep.."\n\t\t"..local_code.."\n");
 		else
 			table.insert(code, "\n\t\t-- "..dep.."\n\t\t"..dep_info.local_code.."\n");
 		end