Commit ef970315 authored by Ted Trask's avatar Ted Trask
Browse files

Modified dansguardian to work despite missing config files.

git-svn-id: svn://svn.alpinelinux.org/acf/dansguardian/trunk@1466 ab2d0c66-481e-0410-8bed-d214d4d58bed
parent 2764edea
......@@ -117,13 +117,14 @@ update_general_config = function( config )
if success then
local a,b,c
local text = fs.read_file(dansguardiancfg)
local text = fs.read_file(dansguardiancfg) or ""
a,b,c,text = getopts.setoptsinfile(text, "", "filterip", config.value.filterip.value)
a,b,c,text = getopts.setoptsinfile(text, "", "filterport", config.value.filterport.value)
a,b,c,text = getopts.setoptsinfile(text, "", "proxyip", config.value.proxyip.value)
a,b,c,text = getopts.setoptsinfile(text, "", "proxyport", config.value.proxyport.value)
a,b,c,text = getopts.setoptsinfile(text, "", "accessdeniedaddress", "'"..config.value.accessdeniedaddress.value.."'")
fs.write_file(dansguardiancfg, string.gsub(text, "\n+$", ""))
if not fs.is_file(dansguardiancfg2) then fs.create_file(dansguardiancfg2) end
getopts.setoptsinfile(dansguardiancfg2, "", "naughtynesslimit", config.value.naughtynesslimit.value)
else
config.errtxt = "Failed to set config"
......@@ -170,12 +171,10 @@ end
list_config_files = function()
local list = {}
local details = fs.stat(dansguardiancfg)
details.filename = dansguardiancfg
list[1] = details
details = fs.stat(dansguardiancfg2)
details.filename = dansguardiancfg2
list[2] = details
local details = fs.stat(dansguardiancfg) or {}
list[1] = { filename=dansguardiancfg, size = details.size or 0, mtime = details.mtime or "---" }
details = fs.stat(dansguardiancfg2) or {}
list[2] = { filename=dansguardiancfg2, size = details.size or 0, mtime = details.mtime or "---" }
return cfe({ type="list", value=list, label="List of Dansguardian config files" })
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment