diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2017-04-28 10:13:48 +0300 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2017-04-28 11:00:52 +0300 |
commit | f02077c75dcc1874eb04e49b8a11259abde6397b (patch) | |
tree | 7e31fdf7fae55a5eeb06b7361b6bd256e0efaf6f | |
parent | 49be2996254147cf7231fa3de310004fc7afda6a (diff) | |
download | awall-1.3-stable.tar.bz2 awall-1.3-stable.tar.xz |
Log: allow spaces in prefixv1.3.21.3-stable
-rwxr-xr-x | awall-cli | 4 | ||||
-rw-r--r-- | awall/modules/log.lua | 12 | ||||
-rw-r--r-- | awall/util.lua | 5 |
3 files changed, 14 insertions, 7 deletions
@@ -2,7 +2,7 @@ --[[ Alpine Wall -Copyright (C) 2012-2016 Kaarle Ritvanen +Copyright (C) 2012-2017 Kaarle Ritvanen See LICENSE file for license details ]]-- @@ -20,7 +20,7 @@ if not table.unpack then table.unpack = unpack end function help() io.stderr:write([[ Alpine Wall -Copyright (C) 2012-2016 Kaarle Ritvanen +Copyright (C) 2012-2017 Kaarle Ritvanen This is free software with ABSOLUTELY NO WARRANTY, available under the terms of the GNU General Public License, version 2 diff --git a/awall/modules/log.lua b/awall/modules/log.lua index 076a8a0..5290687 100644 --- a/awall/modules/log.lua +++ b/awall/modules/log.lua @@ -1,6 +1,6 @@ --[[ Packet logging module for Alpine Wall -Copyright (C) 2012-2016 Kaarle Ritvanen +Copyright (C) 2012-2017 Kaarle Ritvanen See LICENSE file for license details ]]-- @@ -9,13 +9,13 @@ local model = require('awall.model') local class = model.class local combinations = require('awall.optfrag').combinations -local setdefault = require('awall.util').setdefault +local util = require('awall.util') local LogLimit = class(model.Limit) function LogLimit:init(...) - setdefault(self, 'mask', 0) + util.setdefault(self, 'mask', 0) LogLimit.super(self):init(...) end @@ -74,7 +74,11 @@ function Log:target() local res = mode:upper() for s, t in pairs(optmap[mode]) do - if self[s] then res = res..' --'..mode..'-'..t..' '..self[s] end + local value = self[s] + if value then + if s == 'prefix' then value = util.quote(value) end + res = res..' --'..mode..'-'..t..' '..value + end end return res end diff --git a/awall/util.lua b/awall/util.lua index 909e3fb..a43da4a 100644 --- a/awall/util.lua +++ b/awall/util.lua @@ -1,6 +1,6 @@ --[[ Utility module for Alpine Wall -Copyright (C) 2012-2016 Kaarle Ritvanen +Copyright (C) 2012-2017 Kaarle Ritvanen See LICENSE file for license details ]]-- @@ -116,6 +116,9 @@ function M.join(a, sep, b) end +function M.quote(s) return '"'..s:gsub('(["\\])', '\\%1')..'"' end + + function M.printtabulars(tables) local colwidth = {} for i, tbl in ipairs(tables) do |