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-07-22 20:43:17 +02:00
parent e0fc09b439
commit cb82874e92
+6 -2
View File
@@ -103,8 +103,12 @@ verify_password(passwd* passwd, spwd* spwd, const char* plainPassword)
} }
// If no password is required, we're done. // If no password is required, we're done.
if (requiredPassword == NULL || strlen(requiredPassword) == 0) if (requiredPassword == NULL || requiredPassword[0] == '\0') {
return true; if (plainPassword == NULL || plainPassword[0] == '\0')
return true;
return false;
}
// crypt and check it // crypt and check it
char* encryptedPassword = crypt(plainPassword, requiredPassword); char* encryptedPassword = crypt(plainPassword, requiredPassword);