Do not allow creation of users with empty passwords

Offering: openGaussDev

More detail: Do not allow creation of users with empty passwords

Match-id-8cb0a708be3c4115ad5e7ac3584d3cdd83ec7b1e
This commit is contained in:
openGaussDev 2022-03-07 21:58:03 +08:00 committed by yanghao
parent 06e43a8f9b
commit dedd14af5e
1 changed files with 3 additions and 0 deletions

View File

@ -6052,6 +6052,9 @@ static Datum gs_calculate_encrypted_sm3_password(const char* password, const cha
Datum calculate_encrypted_password(bool is_encrypted, const char* password, const char* rolname,
const char* salt_string)
{
if (password == NULL || password[0] == '\0') {
ereport(ERROR, (errcode(ERRCODE_INVALID_PASSWORD), errmsg("The password could not be NULL.")));
}
errno_t rc = EOK;
char encrypted_md5_password[MD5_PASSWD_LEN + 1] = {0};
Datum datum_value;