From d81ce7886c20e537161083279e9bc96cf6b74290 Mon Sep 17 00:00:00 2001 From: Mika Havela Date: Wed, 28 Nov 2007 18:15:49 +0000 Subject: 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 --- shorewall-edit-html.lsp | 11 ++++++++--- shorewall-list-html.lsp | 2 +- shorewall-model.lua | 19 ++++++++++--------- 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 @@
Last modified
-
+
Mode
Owner:Group
-
:
+
:

Content

- +

DEUB INFO

+") +end +?> 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 @@
-
Last modified:
+
Last modified:
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") -- cgit v1.2.3