未验证 提交 b9b38df3 编写于 作者: M Minglei Jin 提交者: GitHub

Merge pull request #12871 from taosdata/fix/TS-1550

fix(query): reverted the max length of secret
...@@ -368,7 +368,7 @@ static int32_t handlePassword(SSqlCmd* pCmd, SStrToken* pPwd) { ...@@ -368,7 +368,7 @@ static int32_t handlePassword(SSqlCmd* pCmd, SStrToken* pPwd) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1);
} }
if (pPwd->n > TSDB_PASS_LEN - 1) { if (pPwd->n >= TSDB_PASS_LEN) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2);
} }
......
...@@ -64,7 +64,7 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa ...@@ -64,7 +64,7 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa
} }
SRpcCorEpSet corMgmtEpSet; SRpcCorEpSet corMgmtEpSet;
char secretEncrypt[TSDB_PASS_LEN] = {0}; char secretEncrypt[32] = {0};
int secretEncryptLen = 0; int secretEncryptLen = 0;
if (auth == NULL) { if (auth == NULL) {
if (!validPassword(pass)) { if (!validPassword(pass)) {
......
...@@ -86,9 +86,9 @@ extern const int32_t TYPE_BYTES[16]; ...@@ -86,9 +86,9 @@ extern const int32_t TYPE_BYTES[16];
#define TSDB_DEFAULT_USER "root" #define TSDB_DEFAULT_USER "root"
#define TSDB_DEFAULT_PASS "taosdata" #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_TRUE 1
#define TSDB_FALSE 0 #define TSDB_FALSE 0
#define TSDB_OK 0 #define TSDB_OK 0
......
...@@ -89,7 +89,7 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) { ...@@ -89,7 +89,7 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
|| (strncmp(argv[i], "--password", 10) == 0)) { || (strncmp(argv[i], "--password", 10) == 0)) {
printf("Enter password: "); printf("Enter password: ");
taosSetConsoleEcho(false); taosSetConsoleEcho(false);
if (scanf("%128s", g_password) > 1) { if (scanf("%s", g_password) > 1) {
fprintf(stderr, "password read error\n"); fprintf(stderr, "password read error\n");
} }
taosSetConsoleEcho(true); taosSetConsoleEcho(true);
......
...@@ -194,7 +194,7 @@ static void parse_args( ...@@ -194,7 +194,7 @@ static void parse_args(
|| (strncmp(argv[i], "--password", 10) == 0)) { || (strncmp(argv[i], "--password", 10) == 0)) {
printf("Enter password: "); printf("Enter password: ");
taosSetConsoleEcho(false); taosSetConsoleEcho(false);
if (scanf("%128s", g_password) > 1) { if (scanf("%s", g_password) > 1) {
fprintf(stderr, "password reading error\n"); fprintf(stderr, "password reading error\n");
} }
taosSetConsoleEcho(true); taosSetConsoleEcho(true);
......
...@@ -93,7 +93,7 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) { ...@@ -93,7 +93,7 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
|| (strncmp(argv[i], "--password", 10) == 0)) { || (strncmp(argv[i], "--password", 10) == 0)) {
printf("Enter password: "); printf("Enter password: ");
taosSetConsoleEcho(false); taosSetConsoleEcho(false);
if (scanf("%128s", g_password) > 1) { if (scanf("%s", g_password) > 1) {
fprintf(stderr, "password read error!\n"); fprintf(stderr, "password read error!\n");
} }
taosSetConsoleEcho(true); taosSetConsoleEcho(true);
......
...@@ -548,7 +548,7 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) { ...@@ -548,7 +548,7 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
pStatus->numOfCores = htons(pStatus->numOfCores); pStatus->numOfCores = htons(pStatus->numOfCores);
uint32_t _version = htonl(pStatus->version); uint32_t _version = htonl(pStatus->version);
if (_version != tsVersion >> 8) { if ((_version >> 16) != (tsVersion >> 24)) {
pDnode = mnodeGetDnodeByEp(pStatus->dnodeEp); pDnode = mnodeGetDnodeByEp(pStatus->dnodeEp);
if (pDnode != NULL && pDnode->status != TAOS_DN_STATUS_READY) { if (pDnode != NULL && pDnode->status != TAOS_DN_STATUS_READY) {
pDnode->offlineReason = TAOS_DN_OFF_VERSION_NOT_MATCH; pDnode->offlineReason = TAOS_DN_OFF_VERSION_NOT_MATCH;
......
...@@ -33,9 +33,7 @@ class TDTestCase: ...@@ -33,9 +33,7 @@ class TDTestCase:
tdSql.error("create user tdenginetdenginetdengine PASS 'test' ") tdSql.error("create user tdenginetdenginetdengine PASS 'test' ")
tdSql.execute("create user tdenginet PASS '1234512345123456' ") tdSql.error("create user tdenginet PASS '1234512345123456' ")
tdSql.error("create user tenginet PASS 'abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890' ")
try: try:
tdSql.execute("create account a&cc PASS 'pass123'") tdSql.execute("create account a&cc PASS 'pass123'")
......
...@@ -59,7 +59,7 @@ endi ...@@ -59,7 +59,7 @@ endi
print =============== step4 print =============== step4
$i = 3 $i = 3
$user = $userPrefix . $i $user = $userPrefix . $i
sql create user $user PASS 'abcd123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890excess' -x step4 sql create user $user PASS 'abcd012345678901234567891234567890' -x step4
return -1 return -1
step4: step4:
sql show users sql show users
......
...@@ -58,7 +58,7 @@ endi ...@@ -58,7 +58,7 @@ endi
print =============== step4 print =============== step4
$i = 3 $i = 3
$user = $userPrefix . $i $user = $userPrefix . $i
sql create user $user PASS 'abcd0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890excess' -x step4 sql create user $user PASS 'abcd012345678901234567891234567890' -x step4
return -1 return -1
step4: step4:
sql show users sql show users
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册