luci-0.10: merge r6789
This commit is contained in:
parent
e558edee0b
commit
b563a74360
1 changed files with 6 additions and 5 deletions
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue