diff options
author | Ted Trask <ttrask01@yahoo.com> | 2009-01-13 16:01:06 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2009-01-13 16:01:06 +0000 |
commit | 4bf7c04933f59a5afa245bf05644e1ecb5ddd36b (patch) | |
tree | 36078e308cd43395b5861c32d1f6903c30bb27d1 | |
parent | 2c9f0e2c5b78988ff8f483a5980a9e143f9d07cb (diff) | |
download | acf-openssh-4bf7c04933f59a5afa245bf05644e1ecb5ddd36b.tar.bz2 acf-openssh-4bf7c04933f59a5afa245bf05644e1ecb5ddd36b.tar.xz |
Modified fs.lua to survive nil parameters. Added create_directory and used within create_file and write_file. Reviewed each read_file call to make sure handles nil return value.
git-svn-id: svn://svn.alpinelinux.org/acf/openssh/trunk@1677 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r-- | openssh-model.lua | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/openssh-model.lua b/openssh-model.lua index a6722fc..b5efd74 100644 --- a/openssh-model.lua +++ b/openssh-model.lua @@ -69,7 +69,7 @@ function read_config() output.PasswordAuthentication = cfe({ type="boolean", value=true, label="Password Authentication" }) output.UseDNS = cfe({ type="boolean", value=true, label="Use DNS" }) - local config = format.parse_configfile(fs.read_file(configfile)) + local config = format.parse_configfile(fs.read_file(configfile) or "") if config then output.Port.value = config.Port or output.Port.value output.ListenAddress.value = config.ListenAddress or output.ListenAddress.value @@ -257,11 +257,7 @@ function create_auth(authstr) if success then local file = "/"..authstr.value.user.value.."/.ssh/authorized_keys" if authstr.value.user.value ~= "root" then file = "/home"..file end - local data = fs.read_file(file) - if not data then - posix.mkdir(dirname(file)) - data = "" - end + local data = fs.read_file(file) or "" if string.match(data, "^[%s\n]*$") then data = authstr.value.cert.value else |