From dbf1f135f134ed6e51cf8b7be12b36a461ec4ab8 Mon Sep 17 00:00:00 2001 From: Mika Havela Date: Thu, 17 Jan 2008 16:17:52 +0000 Subject: Added functionallity to remove items from include/exclude list git-svn-id: svn://svn.alpinelinux.org/acf/alpine-conf/trunk@609 ab2d0c66-481e-0410-8bed-d214d4d58bed --- lbu-model.lua | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'lbu-model.lua') diff --git a/lbu-model.lua b/lbu-model.lua index 7757332..c3d20c4 100644 --- a/lbu-model.lua +++ b/lbu-model.lua @@ -51,8 +51,8 @@ end local function getincexl(state) local incexl = {} if (string.lower(state) == "include") or (string.lower(state) == "exclude") then - local f = io.popen("/sbin/lbu " .. state .. " -l 2>&1", "r") - if not (f) then return ciphers end + local f = io.popen("/sbin/lbu " .. string.lower(state) .. " -l 2>&1", "r") + if not (f) then return incexl end for line in f:lines() do table.insert(incexl,tostring(line)) end @@ -108,6 +108,27 @@ function getconfig () -- config["debug"] = getciphers() return config end + +function lbuincexcl(self,state,value,addremove) + local incexl = nil +-- local addremove + if (string.lower(addremove or "") == "add") then + addremove = "" + elseif (string.lower(addremove or "") == "remove") then + addremove = "-r" + else + return "Function setincexl() - Invalid option! Use add|remove when calling this function!" + end + if (string.lower(state) == "include") or (string.lower(state) == "exclude") then + local f = io.popen("/sbin/lbu " .. string.lower(state) .. " " .. addremove .. " -v " .. value .." 2>&1", "r") + if not (f) then return incexl end + incexl = f:read("*a") + f:close() + else + return "Function setincexl() - Invalid command! Use include|exclude when calling this function!" + end + return incexl +end -- ################################################################################ -- OLD FUNCTIONS -- cgit v1.2.3