summaryrefslogtreecommitdiffhomepage
path: root/libs/sys/luasrc/sys.lua
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2008-10-12 00:12:21 +0000
committerJo-Philipp Wich <jow@openwrt.org>2008-10-12 00:12:21 +0000
commit6d3d30d88f2018ea1cc16b73d4ada329f541fc8f (patch)
tree22174d17ada6c1bd23d26f65349a9db97e03e162 /libs/sys/luasrc/sys.lua
parentdfd272dc1d9a5ec375e7e24b98ecd6c34813e503 (diff)
* luci/libs/sys: fix password authentication for users with disabled password and shadow environments
Diffstat (limited to 'libs/sys/luasrc/sys.lua')
-rw-r--r--libs/sys/luasrc/sys.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/libs/sys/luasrc/sys.lua b/libs/sys/luasrc/sys.lua
index 0e4a3543f5..c271dee86b 100644
--- a/libs/sys/luasrc/sys.lua
+++ b/libs/sys/luasrc/sys.lua
@@ -35,7 +35,7 @@ luci.util = require "luci.util"
luci.fs = require "luci.fs"
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.
@@ -491,8 +491,12 @@ function user.checkpasswd(username, password)
end
end
- return (pwd == posix.crypt(password, pwd))
+ if pwd and #pwd > 0 and password and #password > 0 then
+ return (pwd == posix.crypt(password, pwd))
+ end
end
+
+ return false
end
--- Change the password of given user.