changeset 3981:7e8f2e36419d

mod_firewall: Use util.envload instead of deprecated loadstring (thanks Martin) loadstring was deprecated in Lua 5.2 and removed from in 5.3
author Kim Alvefur <zash@zash.se>
date Sun, 19 Apr 2020 23:37:13 +0200
parents 19c5bfc3a241
children ab065ff4628b
files mod_firewall/mod_firewall.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_firewall/mod_firewall.lua	Sun Apr 19 08:15:09 2020 +0200
+++ b/mod_firewall/mod_firewall.lua	Sun Apr 19 23:37:13 2020 +0200
@@ -1,6 +1,7 @@
 
 local lfs = require "lfs";
 local resolve_relative_path = require "core.configmanager".resolve_relative_path;
+local envload = require "util.envload".envload;
 local logger = require "util.logger".init;
 local it = require "util.iterators";
 local set = require "util.set";
@@ -543,7 +544,7 @@
 -- a value to be returned on PASS
 local function compile_handler(code_string, filename)
 	-- Prepare event handler function
-	local chunk, err = loadstring(code_string, "="..filename);
+	local chunk, err = envload(code_string, "="..filename, _G);
 	if not chunk then
 		return nil, "Error compiling (probably a compiler bug, please report): "..err;
 	end