luci-0.10: merge r6789

This commit is contained in:
Jo-Philipp Wich 2011-01-25 12:52:35 +00:00
parent e558edee0b
commit b563a74360

View file

@ -604,16 +604,17 @@ end
-- @return Number containing 0 on success and >= 1 on error
function user.setpasswd(username, password)
if password then
password = password:gsub("'", "")
password = password:gsub("'", [['"'"']])
end
if username then
username = username:gsub("'", "")
username = username:gsub("'", [['"'"']])
end
local cmd = "(echo '"..password.."';sleep 1;echo '"..password.."')|"
cmd = cmd .. "passwd '"..username.."' >/dev/null 2>&1"
return os.execute(cmd)
return os.execute(
"(echo '" .. password .. "'; sleep 1; echo '" .. password .. "') | " ..
"passwd '" .. username .. "' >/dev/null 2>&1"
)
end