feat/TS-5927-long-password-fix-cases
This commit is contained in:
parent
58b7a6fe97
commit
80f60449e3
|
@ -10093,8 +10093,11 @@ static int32_t translateAlterUser(STranslateContext* pCxt, SAlterUserStmt* pStmt
|
||||||
alterReq.sysInfo = pStmt->sysinfo;
|
alterReq.sysInfo = pStmt->sysinfo;
|
||||||
alterReq.createdb = pStmt->createdb ? 1 : 0;
|
alterReq.createdb = pStmt->createdb ? 1 : 0;
|
||||||
|
|
||||||
taosEncryptPass_c((uint8_t*)pStmt->password, strlen(pStmt->password), alterReq.pass);
|
int32_t len = strlen(pStmt->password);
|
||||||
alterReq.passIsMd5 = 1;
|
if (len > 0) {
|
||||||
|
taosEncryptPass_c((uint8_t*)pStmt->password, len, alterReq.pass);
|
||||||
|
alterReq.passIsMd5 = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (NULL != pCxt->pParseCxt->db) {
|
if (NULL != pCxt->pParseCxt->db) {
|
||||||
snprintf(alterReq.objname, sizeof(alterReq.objname), "%s", pCxt->pParseCxt->db);
|
snprintf(alterReq.objname, sizeof(alterReq.objname), "%s", pCxt->pParseCxt->db);
|
||||||
|
|
|
@ -817,7 +817,7 @@ TEST_F(ParserInitialATest, alterUser) {
|
||||||
expect.sysInfo = sysInfo;
|
expect.sysInfo = sysInfo;
|
||||||
expect.enable = enable;
|
expect.enable = enable;
|
||||||
if (nullptr != pPass) {
|
if (nullptr != pPass) {
|
||||||
strcpy(expect.pass, pPass);
|
taosEncryptPass_c((uint8_t*)pPass, strlen(pPass), expect.pass);
|
||||||
}
|
}
|
||||||
strcpy(expect.objname, "test");
|
strcpy(expect.objname, "test");
|
||||||
};
|
};
|
||||||
|
@ -838,8 +838,8 @@ TEST_F(ParserInitialATest, alterUser) {
|
||||||
tFreeSAlterUserReq(&req);
|
tFreeSAlterUserReq(&req);
|
||||||
});
|
});
|
||||||
|
|
||||||
setAlterUserReq("wxy", TSDB_ALTER_USER_PASSWD, "123456");
|
setAlterUserReq("wxy", TSDB_ALTER_USER_PASSWD, "12345678@Abc");
|
||||||
run("ALTER USER wxy PASS '123456'");
|
run("ALTER USER wxy PASS '12345678@Abc'");
|
||||||
clearAlterUserReq();
|
clearAlterUserReq();
|
||||||
|
|
||||||
setAlterUserReq("wxy", TSDB_ALTER_USER_ENABLE, nullptr, 0, 1);
|
setAlterUserReq("wxy", TSDB_ALTER_USER_ENABLE, nullptr, 0, 1);
|
||||||
|
|
|
@ -1345,11 +1345,11 @@ TEST_F(ParserInitialCTest, createUser) {
|
||||||
|
|
||||||
auto setCreateUserReq = [&](const char* pUser, const char* pPass, int8_t sysInfo = 1) {
|
auto setCreateUserReq = [&](const char* pUser, const char* pPass, int8_t sysInfo = 1) {
|
||||||
strcpy(expect.user, pUser);
|
strcpy(expect.user, pUser);
|
||||||
strcpy(expect.pass, pPass);
|
|
||||||
expect.createType = 0;
|
expect.createType = 0;
|
||||||
expect.superUser = 0;
|
expect.superUser = 0;
|
||||||
expect.sysInfo = sysInfo;
|
expect.sysInfo = sysInfo;
|
||||||
expect.enable = 1;
|
expect.enable = 1;
|
||||||
|
taosEncryptPass_c((uint8_t*)pPass, strlen(pPass), expect.pass);
|
||||||
};
|
};
|
||||||
|
|
||||||
setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) {
|
setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) {
|
||||||
|
@ -1366,12 +1366,12 @@ TEST_F(ParserInitialCTest, createUser) {
|
||||||
tFreeSCreateUserReq(&req);
|
tFreeSCreateUserReq(&req);
|
||||||
});
|
});
|
||||||
|
|
||||||
setCreateUserReq("wxy", "123456");
|
setCreateUserReq("wxy", "12345678@Abc");
|
||||||
run("CREATE USER wxy PASS '123456'");
|
run("CREATE USER wxy PASS '12345678@Abc'");
|
||||||
clearCreateUserReq();
|
clearCreateUserReq();
|
||||||
|
|
||||||
setCreateUserReq("wxy1", "a123456", 1);
|
setCreateUserReq("wxy1", "12345678@Abc", 1);
|
||||||
run("CREATE USER wxy1 PASS 'a123456' SYSINFO 1");
|
run("CREATE USER wxy1 PASS '12345678@Abc' SYSINFO 1");
|
||||||
clearCreateUserReq();
|
clearCreateUserReq();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue