提交 fd2058d7 编写于 作者: X xywang

[TS-229]<feature>: removed config and set the max len for password to 128

上级 41a8c764
...@@ -366,7 +366,7 @@ static int32_t handlePassword(SSqlCmd* pCmd, SStrToken* pPwd) { ...@@ -366,7 +366,7 @@ static int32_t handlePassword(SSqlCmd* pCmd, SStrToken* pPwd) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1);
} }
if (pPwd->n > tsPasswordLength) { if (pPwd->n > TSDB_PASS_LEN - 1) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2);
} }
......
...@@ -49,7 +49,7 @@ static bool validUserName(const char* user) { ...@@ -49,7 +49,7 @@ static bool validUserName(const char* user) {
} }
static bool validPassword(const char* passwd) { static bool validPassword(const char* passwd) {
return validImpl(passwd, tsPasswordLength); return validImpl(passwd, TSDB_PASS_LEN - 1);
} }
static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pass, const char *auth, const char *db, static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pass, const char *auth, const char *db,
......
...@@ -159,9 +159,6 @@ extern int32_t tsMonitorInterval; ...@@ -159,9 +159,6 @@ extern int32_t tsMonitorInterval;
// stream // stream
extern int8_t tsEnableStream; extern int8_t tsEnableStream;
// password
extern int32_t tsPasswordLength;
// internal // internal
extern int8_t tsCompactMnodeWal; extern int8_t tsCompactMnodeWal;
extern int8_t tsPrintAuth; extern int8_t tsPrintAuth;
......
...@@ -204,9 +204,6 @@ int32_t tsMonitorInterval = 30; // seconds ...@@ -204,9 +204,6 @@ int32_t tsMonitorInterval = 30; // seconds
// stream // stream
int8_t tsEnableStream = 1; int8_t tsEnableStream = 1;
// password
int32_t tsPasswordLength = TSDB_PASS_LEN - 1;
// internal // internal
int8_t tsCompactMnodeWal = 0; int8_t tsCompactMnodeWal = 0;
int8_t tsPrintAuth = 0; int8_t tsPrintAuth = 0;
...@@ -1305,16 +1302,6 @@ static void doInitGlobalConfig(void) { ...@@ -1305,16 +1302,6 @@ static void doInitGlobalConfig(void) {
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosInitConfigOption(cfg);
cfg.option = "passwordLength";
cfg.ptr = &tsPasswordLength;
cfg.valType = TAOS_CFG_VTYPE_INT32;
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW;
cfg.minValue = 1;
cfg.maxValue = TSDB_PASS_LEN - 1;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg);
cfg.option = "topicBinaryLen"; cfg.option = "topicBinaryLen";
cfg.ptr = &tsTopicBianryLen; cfg.ptr = &tsTopicBianryLen;
cfg.valType = TAOS_CFG_VTYPE_INT32; cfg.valType = TAOS_CFG_VTYPE_INT32;
......
...@@ -86,7 +86,7 @@ extern const int32_t TYPE_BYTES[16]; ...@@ -86,7 +86,7 @@ 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 33 #define TSDB_PASS_LEN 128
#define SHELL_MAX_PASSWORD_LEN TSDB_PASS_LEN #define SHELL_MAX_PASSWORD_LEN TSDB_PASS_LEN
#define TSDB_TRUE 1 #define TSDB_TRUE 1
......
...@@ -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("%s", g_password) > 1) { if (scanf("%128s", 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("%32s", g_password) > 1) { if (scanf("%128s", 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("%s", g_password) > 1) { if (scanf("%128s", 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.
先完成此消息的编辑!
想要评论请 注册