From 3627a09a8a8a487ef265d0cd5be92e8a6806a6da Mon Sep 17 00:00:00 2001 From: Mike Mason Date: Tue, 20 Nov 2007 16:39:39 +0000 Subject: System Password manager git-svn-id: svn://svn.alpinelinux.org/acf/alpine-baselayout/trunk@346 ab2d0c66-481e-0410-8bed-d214d4d58bed --- Makefile | 4 ++++ password-controller.lua | 34 ++++++++++++++++++++++++++++++++++ password-model.lua | 19 +++++++++++++++++++ password-read-html.lsp | 2 ++ password.menu | 2 ++ 5 files changed, 61 insertions(+) create mode 100644 password-controller.lua create mode 100644 password-model.lua create mode 100644 password-read-html.lsp create mode 100644 password.menu 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 @@ + +

The local root password is

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 -- cgit v1.2.3