summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMika Havela <mika.havela@gmail.com>2007-11-28 18:15:49 +0000
committerMika Havela <mika.havela@gmail.com>2007-11-28 18:15:49 +0000
commitd81ce7886c20e537161083279e9bc96cf6b74290 (patch)
tree91222d2be2251f71ac059598e82abe613ae22ccc
parentf9975a98a1e3404c2f75ed093f8de47f89b339e5 (diff)
downloadacf-shorewall-d81ce7886c20e537161083279e9bc96cf6b74290.tar.bz2
acf-shorewall-d81ce7886c20e537161083279e9bc96cf6b74290.tar.xz
Still have problems showing owner of a file in cleartext (instead of uid)
git-svn-id: svn://svn.alpinelinux.org/acf/shorewall/trunk@384 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r--shorewall-edit-html.lsp11
-rw-r--r--shorewall-list-html.lsp2
-rw-r--r--shorewall-model.lua19
3 files changed, 19 insertions, 13 deletions
diff --git a/shorewall-edit-html.lsp b/shorewall-edit-html.lsp
index 3e12554..f1c4958 100644
--- a/shorewall-edit-html.lsp
+++ b/shorewall-edit-html.lsp
@@ -12,17 +12,22 @@
<dd><?= view.filecontent.filedetails.size ?></dd>
<dt>Last modified</dt>
-<dd><?= view.filecontent.filedetails.mtime ?></dd>
+<dd><?= view.filecontent.filedetails.mtimelong ?></dd>
<dt>Mode</dt>
<dd><?= view.filecontent.filedetails.mode ?></dd>
<dt>Owner:Group</dt>
-<dd><?= view.filecontent.filedetails.uid ?>:<?= view.filecontent.filedetails.gid ?></dd>
+<dd><?= view.filecontent.filedetails.gid ?>:<?= view.filecontent.filedetails.group ?></dd>
<h2>Content</h2>
<textarea name="" style="width:100%;height:400px;"><?= view.filecontent.value ?></textarea>
-
+<h2>DEUB INFO</h2>
+<?
+for a,b in pairs(view.filecontent.filedetails) do
+print (a,b .. "<BR>")
+end
+?>
</body>
</html>
diff --git a/shorewall-list-html.lsp b/shorewall-list-html.lsp
index 424349a..dc18373 100644
--- a/shorewall-list-html.lsp
+++ b/shorewall-list-html.lsp
@@ -6,5 +6,5 @@
<? for i = 1, table.maxn(view.filelist) do ?>
<dt><?= html.link{value = view.url .. "/edit?name=" .. view.filelist[i].name , label=view.filelist[i].name } ?></dt>
- <dd><i>Last modified:</i> <?= view.filelist[i].filedetails.mtime ?></dd>
+ <dd><i>Last modified:</i> <?= view.filelist[i].filedetails.mtimelong ?></dd>
<? end ?>
diff --git a/shorewall-model.lua b/shorewall-model.lua
index bf42891..ce436c4 100644
--- a/shorewall-model.lua
+++ b/shorewall-model.lua
@@ -1,20 +1,21 @@
-- shorewall model methods
module (..., package.seeall)
-local function XXXfile_info ( path )
- local file = io.popen("ls -lh " .. path )
- local file_info_result = file:read("*a") or "unknown"
- file:close()
- local size,lastmod = string.match(file_info_result, "^%S+%s+%S+%s+%S+%s+%S+%s+(%S+)%s+(%S+%s+%S+%s+%S+)" )
- return {lastmod=lastmod,size=size, longname=path}
-end
local function file_info ( path )
require("posix")
- filedetails = posix.stat(path)
- filedetails.longname = path
+ modfiledetails = {}
+ local filedetails = posix.stat(path)
+ filedetails["owner"]=rawget((posix.getgroup(filedetails["uid"])),"1")
+ filedetails["group"]=rawget((posix.getgroup(filedetails["gid"])),"name")
+ filedetails["atimelong"]=os.date("%c", filedetails["atime"])
+ filedetails["mtimelong"]=os.date("%c", filedetails["mtime"])
+ filedetails["longname"]=path
+
return filedetails
end
+-- ################################################################################
+-- PUBLIC FUNCTIONS
function get_status ()
local f,error = io.popen("/sbin/shorewall status")