From 6576ff9a0569d7013c3483960e360046d90e519f Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 12 Oct 2008 00:13:50 +0000 Subject: [PATCH] * luci-0.8: backport password authentication fixes --- libs/sys/luasrc/sys.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libs/sys/luasrc/sys.lua b/libs/sys/luasrc/sys.lua index bd072ee698..56c1384aef 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. -- 2.30.2