summaryrefslogtreecommitdiffstats
path: root/dansguardian-model.lua
diff options
context:
space:
mode:
authorAndreas Brodmann <andreas.brodmann@gmail.com>2007-11-27 16:23:30 +0000
committerAndreas Brodmann <andreas.brodmann@gmail.com>2007-11-27 16:23:30 +0000
commitf9e85abf11c0dfc699e8634fbf4fd25f4be01ec0 (patch)
tree639f60a809bd8f76140ee57ce959ef0616946110 /dansguardian-model.lua
parentb60df8c6a658b177115ff94fbc52a5d842a6938e (diff)
downloadacf-squid-f9e85abf11c0dfc699e8634fbf4fd25f4be01ec0.tar.bz2
acf-squid-f9e85abf11c0dfc699e8634fbf4fd25f4be01ec0.tar.xz
daily update on the acf-squid module (separated dansguardian config from squid config)
git-svn-id: svn://svn.alpinelinux.org/acf/squid/trunk@373 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'dansguardian-model.lua')
-rw-r--r--dansguardian-model.lua39
1 files changed, 38 insertions, 1 deletions
diff --git a/dansguardian-model.lua b/dansguardian-model.lua
index f313eec..5289ee3 100644
--- a/dansguardian-model.lua
+++ b/dansguardian-model.lua
@@ -74,12 +74,32 @@ get_general_config = function()
end
fptr:close()
else
- error = "Failed to open /etc/dansguardian/dansguardian.conf file!"
+ error = "Failed to open " .. dansguardiancfg .. " file!"
end
return retval, error
end
+get_plain_config = function()
+
+ local retval = ""
+ local error = ""
+
+ local fptr = io.open( dansguardiancfg, "r" )
+ if fptr ~= nil then
+ retval = fptr:read( "*a" )
+ fptr:close()
+ if retval == nil then
+ retval = ""
+ error = "Failed to read " .. dansguardiancfg .. " file!"
+ end
+ else
+ error = "Failed to open " .. dansguardiancfg .. " file!"
+ end
+
+ return retval, error
+end
+
update_general_config = function( config )
local retval = ""
@@ -126,6 +146,23 @@ update_general_config = function( config )
return retval
end
+update_plain_config = function( config )
+
+ local retval = ""
+ local cfgptr = -1
+ local error = ""
+
+ cfgptr = io.open( dansguardiancfg, "wb+" )
+ if cfgptr ~= nil then
+ cfgptr:write( config )
+ cfgptr:close()
+ else
+ retval = "Failed to open " .. dansguardiancfg .. " file!"
+ end
+
+ return retval
+end
+
get_cfg_value = function( str )
local retval = ""