aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2026-06-04 18:59:30 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2026-06-04 18:59:30 +0000
commitfdff89256fd921e40f2fa532895315b1dab6f5e6 (patch)
treee43310e6886fe79bb8c7701d39dc255316b3ed11
parent852504a5fa5eb6b4dea98bd7abdb89f1c7bab2b0 (diff)
nuageinit: fix non-standard f:close(cmd) and remove dead precmd
- f:close(cmd) -> f:close() in adduser() and exec_change_password(): the 'cmd' argument is not standard Lua and is silently ignored. - Remove dead 'precmd' variable in adduser().
-rw-r--r--libexec/nuageinit/nuage.lua7
1 files changed, 3 insertions, 4 deletions
diff --git a/libexec/nuageinit/nuage.lua b/libexec/nuageinit/nuage.lua
index c443d6711b14..7e7b2a64305f 100644
--- a/libexec/nuageinit/nuage.lua
+++ b/libexec/nuageinit/nuage.lua
@@ -271,7 +271,6 @@ local function adduser(pwd)
if not pwd.shell then
pwd.shell = "/bin/sh"
end
- local precmd = ""
local postcmd = ""
local input = nil
if pwd.passwd then
@@ -281,7 +280,7 @@ local function adduser(pwd)
input = pwd.plain_text_passwd
postcmd = " -h 0"
end
- cmd = precmd .. "pw "
+ cmd = "pw "
if root then
cmd = cmd .. "-R " .. root .. " "
end
@@ -293,7 +292,7 @@ local function adduser(pwd)
if input then
f:write(input)
end
- local r = f:close(cmd)
+ local r = f:close()
if not r then
warnmsg("fail to add user " .. pwd.name)
warnmsg(cmd)
@@ -536,7 +535,7 @@ local function exec_change_password(user, password, type, expire)
f:write(input)
end
-- ignore stdout to avoid printing the password in case of random password
- local r = f:close(cmd)
+ local r = f:close()
if not r then
warnmsg("fail to change user password ".. user)
warnmsg(cmd)