diff options
author | Ted Trask <ttrask01@yahoo.com> | 2009-01-08 19:04:51 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2009-01-08 19:04:51 +0000 |
commit | 2e2e16a50fad3a9a99fa8021d235de77556bdad9 (patch) | |
tree | 221a776ce6bbf90c56a27b6f8f35b63e8988a830 /chrony-model.lua | |
parent | 2c426875d6306883433e8b336aa3b9852a22bfe0 (diff) | |
download | acf-chrony-2e2e16a50fad3a9a99fa8021d235de77556bdad9.tar.bz2 acf-chrony-2e2e16a50fad3a9a99fa8021d235de77556bdad9.tar.xz |
Modified chrony to add key file functionality.
git-svn-id: svn://svn.alpinelinux.org/acf/chrony/trunk@1671 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'chrony-model.lua')
-rw-r--r-- | chrony-model.lua | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/chrony-model.lua b/chrony-model.lua index 269b96c..ec0301d 100644 --- a/chrony-model.lua +++ b/chrony-model.lua @@ -49,6 +49,20 @@ function validate_config(config) return success, config end +local function get_keyfilestatus(filedetails) + filedetails.value.filecontent.descr = "List of password numbers and passwords (ie. '10 cronpass')" + + -- check to see if the file is being used + filedetails.value.status = cfe({ value="Key file in use", label="Key file status" }) + local config = get_config() + if config.value.keyfile.value ~= keyfile then + filedetails.value.status.value = "" + filedetails.value.status.errtxt = "Key file is not in use" + end + + return filedetails +end + -- ################################################################################ -- PUBLIC FUNCTIONS @@ -184,6 +198,32 @@ function update_config(config) return config end +function get_keyfiledetails() + return get_keyfilestatus(modelfunctions.getfiledetails(keyfile)) +end + +function update_keyfiledetails(filedetails) + return get_keyfilestatus(modelfunctions.setfiledetails(filedetails, {keyfile})) +end + +function enable_keyfile() + local result = cfe({ value="Enabled key file", label="Enable Key file result" }) + local config = get_config() + config.value.keyfile.value = keyfile + config = update_config(config) + if config.errtxt then + result.value = "" + result.errtxt = {config.errtxt} + for name,val in pairs(config.value) do + if val.errtxt then + table.insert(result.errtxt, name.." - "..val.errtxt) + end + end + result.errtxt = table.concat(result.errtxt, "\n") + end + return result +end + function get_filedetails() -- FIXME validate return modelfunctions.getfiledetails(configfile) |