Work around OpenWRT / Busybox shadow password quirks
This commit is contained in:
parent
8e437b3125
commit
8138c8475d
1 changed files with 8 additions and 8 deletions
|
@ -438,18 +438,18 @@ function user.checkpasswd(username, password)
|
||||||
|
|
||||||
if account then
|
if account then
|
||||||
local pwd = account.passwd
|
local pwd = account.passwd
|
||||||
if pwd == "!" then
|
local shadowpw
|
||||||
return true
|
if #pwd == 1 then
|
||||||
elseif pwd == "x" then
|
|
||||||
pwd = nil
|
|
||||||
for l in io.lines("/etc/shadow") do
|
for l in io.lines("/etc/shadow") do
|
||||||
pwd = l:match("^%s:([^:]+)" % username)
|
shadowpw = l:match("^%s:([^:]+)" % username)
|
||||||
if pwd then
|
if shadowpw then
|
||||||
|
pwd = shadowpw
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not pwd then
|
|
||||||
return nil, "No shadow password for " .. username
|
if pwd == "!" then
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue