summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2013-10-21 00:34:22 +0000
committerTed Trask <ttrask01@yahoo.com>2013-10-21 00:34:22 +0000
commit9c7c3db17d1f67f0ffcacc58e4e4dd57a61594cf (patch)
tree0af85240681cfff24441e48d02d047041ccff430
parentbb316d50d3ed0eeec998b7ea535dc587ef2fff21 (diff)
downloadacf-snort-9c7c3db17d1f67f0ffcacc58e4e4dd57a61594cf.tar.bz2
acf-snort-9c7c3db17d1f67f0ffcacc58e4e4dd57a61594cf.tar.xz
Remove all calls to 'module' in preparation for move to Lua 5.2
Use mymodule parameter for module definition. This was also helpful in revealing places where the code relied on the global environment.
-rw-r--r--snort-controller.lua13
-rw-r--r--snort-model.lua16
2 files changed, 16 insertions, 13 deletions
diff --git a/snort-controller.lua b/snort-controller.lua
index 1ee4a63..8a25321 100644
--- a/snort-controller.lua
+++ b/snort-controller.lua
@@ -1,20 +1,21 @@
-module (..., package.seeall)
+local mymodule = {}
-default_action = "status"
+mymodule.default_action = "status"
-function status(self)
+function mymodule.status(self)
return self.model.getstatus()
end
-function details(self)
+function mymodule.details(self)
return self.model.read_alert()
end
-function startstop(self)
+function mymodule.startstop(self)
return self.handle_form(self, self.model.get_startstop, self.model.startstop_service, self.clientdata)
end
-function expert(self)
+function mymodule.expert(self)
return self.handle_form(self, self.model.get_filedetails, self.model.update_filedetails, self.clientdata, "Save", "Edit Configuration", "Configuration Set")
end
+return mymodule
diff --git a/snort-model.lua b/snort-model.lua
index c8c7d83..6c633a3 100644
--- a/snort-model.lua
+++ b/snort-model.lua
@@ -1,5 +1,5 @@
-- acf model for displaying logfiles recusivly
-module (..., package.seeall)
+local mymodule = {}
-- Load libraries
modelfunctions = require("modelfunctions")
@@ -17,19 +17,19 @@ local alertfile = "/var/log/snort/alert"
-- ################################################################################
-- PUBLIC FUNCTIONS
-function getstatus()
+function mymodule.getstatus()
return modelfunctions.getstatus(processname, packagename, "Snort Status")
end
-function get_startstop(self, clientdata)
+function mymodule.get_startstop(self, clientdata)
return modelfunctions.get_startstop(processname)
end
-function startstop_service(self, startstop, action)
+function mymodule.startstop_service(self, startstop, action)
return modelfunctions.startstop_service(startstop, action)
end
-function read_alert()
+function mymodule.read_alert()
local alertpriority = {}
local liboutput = fs.read_file_as_array(alertfile)
if (liboutput) then
@@ -77,10 +77,12 @@ function read_alert()
return cfe({ type="structure", value=sorted_table, label="Snort Alerts" })
end
-function get_filedetails()
+function mymodule.get_filedetails()
return modelfunctions.getfiledetails(configfile)
end
-function update_filedetails(self, filedetails)
+function mymodule.update_filedetails(self, filedetails)
return modelfunctions.setfiledetails(self, filedetails, {configfile})
end
+
+return mymodule