feat/TS-5927-long-password-length
This commit is contained in:
parent
2fd8792c7a
commit
36caaf7aab
|
@ -299,7 +299,7 @@ typedef struct SAlterTableMultiStmt {
|
|||
typedef struct SCreateUserStmt {
|
||||
ENodeType type;
|
||||
char userName[TSDB_USER_LEN];
|
||||
char password[TSDB_USET_PASSWORD_LEN];
|
||||
char password[TSDB_USET_PASSWORD_LONGLEN];
|
||||
int8_t sysinfo;
|
||||
int8_t createDb;
|
||||
int8_t isImport;
|
||||
|
@ -313,7 +313,7 @@ typedef struct SAlterUserStmt {
|
|||
ENodeType type;
|
||||
char userName[TSDB_USER_LEN];
|
||||
int8_t alterType;
|
||||
char password[TSDB_USET_PASSWORD_LEN];
|
||||
char password[TSDB_USET_PASSWORD_LONGLEN];
|
||||
int8_t enable;
|
||||
int8_t sysinfo;
|
||||
int8_t createdb;
|
||||
|
|
|
@ -110,7 +110,7 @@ static bool invalidPassword(const char* pPassword) {
|
|||
static bool checkPassword(SAstCreateContext* pCxt, const SToken* pPasswordToken, char* pPassword) {
|
||||
if (NULL == pPasswordToken) {
|
||||
pCxt->errCode = TSDB_CODE_PAR_SYNTAX_ERROR;
|
||||
} else if (pPasswordToken->n >= (TSDB_USET_PASSWORD_LEN + 2)) {
|
||||
} else if (pPasswordToken->n >= (TSDB_USET_PASSWORD_LONGLEN + 2)) {
|
||||
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NAME_OR_PASSWD_TOO_LONG);
|
||||
} else {
|
||||
strncpy(pPassword, pPasswordToken->z, pPasswordToken->n);
|
||||
|
@ -3030,14 +3030,14 @@ _err:
|
|||
SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword, int8_t sysinfo,
|
||||
int8_t createDb, int8_t is_import) {
|
||||
CHECK_PARSER_STATUS(pCxt);
|
||||
char password[TSDB_USET_PASSWORD_LEN + 3] = {0};
|
||||
char password[TSDB_USET_PASSWORD_LONGLEN + 3] = {0};
|
||||
CHECK_NAME(checkUserName(pCxt, pUserName));
|
||||
CHECK_NAME(checkPassword(pCxt, pPassword, password));
|
||||
SCreateUserStmt* pStmt = NULL;
|
||||
pCxt->errCode = nodesMakeNode(QUERY_NODE_CREATE_USER_STMT, (SNode**)&pStmt);
|
||||
CHECK_MAKE_NODE(pStmt);
|
||||
COPY_STRING_FORM_ID_TOKEN(pStmt->userName, pUserName);
|
||||
tstrncpy(pStmt->password, password, TSDB_USET_PASSWORD_LEN);
|
||||
tstrncpy(pStmt->password, password, TSDB_USET_PASSWORD_LONGLEN);
|
||||
pStmt->sysinfo = sysinfo;
|
||||
pStmt->createDb = createDb;
|
||||
pStmt->isImport = is_import;
|
||||
|
@ -3056,10 +3056,10 @@ SNode* createAlterUserStmt(SAstCreateContext* pCxt, SToken* pUserName, int8_t al
|
|||
pStmt->alterType = alterType;
|
||||
switch (alterType) {
|
||||
case TSDB_ALTER_USER_PASSWD: {
|
||||
char password[TSDB_USET_PASSWORD_LEN] = {0};
|
||||
char password[TSDB_USET_PASSWORD_LONGLEN] = {0};
|
||||
SToken* pVal = pAlterInfo;
|
||||
CHECK_NAME(checkPassword(pCxt, pVal, password));
|
||||
tstrncpy(pStmt->password, password, TSDB_USET_PASSWORD_LEN);
|
||||
tstrncpy(pStmt->password, password, TSDB_USET_PASSWORD_LONGLEN);
|
||||
break;
|
||||
}
|
||||
case TSDB_ALTER_USER_ENABLE: {
|
||||
|
|
|
@ -10045,7 +10045,7 @@ static int32_t translateCreateUser(STranslateContext* pCxt, SCreateUserStmt* pSt
|
|||
createReq.superUser = 0;
|
||||
createReq.sysInfo = pStmt->sysinfo;
|
||||
createReq.enable = 1;
|
||||
tstrncpy(createReq.pass, pStmt->password, TSDB_USET_PASSWORD_LEN);
|
||||
tstrncpy(createReq.longPass, pStmt->password, TSDB_USET_PASSWORD_LONGLEN);
|
||||
createReq.isImport = pStmt->isImport;
|
||||
createReq.createDb = pStmt->createDb;
|
||||
|
||||
|
@ -10090,7 +10090,7 @@ static int32_t translateAlterUser(STranslateContext* pCxt, SAlterUserStmt* pStmt
|
|||
alterReq.enable = pStmt->enable;
|
||||
alterReq.sysInfo = pStmt->sysinfo;
|
||||
alterReq.createdb = pStmt->createdb ? 1 : 0;
|
||||
snprintf(alterReq.pass, sizeof(alterReq.pass), "%s", pStmt->password);
|
||||
snprintf(alterReq.longPass, sizeof(alterReq.pass), "%s", pStmt->password);
|
||||
if (NULL != pCxt->pParseCxt->db) {
|
||||
snprintf(alterReq.objname, sizeof(alterReq.objname), "%s", pCxt->pParseCxt->db);
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ sql create user user_p6 pass 'abcd!@123456'
|
|||
sql create user user_p7 pass 'abcd!@1234567'
|
||||
sql create user user_p8 pass 'abcd!@123456789'
|
||||
sql create user user_p9 pass 'abcd!@1234567890'
|
||||
sql_error create user user_p10 pass 'abcd!@1234567890T'
|
||||
sql_error create user user_p10 pass 'abcd!@123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345T'
|
||||
sql drop user user_p2
|
||||
sql drop user user_p3
|
||||
sql drop user user_p4
|
||||
|
|
|
@ -33,7 +33,7 @@ class TDTestCase:
|
|||
self.colname_length_boundary = self.boundary.COL_KEY_MAX_LENGTH
|
||||
self.tagname_length_boundary = self.boundary.TAG_KEY_MAX_LENGTH
|
||||
self.username_length_boundary = 23
|
||||
self.password_length_boundary = 14
|
||||
self.password_length_boundary = 253
|
||||
def dbname_length_check(self):
|
||||
dbname_length = randint(1,self.dbname_length_boundary-1)
|
||||
for dbname in [tdCom.get_long_name(self.dbname_length_boundary),tdCom.get_long_name(dbname_length)]:
|
||||
|
|
Loading…
Reference in New Issue