From c6ceb72038d970ba894b4d54cd76e157715a07c4 Mon Sep 17 00:00:00 2001 From: Mika Havela Date: Fri, 23 Nov 2007 10:43:49 +0000 Subject: Hmm... git-svn-id: svn://svn.alpinelinux.org/acf/openvpn/trunk@360 ab2d0c66-481e-0410-8bed-d214d4d58bed --- openvpn-controller.lua | 5 +++-- openvpn-logfile-html.lsp | 5 +++-- openvpn-model.lua | 18 ++++++++++++++++-- openvpn-unknown_config-html.lsp | 7 +++---- 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/openvpn-controller.lua b/openvpn-controller.lua index 99a655b..9597473 100644 --- a/openvpn-controller.lua +++ b/openvpn-controller.lua @@ -42,15 +42,16 @@ end status_info = function (self) local configname = self.clientdata.name or "" - -- FIXME: If return 0 rows, goto read return ( {clientlist = self.model:clientlist(configname), url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller} ) end unknown_config = function (self) + local configname = self.clientdata.name or "" + return ( {configfilecontent = self.model:get_config(configname), url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller} ) end logfile = function (self) local configname = self.clientdata.name or "" -- FIXME: If return 0 rows, goto read - return ( {logfilecontent = self.model:get_logfile(configname), url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller} ) + return ( {logfilecontent = self.model:get_logfile(configname), url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller } ) end diff --git a/openvpn-logfile-html.lsp b/openvpn-logfile-html.lsp index a8d64b7..6eb05d5 100644 --- a/openvpn-logfile-html.lsp +++ b/openvpn-logfile-html.lsp @@ -1,7 +1,8 @@ -

Logfile 'xxx.log'

- +

Logfile ''

+ + diff --git a/openvpn-model.lua b/openvpn-model.lua index bcae88c..15c791c 100644 --- a/openvpn-model.lua +++ b/openvpn-model.lua @@ -208,10 +208,24 @@ end function get_logfile( self, path) local logcontent = {} config = config_content ( path ) - local logfilecontent = fs.read_file_as_array ( config.log ) - return logfilecontent + local logfilecontent = fs.read_file ( config.log ) + if not (logfilecontent) then + logfilecontent = "File is empty or missing!" + end + return ( { name = config.log, value = logfilecontent } ) end +function get_config( self, path) + local logcontent = {} + config = config_content ( path ) + local logfilecontent = fs.read_file ( config.name ) + if not (logfilecontent) then + logfilecontent = "File is empty or missing!" + end + return ( { name = config.name, value = logfilecontent } ) +end + + function get_conflist () local configlist = {} for k,v in pairs(list_conffiles()) do diff --git a/openvpn-unknown_config-html.lsp b/openvpn-unknown_config-html.lsp index 26787c5..2d33d10 100644 --- a/openvpn-unknown_config-html.lsp +++ b/openvpn-unknown_config-html.lsp @@ -1,12 +1,11 @@ -

Configuration file 'xxx.conf'

+

Configuration file ''

Details

- - + - + -- cgit v1.2.3