summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openssh-model.lua8
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