diff --git a/.gitignore b/.gitignore index ff27b53139..cd1cac4a6d 100644 --- a/.gitignore +++ b/.gitignore @@ -51,7 +51,6 @@ pysim/ tests/script/api/batchprepare taosadapter taosadapter-debug -tools/taos-tools/* tools/taosws-rs/* tools/taosadapter/* tools/upx* @@ -140,7 +139,6 @@ tags *CMakeCache* *CMakeFiles* .history/ -*.txt *.tcl *.pc contrib/geos diff --git a/tests/army/cmdline/data/pwdMax.txt b/tests/army/cmdline/data/pwdMax.txt new file mode 100644 index 0000000000..333b793fe8 --- /dev/null +++ b/tests/army/cmdline/data/pwdMax.txt @@ -0,0 +1 @@ +abcdefghigklmnopqrstuvwxyz@ABCDEFGHIGKLMNOPQRSTUVWXYZ123456789!@#$%^&*()-_+=[]{}:;> 1) { + if (scanf("%255s", shell.args.password) > 1) { fprintf(stderr, "password reading error\n"); } taosSetConsoleEcho(true); diff --git a/tools/taos-tools/inc/bench.h b/tools/taos-tools/inc/bench.h index dfb543cb89..b432e20113 100644 --- a/tools/taos-tools/inc/bench.h +++ b/tools/taos-tools/inc/bench.h @@ -152,7 +152,7 @@ typedef unsigned __int32 uint32_t; #define MAX_JSON_BUFF 6400000 -#define INPUT_BUF_LEN 256 +#define INPUT_BUF_LEN 512 #define EXTRA_SQL_LEN 256 #define DATATYPE_BUFF_LEN (TINY_BUFF_LEN * 3) #define SML_MAX_BATCH 65536 * 32 diff --git a/tools/taos-tools/inc/dump.h b/tools/taos-tools/inc/dump.h index b21dca4343..9a30ebb9cd 100644 --- a/tools/taos-tools/inc/dump.h +++ b/tools/taos-tools/inc/dump.h @@ -58,6 +58,7 @@ #define NEED_CALC_COUNT UINT64_MAX #define HUMAN_TIME_LEN 28 #define DUMP_DIR_LEN (MAX_DIR_LEN - (TSDB_DB_NAME_LEN + 10)) +#define TSDB_USET_PASSWORD_LONGLEN 256 // come from tdef.h #define debugPrint(fmt, ...) \ @@ -336,7 +337,7 @@ typedef struct arguments { // connection option char *host; char *user; - char password[SHELL_MAX_PASSWORD_LEN]; + char password[TSDB_USET_PASSWORD_LONGLEN]; uint16_t port; // strlen(taosdump.) +1 is 10 char outpath[DUMP_DIR_LEN]; diff --git a/tools/taos-tools/inc/toolsdef.h b/tools/taos-tools/inc/toolsdef.h index ed17380251..cf982a773e 100644 --- a/tools/taos-tools/inc/toolsdef.h +++ b/tools/taos-tools/inc/toolsdef.h @@ -76,9 +76,6 @@ extern "C" { #define TSDB_DEFAULT_USER "root" #define TSDB_DEFAULT_PASS "taosdata" -#define TSDB_PASS_LEN 129 -#define SHELL_MAX_PASSWORD_LEN TSDB_PASS_LEN - #define TSDB_TIME_PRECISION_MILLI 0 #define TSDB_TIME_PRECISION_MICRO 1 #define TSDB_TIME_PRECISION_NANO 2 diff --git a/tools/taos-tools/src/taosdump.c b/tools/taos-tools/src/taosdump.c index 35fae99c6a..0d4369d71c 100644 --- a/tools/taos-tools/src/taosdump.c +++ b/tools/taos-tools/src/taosdump.c @@ -778,14 +778,13 @@ static void parse_args( || (strncmp(argv[i], "--password", 10) == 0)) { printf("Enter password: "); setConsoleEcho(false); - if (scanf("%20s", arguments->password) > 1) { + if (scanf("%255s", arguments->password) > 1) { errorPrint("%s() LN%d, password read error!\n", __func__, __LINE__); } setConsoleEcho(true); } else { - tstrncpy(arguments->password, (char *)(argv[i] + 2), - SHELL_MAX_PASSWORD_LEN); + strcpy(arguments->password, (char *)(argv[i] + 2)); strcpy(argv[i], "-p"); } } else if (strcmp(argv[i], "-n") == 0) {