projects
/
oweals
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4054025
)
Added support for shadow passwords
author
Steven Barth
<steven@midlink.org>
Mon, 29 Sep 2008 16:02:54 +0000
(16:02 +0000)
committer
Steven Barth
<steven@midlink.org>
Mon, 29 Sep 2008 16:02:54 +0000
(16:02 +0000)
libs/sys/luasrc/sys.lua
patch
|
blob
|
history
diff --git
a/libs/sys/luasrc/sys.lua
b/libs/sys/luasrc/sys.lua
index b3155c8c8542c8fbda06b8acf4049c3d616ccf18..4bf294678825a5ab5aa0554b2af945fe1ffd5124 100644
(file)
--- a/
libs/sys/luasrc/sys.lua
+++ b/
libs/sys/luasrc/sys.lua
@@
-437,11
+437,23
@@
function user.checkpasswd(username, password)
local account = user.getuser(username)
if account then
local account = user.getuser(username)
if account then
- if account.passwd == "!" then
+ local pwd = account.passwd
+ if pwd == "!" then
return true
return true
- else
- return (account.passwd == posix.crypt(password, account.passwd))
+ elseif pwd == "x" then
+ pwd = nil
+ for l in io.lines("/etc/shadow") do
+ pwd = l:match("^%s:([^:]+)" % username)
+ if pwd then
+ break
+ end
+ end
+ if not pwd then
+ return nil, "No shadow password for " .. username
+ end
end
end
+
+ return (pwd == posix.crypt(password, pwd))
end
end
end
end