summaryrefslogtreecommitdiffstats
path: root/shorewall-model.lua
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 /shorewall-model.lua
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
Diffstat (limited to 'shorewall-model.lua')
-rw-r--r--shorewall-model.lua19
1 files changed, 10 insertions, 9 deletions
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")