diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index cd0ad6fff1c963f9ce5ca25eeae911aa98e6737e..d875a056aac614df42b8ed6321d3980b717cdf22 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -368,7 +368,7 @@ static int32_t handlePassword(SSqlCmd* pCmd, SStrToken* pPwd) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); } - if (pPwd->n > TSDB_PASS_LEN - 1) { + if (pPwd->n >= TSDB_PASS_LEN) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); } diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index a025829343e6efeaedcb692eb9452743ea4cbf1c..7280efe1fafe37aef368526376bc53bb0e2364fb 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -64,7 +64,7 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa } SRpcCorEpSet corMgmtEpSet; - char secretEncrypt[TSDB_PASS_LEN] = {0}; + char secretEncrypt[32] = {0}; int secretEncryptLen = 0; if (auth == NULL) { if (!validPassword(pass)) { diff --git a/src/inc/taosdef.h b/src/inc/taosdef.h index 8f262252b05e0539ceed0b31b8598e249f9a68c6..6254299fc4783343b2c202cd4251adf8aecd9db0 100644 --- a/src/inc/taosdef.h +++ b/src/inc/taosdef.h @@ -86,9 +86,9 @@ extern const int32_t TYPE_BYTES[16]; #define TSDB_DEFAULT_USER "root" #define TSDB_DEFAULT_PASS "taosdata" -#define TSDB_PASS_LEN 129 +#define TSDB_PASS_LEN 16 -#define SHELL_MAX_PASSWORD_LEN TSDB_PASS_LEN +#define SHELL_MAX_PASSWORD_LEN 20 #define TSDB_TRUE 1 #define TSDB_FALSE 0 #define TSDB_OK 0 diff --git a/src/kit/shell/src/shellDarwin.c b/src/kit/shell/src/shellDarwin.c index 70f372682e924875e8e8cb06ee2f7fc46dd732b6..97cca273f78b9f2b76e695a6a042a56c09b9a750 100644 --- a/src/kit/shell/src/shellDarwin.c +++ b/src/kit/shell/src/shellDarwin.c @@ -89,7 +89,7 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) { || (strncmp(argv[i], "--password", 10) == 0)) { printf("Enter password: "); taosSetConsoleEcho(false); - if (scanf("%128s", g_password) > 1) { + if (scanf("%s", g_password) > 1) { fprintf(stderr, "password read error\n"); } taosSetConsoleEcho(true); diff --git a/src/kit/shell/src/shellLinux.c b/src/kit/shell/src/shellLinux.c index 28a9985d7642e8e30e10ccea0af178b44bbb65a7..e529d829e97a4329d4ebe2eb3fc2082d718d163f 100644 --- a/src/kit/shell/src/shellLinux.c +++ b/src/kit/shell/src/shellLinux.c @@ -194,7 +194,7 @@ static void parse_args( || (strncmp(argv[i], "--password", 10) == 0)) { printf("Enter password: "); taosSetConsoleEcho(false); - if (scanf("%128s", g_password) > 1) { + if (scanf("%s", g_password) > 1) { fprintf(stderr, "password reading error\n"); } taosSetConsoleEcho(true); diff --git a/src/kit/shell/src/shellWindows.c b/src/kit/shell/src/shellWindows.c index dd2f85a3d3480479006ddd7b8ebe78073186e8a5..f3f6c2b2e6ddd67b08114958e062ec6c18a3d272 100644 --- a/src/kit/shell/src/shellWindows.c +++ b/src/kit/shell/src/shellWindows.c @@ -93,7 +93,7 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) { || (strncmp(argv[i], "--password", 10) == 0)) { printf("Enter password: "); taosSetConsoleEcho(false); - if (scanf("%128s", g_password) > 1) { + if (scanf("%s", g_password) > 1) { fprintf(stderr, "password read error!\n"); } taosSetConsoleEcho(true); diff --git a/src/mnode/src/mnodeDnode.c b/src/mnode/src/mnodeDnode.c index 80b8be7d833def37090f5fd54f7c73c2c6768b5c..37732cbbb394f0d473495cc7f46f71e8438be78c 100644 --- a/src/mnode/src/mnodeDnode.c +++ b/src/mnode/src/mnodeDnode.c @@ -548,7 +548,7 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) { pStatus->numOfCores = htons(pStatus->numOfCores); uint32_t _version = htonl(pStatus->version); - if (_version != tsVersion >> 8) { + if ((_version >> 16) != (tsVersion >> 24)) { pDnode = mnodeGetDnodeByEp(pStatus->dnodeEp); if (pDnode != NULL && pDnode->status != TAOS_DN_STATUS_READY) { pDnode->offlineReason = TAOS_DN_OFF_VERSION_NOT_MATCH; diff --git a/tests/pytest/account/account_create.py b/tests/pytest/account/account_create.py index 44745939d3e4ced77786512bcc93f77d85ad7545..c008acccd8d8d33af0ca77bd161d4ab020c1543e 100644 --- a/tests/pytest/account/account_create.py +++ b/tests/pytest/account/account_create.py @@ -33,9 +33,7 @@ class TDTestCase: tdSql.error("create user tdenginetdenginetdengine PASS 'test' ") - tdSql.execute("create user tdenginet PASS '1234512345123456' ") - - tdSql.error("create user tenginet PASS 'abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890' ") + tdSql.error("create user tdenginet PASS '1234512345123456' ") try: tdSql.execute("create account a&cc PASS 'pass123'") diff --git a/tests/script/general/user/pass_len.sim b/tests/script/general/user/pass_len.sim index d774c3fe291d473a58df211a90de5550bbaef89e..d6a011470a8eee4188e4aff1cec2786e3058e66d 100644 --- a/tests/script/general/user/pass_len.sim +++ b/tests/script/general/user/pass_len.sim @@ -59,7 +59,7 @@ endi print =============== step4 $i = 3 $user = $userPrefix . $i -sql create user $user PASS 'abcd123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890excess' -x step4 +sql create user $user PASS 'abcd012345678901234567891234567890' -x step4 return -1 step4: sql show users diff --git a/tests/script/unique/account/pass_len.sim b/tests/script/unique/account/pass_len.sim index efb0102aea6f04556e1112785c7bd69c2e31442c..d6731c7e48282e3320cd4a2dbf2c9d90fe46d875 100644 --- a/tests/script/unique/account/pass_len.sim +++ b/tests/script/unique/account/pass_len.sim @@ -58,7 +58,7 @@ endi print =============== step4 $i = 3 $user = $userPrefix . $i -sql create user $user PASS 'abcd0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890excess' -x step4 +sql create user $user PASS 'abcd012345678901234567891234567890' -x step4 return -1 step4: sql show users