luci-base: explicitly invoke busybox applet for password change

Ensure to invoke the Busybox `passwd` applet to change the system password
in a non-interactive manner. Non-Busybox variants may not take the new
password input from stdin or use password hashes which are not supported
by musl's `crypt()` implementation by default.

Fixes: #5629
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 22e2bfb096)
This commit is contained in:
Jo-Philipp Wich 2022-01-25 22:56:56 +01:00
parent e927a11d4e
commit 4ec18ec765

View file

@ -441,7 +441,7 @@ local methods = {
call = function(args)
local util = require "luci.util"
return {
result = (os.execute("(echo %s; sleep 1; echo %s) | passwd %s >/dev/null 2>&1" %{
result = (os.execute("(echo %s; sleep 1; echo %s) | /bin/busybox passwd %s >/dev/null 2>&1" %{
luci.util.shellquote(args.password),
luci.util.shellquote(args.password),
luci.util.shellquote(args.username)