multiuser_utils: Fixed verifying empty password.

* verify_password() would accept all passwords if the there was
  none set, instead of accepting only an empty password.
This commit is contained in:
Axel Dörfler 2015-06-25 17:47:27 +02:00
parent e0fc09b439
commit cb82874e92

View File

@ -103,8 +103,12 @@ verify_password(passwd* passwd, spwd* spwd, const char* plainPassword)
}
// If no password is required, we're done.
if (requiredPassword == NULL || strlen(requiredPassword) == 0)
return true;
if (requiredPassword == NULL || requiredPassword[0] == '\0') {
if (plainPassword == NULL || plainPassword[0] == '\0')
return true;
return false;
}
// crypt and check it
char* encryptedPassword = crypt(plainPassword, requiredPassword);