diff options
-rwxr-xr-x | awall-cli | 2 | ||||
-rw-r--r-- | awall/model.lua | 4 | ||||
-rw-r--r-- | awall/policy.lua | 7 |
3 files changed, 9 insertions, 4 deletions
@@ -299,7 +299,9 @@ if not call( local data repeat + -- Lua 5.2 compatibility: prefix with * data = stdout:read('*a') + io.stdout:write(data) until data == '' stdout:close() diff --git a/awall/model.lua b/awall/model.lua index f062904..7ed7467 100644 --- a/awall/model.lua +++ b/awall/model.lua @@ -289,8 +289,8 @@ function M.Rule:zoneoptfrags() local izones = self[self:direction('in')] or {} local ozones = self[self:direction('out')] or {} - for i = 1,math.max(1, table.maxn(izones)) do - for j = 1,math.max(1, table.maxn(ozones)) do + for i = 1,math.max(1, #izones) do + for j = 1,math.max(1, #ozones) do extend(res, zonepair(izones[i], ozones[j])) end end diff --git a/awall/policy.lua b/awall/policy.lua index cb2c93a..b71cf3a 100644 --- a/awall/policy.lua +++ b/awall/policy.lua @@ -1,6 +1,6 @@ --[[ Policy file handling for Alpine Wall -Copyright (C) 2012-2016 Kaarle Ritvanen +Copyright (C) 2012-2017 Kaarle Ritvanen See LICENSE file for license details ]]-- @@ -71,7 +71,10 @@ function Policy:init() self.enabled = self.type == 'mandatory' end function Policy:load() local file = io.open(self.path) if not file then raise('Unable to read policy file '..self.path) end - local data = file:read('*all') + + -- Lua 5.2 compatibility: prefix with * + local data = file:read('*a') + file:close() local success, res = pcall(self.decode, data) |