diff options
author | Steven Barth <steven@midlink.org> | 2008-09-29 22:12:56 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-09-29 22:12:56 +0000 |
commit | 8138c8475d9573b834ca8dcba1b8f37647d61212 (patch) | |
tree | aa43ca7a5abef013b5c393b2f0f50a3a887f9b36 /libs | |
parent | 8e437b3125b7d55babc99901f3cfca85357b2546 (diff) |
Work around OpenWRT / Busybox shadow password quirks
Diffstat (limited to 'libs')
-rw-r--r-- | libs/sys/luasrc/sys.lua | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libs/sys/luasrc/sys.lua b/libs/sys/luasrc/sys.lua index 4bf294678..0bf92e9da 100644 --- a/libs/sys/luasrc/sys.lua +++ b/libs/sys/luasrc/sys.lua @@ -438,18 +438,18 @@ function user.checkpasswd(username, password) if account then local pwd = account.passwd - if pwd == "!" then - return true - elseif pwd == "x" then - pwd = nil + local shadowpw + if #pwd == 1 then for l in io.lines("/etc/shadow") do - pwd = l:match("^%s:([^:]+)" % username) - if pwd then + shadowpw = l:match("^%s:([^:]+)" % username) + if shadowpw then + pwd = shadowpw break end end - if not pwd then - return nil, "No shadow password for " .. username + + if pwd == "!" then + return true end end |