libs/sys: fix logic fail in luci.sys.user.checkpasswd() (#152)
authorJo-Philipp Wich <jow@openwrt.org>
Fri, 5 Nov 2010 22:05:11 +0000 (22:05 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Fri, 5 Nov 2010 22:05:11 +0000 (22:05 +0000)
libs/sys/luasrc/sys.lua

index 6d000ae6e279bfba91846f58c526bb1bed87bdc1..d4242a3331f88680991b84f4ea954de6cb70d49b 100644 (file)
@@ -604,7 +604,7 @@ end
 -- @return                     Boolean indicating wheather the passwords are equal
 function user.checkpasswd(username, pass)
        local pwh = user.getpasswd(username)
-       if not pwh or nixio.crypt(pass, pwh) ~= pwh then
+       if pwh and nixio.crypt(pass, pwh) ~= pwh then
                return false
        else
                return true