aboutsummaryrefslogtreecommitdiffstats
path: root/main/awall/yaml-toml-support.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/awall/yaml-toml-support.patch')
-rw-r--r--main/awall/yaml-toml-support.patch69
1 files changed, 0 insertions, 69 deletions
diff --git a/main/awall/yaml-toml-support.patch b/main/awall/yaml-toml-support.patch
deleted file mode 100644
index 6128f067fb..0000000000
--- a/main/awall/yaml-toml-support.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From 463c4117d2c985b3e6d693508240fdf34272f22d Mon Sep 17 00:00:00 2001
-From: Natanael Copa <ncopa@alpinelinux.org>
-Date: Tue, 9 May 2017 14:48:24 +0200
-Subject: [PATCH] policy: add support for loading yaml and toml policies
-
-The lua modules for yaml and toml are optional, and will only be
-required if there are any *.yaml or *.toml files.
----
- awall/policy.lua | 17 ++++++++++++-----
- 1 file changed, 12 insertions(+), 5 deletions(-)
-
-diff --git a/awall/policy.lua b/awall/policy.lua
-index 1509d3f..cb2c93a 100644
---- a/awall/policy.lua
-+++ b/awall/policy.lua
-@@ -17,7 +17,6 @@ local map = util.map
- local printmsg = util.printmsg
-
-
--local json = require('cjson')
- local posix = require('posix')
-
-
-@@ -75,7 +74,7 @@ function Policy:load()
- local data = file:read('*all')
- file:close()
-
-- local success, res = pcall(json.decode, data)
-+ local success, res = pcall(self.decode, data)
- if success then return res end
- raise(res..' while parsing '..self.path)
- end
-@@ -109,14 +108,21 @@ local PolicySet = class()
-
- function PolicySet:init(dirs)
- local confdir = (dirs.mandatory or defdirs.mandatory)[1]
-+ local decoder = {
-+ json = { mod="cjson", func="decode" },
-+ yaml = { mod="lyaml", func="load" },
-+ toml = { mod="toml", func="parse" },
-+ }
- self.policies = {}
-
- for i, cls in ipairs{'private', 'optional', 'mandatory'} do
- for i, dir in ipairs(dirs[cls] or defdirs[cls]) do
- for _, fname in ipairs(posix.dir(dir)) do
-- local si, ei, name = fname:find('^([%w-]+)%.json$')
-- if name then
-+ local si, ei, name, suff = fname:find('^([%w-]+)%.([jyt][sao][om][nl])$') -- json|yaml|toml
-+
-+ if name and suff and decoder[suff] then
- local pol = self.policies[name]
-+ local decmod = require(decoder[suff].mod)
-
- local path = dir..'/'..fname
- if path:sub(1, 1) ~= '/' then
-@@ -141,7 +147,8 @@ function PolicySet:init(dirs)
- path=path,
- fname=fname,
- loc=loc,
-- confdir=confdir
-+ confdir=confdir,
-+ decode=decmod[decoder[suff].func]
- }
- end
- end
---
-2.12.2
-