]> granicus.if.org Git - pwauth/commitdiff
Handle locked user accounts
authorSergio Ruiz <sejoruiz@gmail.com>
Wed, 10 May 2017 11:55:46 +0000 (13:55 +0200)
committersgtio <sejoruiz@gmail.com>
Wed, 10 May 2017 12:43:24 +0000 (14:43 +0200)
Prevent pwauth from crashing when logging into a locked account

pwauth/auth_sun.c

index fc3c3e8b94987f308a911ae6b6397b9c57cd902f..461d1bb18c0d017d40b2ad5ea8eb1e2a68814b1f 100644 (file)
@@ -84,7 +84,7 @@ int check_auth(char *login, char *passwd)
 #else
     cpass= crypt(passwd, spwd->sp_pwdp);
 #endif
-    if (strcmp(cpass, spwd->sp_pwdp)) return STATUS_INVALID;
+    if (!cpass || strcmp(cpass, spwd->sp_pwdp)) return STATUS_INVALID;
 #ifdef CHECK_LOGIN_EXPIRATION
     if (spwd->sp_expire >= 0 && spwd->sp_expire < today)
        return STATUS_EXPIRED;