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:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user