From: Jo-Philipp Wich Date: Wed, 27 Jun 2012 13:52:09 +0000 (+0000) Subject: libs/sys: fix luci.sys.checkpasswd() semantics X-Git-Tag: 0.11.0~565 X-Git-Url: https://git.archive.openwrt.org/?a=commitdiff_plain;ds=sidebyside;h=b1617b3718c3819a4eeeef5db62b9e05ffc96812;p=project%2Fluci.git libs/sys: fix luci.sys.checkpasswd() semantics --- diff --git a/libs/sys/luasrc/sys.lua b/libs/sys/luasrc/sys.lua index 54f7f2b1a..18c79119f 100644 --- a/libs/sys/luasrc/sys.lua +++ b/libs/sys/luasrc/sys.lua @@ -612,11 +612,10 @@ end -- @return Boolean indicating wheather the passwords are equal function user.checkpasswd(username, pass) local pwh = user.getpasswd(username) - if pwh and nixio.crypt(pass, pwh) ~= pwh then - return false - else - return true + if pwh then + return (nixio.crypt(pass, pwh) == pwh) end + return false end --- Change the password of given user.