summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorttrask <ttrask@ab2d0c66-481e-0410-8bed-d214d4d58bed>2009-03-18 20:14:09 +0000
committerttrask <ttrask@ab2d0c66-481e-0410-8bed-d214d4d58bed>2009-03-18 20:14:09 +0000
commit034b5f0c6295331cc836b0a5fed2ae3e86d25611 (patch)
treedb8c961f5bb332c0cef96aa661a062921efe1854
parent980642caa0eeb1f01acd7d4690e27c33785b5b5b (diff)
downloadacf-clamav-034b5f0c6295331cc836b0a5fed2ae3e86d25611.tar.bz2
acf-clamav-034b5f0c6295331cc836b0a5fed2ae3e86d25611.tar.xz
Modified ClamAV to allow editing of /etc/freshclam.conf. Needed to add list.
git-svn-id: svn://svn.alpinelinux.org/acf/clamav/trunk@1732 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r--clamav-controller.lua6
-rw-r--r--clamav-listfiles-html.lsp32
-rw-r--r--clamav-model.lua23
-rw-r--r--clamav.menu2
-rw-r--r--clamav.roles4
5 files changed, 58 insertions, 9 deletions
diff --git a/clamav-controller.lua b/clamav-controller.lua
index 20baa25..0cb3f25 100644
--- a/clamav-controller.lua
+++ b/clamav-controller.lua
@@ -17,6 +17,10 @@ function details(self)
return self.model.getstatusdetails()
end
+function listfiles(self)
+ return self.model.getfilelist()
+end
+
function expert(self)
- return controllerfunctions.handle_form(self, self.model.get_filedetails, self.model.update_filedetails, self.clientdata, "Save", "Edit ClamAV Config", "Configuration Set")
+ return controllerfunctions.handle_form(self, function() return self.model.getfiledetails(self.clientdata.filename) end, self.model.updatefiledetails, self.clientdata, "Save", "Edit ClamAV File", "File Saved")
end
diff --git a/clamav-listfiles-html.lsp b/clamav-listfiles-html.lsp
new file mode 100644
index 0000000..42caa56
--- /dev/null
+++ b/clamav-listfiles-html.lsp
@@ -0,0 +1,32 @@
+<% local data, viewlibrary, page_info, session = ...
+require("viewfunctions")
+%>
+
+<% displaycommandresults({"expert", "startstop"}, session) %>
+
+<% if viewlibrary and viewlibrary.dispatch_component then
+ viewlibrary.dispatch_component("status")
+end %>
+
+<h1><%= html.html_escape(data.label) %></h1>
+
+<TABLE>
+ <TR style="background:#eee;font-weight:bold;">
+ <TD style="padding-right:20px;white-space:nowrap;text-align:left;" class="header">File</TD>
+ <TD style="padding-right:20px;white-space:nowrap;text-align:left;" class="header">Size</TD>
+ <TD style="white-space:nowrap;text-align:left;" class="header">Last Modified</TD>
+ </TR>
+
+
+<% for i,file in ipairs(data.value) do %>
+ <TR>
+ <TD style="padding-right:20px;white-space:nowrap;"><%= html.link{value = "expert?filename=" .. file.filename.."&redir="..page_info.orig_action, label=file.filename} %></TD>
+ <TD style="padding-right:20px;white-space:nowrap;"><%= html.html_escape(file.filesize) %></TD>
+ <TD style="white-space:nowrap;" width="90%"><%= html.html_escape(file.mtime) %></TD>
+ </TR>
+<% end %>
+</TABLE>
+
+<% if viewlibrary and viewlibrary.dispatch_component then
+ viewlibrary.dispatch_component("startstop")
+end %>
diff --git a/clamav-model.lua b/clamav-model.lua
index 90e2fa5..61d7b91 100644
--- a/clamav-model.lua
+++ b/clamav-model.lua
@@ -6,9 +6,9 @@ require("fs")
require("format")
-- Set variables
-local configfile = "/etc/clamd.conf"
local processname = "clamd"
local packagename = "clamav"
+local filelist = {"/etc/clamd.conf", "/etc/freshclam.conf"}
local path = "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin "
@@ -30,10 +30,23 @@ function getstatusdetails()
return cfe({ type="longtext", value="", label="ClamAV Status Details" })
end
-function get_filedetails()
- return modelfunctions.getfiledetails(configfile)
+function getfilelist()
+ local listed_files = {}
+
+ for i,name in ipairs(filelist) do
+ local filedetails = fs.stat(name) or {}
+ table.insert ( listed_files , {filename=name, mtime=filedetails.mtime or "---", filesize=filedetails.size or "0"} )
+ end
+
+ table.sort(listed_files, function (a,b) return (a.filename < b.filename) end )
+
+ return cfe({ type="list", value=listed_files, label="ClamAV File List" })
+end
+
+function getfiledetails(filename)
+ return modelfunctions.getfiledetails(filename, filelist)
end
-function update_filedetails(filedetails)
- return modelfunctions.setfiledetails(filedetails, {configfile})
+function updatefiledetails(filedetails)
+ return modelfunctions.setfiledetails(filedetails, filelist)
end
diff --git a/clamav.menu b/clamav.menu
index 7e48424..815d5fd 100644
--- a/clamav.menu
+++ b/clamav.menu
@@ -1,4 +1,4 @@
#CAT GROUP/DESC TAB ACTION
Applications 50ClamAV Status details
-Applications 50ClamAV Expert expert
+Applications 50ClamAV Expert listfiles
Applications 50ClamAV Logfile logfile
diff --git a/clamav.roles b/clamav.roles
index e6f20f6..7392371 100644
--- a/clamav.roles
+++ b/clamav.roles
@@ -1,3 +1,3 @@
USER=clamav:status,clamav:logfile,clamav:details,clamav:startstop
-EXPERT=clamav:expert
-ADMIN=clamav:status,clamav:logfile,clamav:details,clamav:startstop,clamav:expert
+EXPERT=clamav:listfiles,clamav:expert
+ADMIN=clamav:status,clamav:logfile,clamav:details,clamav:startstop,clamav:listfiles,clamav:expert