Commit 45372396 authored by Ted Trask's avatar Ted Trask

Modified format library. parse_configfile2, update_configfile2, get_section,...

Modified format library.  parse_configfile2, update_configfile2, get_section, and set_section became parse_ini_file, update_ini_file, get_ini_section, and set_ini_section.  Updated all code that used these functions.

git-svn-id: svn://svn.alpinelinux.org/acf/dansguardian/trunk@1539 ab2d0c66-481e-0410-8bed-d214d4d58bed
parent 06e38aae
......@@ -95,7 +95,7 @@ read_general_config = function()
naughtynesslimit = cfe({ label="NaughtynessLimit" })
}
local config = format.parse_configfile2(fs.read_file(dansguardiancfg), "")
local config = format.parse_ini_file(fs.read_file(dansguardiancfg), "")
if config then
if config.filterip then retval.filterip.value = config.filterip end
if config.filterport then retval.filterport.value = config.filterport end
......@@ -104,7 +104,7 @@ read_general_config = function()
if config.accessdeniedaddress then retval.accessdeniedaddress.value = string.sub(config.accessdeniedaddress, 2, -2) end
end
config = format.parse_configfile2(fs.read_file(dansguardiancfg2), "")
config = format.parse_ini_file(fs.read_file(dansguardiancfg2), "")
if config then
if config.naughtynesslimit then retval.naughtynesslimit.value = config.naughtynesslimit end
end
......@@ -118,15 +118,15 @@ update_general_config = function( config )
if success then
local text = fs.read_file(dansguardiancfg) or ""
text = format.update_configfile2(text, "", "filterip", config.value.filterip.value)
text = format.update_configfile2(text, "", "filterport", config.value.filterport.value)
text = format.update_configfile2(text, "", "proxyip", config.value.proxyip.value)
text = format.update_configfile2(text, "", "proxyport", config.value.proxyport.value)
text = format.update_configfile2(text, "", "accessdeniedaddress", "'"..config.value.accessdeniedaddress.value.."'")
text = format.update_ini_file(text, "", "filterip", config.value.filterip.value)
text = format.update_ini_file(text, "", "filterport", config.value.filterport.value)
text = format.update_ini_file(text, "", "proxyip", config.value.proxyip.value)
text = format.update_ini_file(text, "", "proxyport", config.value.proxyport.value)
text = format.update_ini_file(text, "", "accessdeniedaddress", "'"..config.value.accessdeniedaddress.value.."'")
fs.write_file(dansguardiancfg, text)
text = fs.read_file(dansguardiancfg2) or ""
text = format.update_configfile2(text, "", "naughtynesslimit", config.value.naughtynesslimit.value)
text = format.update_ini_file(text, "", "naughtynesslimit", config.value.naughtynesslimit.value)
fs.write_file(dansguardiancfg2, text)
else
config.errtxt = "Failed to set config"
......
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