* luci/libs/sys: fix password authentication for users with disabled password and shadow environments
This commit is contained in:
parent
dfd272dc1d
commit
6d3d30d88f
1 changed files with 6 additions and 2 deletions
|
@ -35,7 +35,7 @@ luci.util = require "luci.util"
|
||||||
luci.fs = require "luci.fs"
|
luci.fs = require "luci.fs"
|
||||||
luci.ip = require "luci.ip"
|
luci.ip = require "luci.ip"
|
||||||
|
|
||||||
local tonumber, ipairs, pairs = tonumber, ipairs, pairs
|
local tonumber, ipairs, pairs, pcall = tonumber, ipairs, pairs, pcall
|
||||||
|
|
||||||
|
|
||||||
--- LuCI Linux and POSIX system utilities.
|
--- LuCI Linux and POSIX system utilities.
|
||||||
|
@ -491,10 +491,14 @@ function user.checkpasswd(username, password)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if pwd and #pwd > 0 and password and #password > 0 then
|
||||||
return (pwd == posix.crypt(password, pwd))
|
return (pwd == posix.crypt(password, pwd))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
--- Change the password of given user.
|
--- Change the password of given user.
|
||||||
-- @param username String containing the Unix user name
|
-- @param username String containing the Unix user name
|
||||||
-- @param password String containing the password to compare
|
-- @param password String containing the password to compare
|
||||||
|
|
Loading…
Reference in a new issue