From 651ba7cce4fd5bc01edf6902e0f08c7c93527d00 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Wed, 24 Sep 2008 15:21:17 +0000 Subject: Modified openssh. Changed expert, status, and startstop to links. Modified config to use standard cfes. Modified peers to account for dns names. git-svn-id: svn://svn.alpinelinux.org/acf/openssh/trunk@1489 ab2d0c66-481e-0410-8bed-d214d4d58bed --- openssh-controller.lua | 74 +------------------------------------------------- 1 file changed, 1 insertion(+), 73 deletions(-) (limited to 'openssh-controller.lua') diff --git a/openssh-controller.lua b/openssh-controller.lua index 30800f5..6a76512 100644 --- a/openssh-controller.lua +++ b/openssh-controller.lua @@ -3,8 +3,6 @@ module(..., package.seeall) -- Load libraries require("controllerfunctions") -local checkboxes = { "PermitRootLogin", "PasswordAuthentication", "UseDNS" } - default_action = "status" function status(self) @@ -12,75 +10,7 @@ function status(self) end function config(self) - local output = {} - local errtxt = {} - local successfuledit - if (self.clientdata.cmdsave) then - local fields = { "Port", "ListenAddress", "PermitRootLogin", "PasswordAuthentication", "UseDNS", } - local newconfig = {} - for _ , v in pairs(fields) do - newconfig[v] = self.clientdata[v] or "" - end - successfuledit, errtxt = self.model.write_config(newconfig) - end - - local config = self.model.read_config() or {} - output.cmdsave = cfe({ - name="cmdsave", - label="Save above changes", - value="Apply", - type="submit", - }) - - output.Port = cfe({ - name="Port", - label="Port", - value=config.Port, - }) - output.ListenAddress = cfe({ - name="ListenAddress", - label="Listen address", - value=config.ListenAddress, - }) - output.PermitRootLogin = cfe({ - name="PermitRootLogin", - label="Permit Root Login", - }) - - output.PasswordAuthentication = cfe({ - name="PasswordAuthentication", - label="Password Authentication", - }) - - output.UseDNS = cfe({ - name="UseDNS", - label="Use DNS", - }) - - -- Display checkboxes checked/unchecked - for k,v in pairs(checkboxes) do - output[v]['value']="yes" - output[v]['type']="checkbox" - if (config[v]) and (string.lower(tostring(config[v] or "")) == "yes") then - output[v]['checked']="yes" - end - end - - -- Display results of previous save action - if (self.clientdata.cmdsave) and not (successfuledit) then - for k,v in pairs(self.clientdata) do - if (output) and (output[k]) and (k) then - output[k]['value'] = self.clientdata[k] - output[k]['errtxt'] = errtxt[k] - end - end - - output.cmdsave.errtxt = "Save action was canceled because there was invalid input." - elseif (self.clientdata.cmdsave) and (successfuledit) then - output.cmdsave.descr = "* Configuration was succesfully saved" - end - - return output + return controllerfunctions.handle_form(self, self.model.read_config, self.model.update_config, self.clientdata, "Save", "Edit Config", "Configuration Saved") end function startstop(self) @@ -94,5 +24,3 @@ end function connectedpeers(self) return self.model.list_conn_peers() end -function welcome(self) -end -- cgit v1.2.3