From 60500e376a85653a1417d8597cfb74ff147960d7 Mon Sep 17 00:00:00 2001 From: sin Date: Mon, 9 Jun 2014 13:03:19 +0100 Subject: [PATCH] Print "incorrect password" when checking empty passwords as well --- util/passwd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/util/passwd.c b/util/passwd.c index d428b7e..a285cb4 100644 --- a/util/passwd.c +++ b/util/passwd.c @@ -24,8 +24,12 @@ pw_check(struct passwd *pw, const char *pass) return -1; } - if (pw->pw_passwd[0] == '\0') - return pass[0] == '\0' ? 1 : 0; + if (pw->pw_passwd[0] == '\0') { + if (pass[0] == '\0') + return 1; + weprintf("incorrect password\n"); + return 0; + } if (pw->pw_passwd[0] == 'x' && pw->pw_passwd[1] == '\0') { errno = 0;