summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Mason <ms13sp@gmail.com>2007-11-20 16:39:39 +0000
committerMike Mason <ms13sp@gmail.com>2007-11-20 16:39:39 +0000
commit3627a09a8a8a487ef265d0cd5be92e8a6806a6da (patch)
tree3dd5aebdbad91fa5bbc77c34160120318f7c8460
parent92db7c97a2b949afed04f5bc8b1b825917aa1d9a (diff)
downloadacf-alpine-baselayout-3627a09a8a8a487ef265d0cd5be92e8a6806a6da.tar.bz2
acf-alpine-baselayout-3627a09a8a8a487ef265d0cd5be92e8a6806a6da.tar.xz
System Password manager
git-svn-id: svn://svn.alpinelinux.org/acf/alpine-baselayout/trunk@346 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r--Makefile4
-rw-r--r--password-controller.lua34
-rw-r--r--password-model.lua19
-rw-r--r--password-read-html.lsp2
-rw-r--r--password.menu2
5 files changed, 61 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 8bda23b..5ecd537 100644
--- a/Makefile
+++ b/Makefile
@@ -24,6 +24,10 @@ APP_DIST=hostname-controller.lua \
syslog-controller.lua \
syslog-model.lua \
syslog-basic-html.lsp \
+ password.menu \
+ password-controller.lua \
+ password-model.lua \
+ password-read-html.lsp \
template-logfiles-download-html.lsp
EXTRA_DIST=README Makefile config.mk
diff --git a/password-controller.lua b/password-controller.lua
new file mode 100644
index 0000000..bc5389e
--- /dev/null
+++ b/password-controller.lua
@@ -0,0 +1,34 @@
+-- the password controller
+
+module (..., package.seeall)
+
+-- Cause an http redirect to our "read" action
+-- We use the self.conf table because it already has prefix,controller,etc
+-- The redir code is defined in the application error handler (acf-controller)
+local list_redir = function (self)
+ self.conf.action = "read"
+ self.conf.type = "redir"
+ error (self.conf)
+end
+
+mvc={}
+mvc.on_load = function(self, parent)
+ if (self.worker[self.conf.action] == nil ) or ( self.conf.action == "init" ) then
+ self.worker[self.conf.action] = list_redir(self)
+ end
+
+ --logit ("password.mvc.on_load activated")
+
+end
+
+
+-- Public methods
+
+read = function (self)
+ return ({ password = self.model:get()} )
+end
+
+
+update = function (self)
+ return ( {password = self.model:set(cfe({value=self.clientdata.password}))})
+end
diff --git a/password-model.lua b/password-model.lua
new file mode 100644
index 0000000..33dffbd
--- /dev/null
+++ b/password-model.lua
@@ -0,0 +1,19 @@
+-- password model methods
+module (..., package.seeall)
+strsplit = require "split"
+
+-- no initializer in model - use controller.init for that
+
+get = function (self)
+ f = io.open ("/etc/shadow")
+ c = f:read("*l")
+ temp = strsplit(":", c)
+ if temp[2] == "!" then
+ status = "not set"
+ else
+ status = "set"
+ end
+ f:close()
+ return (cfe{value=status, name="password"})
+end
+
diff --git a/password-read-html.lsp b/password-read-html.lsp
new file mode 100644
index 0000000..9ab91bf
--- /dev/null
+++ b/password-read-html.lsp
@@ -0,0 +1,2 @@
+<? local view = ... ?>
+<p>The local root password is <?= view.password.value ?></p>
diff --git a/password.menu b/password.menu
new file mode 100644
index 0000000..d651da0
--- /dev/null
+++ b/password.menu
@@ -0,0 +1,2 @@
+#CAT GROUP/DESC TAB ACTION
+General Password update update