提交 adf73e97 编写于 作者: X xywang

fix(query): reverted the max length of secret

上级 d15780fb
...@@ -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);
......
...@@ -186,7 +186,7 @@ static void parse_args( ...@@ -186,7 +186,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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册