summaryrefslogtreecommitdiffstats
path: root/syslog-controller.lua
diff options
context:
space:
mode:
Diffstat (limited to 'syslog-controller.lua')
-rw-r--r--syslog-controller.lua39
1 files changed, 39 insertions, 0 deletions
diff --git a/syslog-controller.lua b/syslog-controller.lua
new file mode 100644
index 0000000..be3e322
--- /dev/null
+++ b/syslog-controller.lua
@@ -0,0 +1,39 @@
+
+module(..., package.seeall)
+
+require("privsep")
+require("join")
+
+-- those should go into acf.conf
+local user="nobody"
+local group="nobody"
+
+-- drop privileges and put privileged model funcs in self.priv
+mvc = {}
+function mvc.on_load(self)
+ self.priv = privsep.drop_privs(user, group, self.model.priv)
+end
+
+function basic(self)
+ local ctl = {}
+ local opts = self.model.readopts()
+ ctl.pidlist = self.priv.is_enabled()
+ if pidlist then
+ ctl.enabled = "checked=yes"
+ ctl.disabled = ""
+ else
+ ctl.enabled = ""
+ ctl.disabled = "checked=yes"
+ end
+ ctl.opts = opts
+ if opts and opts.remote then
+ ctl.remote = "checked"
+ ctl.host = opts.remote
+ else
+ ctl.remote = ""
+ ctl.host = ""
+ end
+ ctl.debug="opts="..tostring(opts)
+
+ return ctl
+end