!2789 修复alter role的core问题

Merge pull request !2789 from pengjiong/fix_date
This commit is contained in:
opengauss-bot
2023-01-10 01:29:51 +00:00
committed by Gitee
3 changed files with 17 additions and 1 deletions

View File

@ -4517,6 +4517,8 @@ static char* mask_Password_internal(const char* query_string)
if (query_string[position[i] + length[i] - 1] == ';') {
length[i]--;
}
curStmtType = 0;
isPassword = false;
}
/*
@ -4546,7 +4548,7 @@ static char* mask_Password_internal(const char* query_string)
char* maskBegin = mask_string + (position[i] - truncateLen);
int copySize = strlen(mask_string) - (position[i] - truncateLen) - length[i] + 1;
if (copySize > 0) {
if ((position[i] - truncateLen) >= 0 && copySize > 0) {
rc = memmove_s(maskBegin + maskLen, copySize, maskBegin + length[i], copySize);
securec_check(rc, "", "");
rc = memset_s(maskBegin, maskLen, '*', maskLen);

View File

@ -18,3 +18,13 @@ ERROR: Permission denied.
reset role;
drop role test_myrole001;
drop role test_myrole002;
alter user u1 identified by aswd3456 replace dfg1637484kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkklll;
ERROR: Password must be quoted
alter user u1 ACCOUNT LOCK PASSWORD EXPIRE NEVER PASSWORD EXPIRE NEVER ACCOUNT UNLOCK ACCOUNT UNLOCK ACCOUNT UNLOCK ACCOUNT UNLOCK;
ERROR: syntax error at or near "PASSWORD"
LINE 1: alter user u1 ACCOUNT LOCK PASSWORD EXPIRE NEVER ...
^
alter user u1 lock password expir never lock password expire never lock password expire never lock;
ERROR: syntax error at or near "lock"
LINE 1: alter user u1 lock password expir never lock password expire...
^

View File

@ -18,3 +18,7 @@ alter role test_myrole002 rename to temp_myrole;
reset role;
drop role test_myrole001;
drop role test_myrole002;
alter user u1 identified by aswd3456 replace dfg1637484kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkklll;
alter user u1 ACCOUNT LOCK PASSWORD EXPIRE NEVER PASSWORD EXPIRE NEVER ACCOUNT UNLOCK ACCOUNT UNLOCK ACCOUNT UNLOCK ACCOUNT UNLOCK;
alter user u1 lock password expir never lock password expire never lock password expire never lock;