projects
/
project
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8e437b3
)
Work around OpenWRT / Busybox shadow password quirks
author
Steven Barth
<steven@midlink.org>
Mon, 29 Sep 2008 22:12:56 +0000
(22:12 +0000)
committer
Steven Barth
<steven@midlink.org>
Mon, 29 Sep 2008 22:12:56 +0000
(22:12 +0000)
libs/sys/luasrc/sys.lua
patch
|
blob
|
history
diff --git
a/libs/sys/luasrc/sys.lua
b/libs/sys/luasrc/sys.lua
index
4bf2946
..
0bf92e9
100644
(file)
--- 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 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
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
break
end
end
- if not pwd then
- return nil, "No shadow password for " .. username
+
+ if pwd == "!" then
+ return true
end
end
end
end