Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f882b496
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
f882b496
编写于
2月 22, 2022
作者:
M
Minglei Jin
提交者:
GitHub
2月 22, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #10342 from taosdata/feature/TS-229-D
[TS-229]<feature>: increased the max length for password
上级
60f831e3
c91f06aa
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
44 addition
and
14 deletion
+44
-14
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+1
-1
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+1
-1
src/client/src/tscServer.c
src/client/src/tscServer.c
+17
-1
src/client/src/tscSql.c
src/client/src/tscSql.c
+9
-4
src/inc/taosdef.h
src/inc/taosdef.h
+3
-1
src/inc/taosmsg.h
src/inc/taosmsg.h
+2
-2
src/kit/shell/src/shellDarwin.c
src/kit/shell/src/shellDarwin.c
+1
-1
src/kit/shell/src/shellLinux.c
src/kit/shell/src/shellLinux.c
+1
-1
src/kit/shell/src/shellWindows.c
src/kit/shell/src/shellWindows.c
+1
-1
src/mnode/src/mnodeUser.c
src/mnode/src/mnodeUser.c
+8
-1
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
f882b496
...
...
@@ -330,7 +330,7 @@ typedef struct STscObj {
void
*
signature
;
void
*
pTimer
;
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_
KEY
_LEN
];
char
pass
[
TSDB_
PASS
_LEN
];
char
acctId
[
TSDB_ACCT_ID_LEN
];
char
db
[
TSDB_ACCT_ID_LEN
+
TSDB_DB_NAME_LEN
];
char
sversion
[
TSDB_VERSION_LEN
];
...
...
src/client/src/tscSQLParser.c
浏览文件 @
f882b496
...
...
@@ -366,7 +366,7 @@ static int32_t handlePassword(SSqlCmd* pCmd, SStrToken* pPwd) {
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
if
(
pPwd
->
n
>
=
TSDB_KEY_LEN
)
{
if
(
pPwd
->
n
>
TSDB_PASS_LEN
-
1
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
...
...
src/client/src/tscServer.c
浏览文件 @
f882b496
...
...
@@ -1254,6 +1254,17 @@ int32_t tscBuildCreateDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
return
TSDB_CODE_SUCCESS
;
}
static
bool
tscIsAlterCommand
(
char
*
sqlstr
)
{
int32_t
index
=
0
;
do
{
SStrToken
t0
=
tStrGetToken
(
sqlstr
,
&
index
,
false
);
if
(
t0
.
type
!=
TK_LP
)
{
return
t0
.
type
==
TK_ALTER
;
}
}
while
(
1
);
}
int32_t
tscBuildAcctMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
pCmd
->
payloadLen
=
sizeof
(
SCreateAcctMsg
);
...
...
@@ -1295,7 +1306,12 @@ int32_t tscBuildAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
}
}
pCmd
->
msgType
=
TSDB_MSG_TYPE_CM_CREATE_ACCT
;
if
(
tscIsAlterCommand
(
pSql
->
sqlstr
))
{
pCmd
->
msgType
=
TSDB_MSG_TYPE_CM_ALTER_ACCT
;
}
else
{
pCmd
->
msgType
=
TSDB_MSG_TYPE_CM_CREATE_ACCT
;
}
return
TSDB_CODE_SUCCESS
;
}
...
...
src/client/src/tscSql.c
浏览文件 @
f882b496
...
...
@@ -49,7 +49,7 @@ static bool validUserName(const char* user) {
}
static
bool
validPassword
(
const
char
*
passwd
)
{
return
validImpl
(
passwd
,
TSDB_
KEY
_LEN
-
1
);
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
,
...
...
@@ -64,7 +64,7 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa
}
SRpcCorEpSet
corMgmtEpSet
;
char
secretEncrypt
[
32
]
=
{
0
};
char
secretEncrypt
[
TSDB_PASS_LEN
]
=
{
0
};
int
secretEncryptLen
=
0
;
if
(
auth
==
NULL
)
{
if
(
!
validPassword
(
pass
))
{
...
...
@@ -82,6 +82,11 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa
terrno
=
TSDB_CODE_TSC_INVALID_PASS_LENGTH
;
return
NULL
;
}
else
{
if
(
outlen
>=
TSDB_PASS_LEN
)
{
terrno
=
TSDB_CODE_TSC_INVALID_USER_LENGTH
;
tscError
(
"failed to connect DB, too long length of authentication: %s"
,
base64
);
return
NULL
;
}
memcpy
(
secretEncrypt
,
base64
,
outlen
);
free
(
base64
);
}
...
...
@@ -240,11 +245,11 @@ TAOS *taos_connect_c(const char *ip, uint8_t ipLen, const char *user, uint8_t us
uint8_t
passLen
,
const
char
*
db
,
uint8_t
dbLen
,
uint16_t
port
)
{
char
ipBuf
[
TSDB_EP_LEN
]
=
{
0
};
char
userBuf
[
TSDB_USER_LEN
]
=
{
0
};
char
passBuf
[
TSDB_
KEY
_LEN
]
=
{
0
};
char
passBuf
[
TSDB_
PASS
_LEN
]
=
{
0
};
char
dbBuf
[
TSDB_DB_NAME_LEN
]
=
{
0
};
strncpy
(
ipBuf
,
ip
,
MIN
(
TSDB_EP_LEN
-
1
,
ipLen
));
strncpy
(
userBuf
,
user
,
MIN
(
TSDB_USER_LEN
-
1
,
userLen
));
strncpy
(
passBuf
,
pass
,
MIN
(
TSDB_
KEY
_LEN
-
1
,
passLen
));
strncpy
(
passBuf
,
pass
,
MIN
(
TSDB_
PASS
_LEN
-
1
,
passLen
));
strncpy
(
dbBuf
,
db
,
MIN
(
TSDB_DB_NAME_LEN
-
1
,
dbLen
));
return
taos_connect
(
ipBuf
,
userBuf
,
passBuf
,
dbBuf
,
port
);
}
...
...
src/inc/taosdef.h
浏览文件 @
f882b496
...
...
@@ -86,7 +86,9 @@ extern const int32_t TYPE_BYTES[16];
#define TSDB_DEFAULT_USER "root"
#define TSDB_DEFAULT_PASS "taosdata"
#define SHELL_MAX_PASSWORD_LEN 20
#define TSDB_PASS_LEN 129
#define SHELL_MAX_PASSWORD_LEN TSDB_PASS_LEN
#define TSDB_TRUE 1
#define TSDB_FALSE 0
#define TSDB_OK 0
...
...
src/inc/taosmsg.h
浏览文件 @
f882b496
...
...
@@ -372,7 +372,7 @@ typedef struct {
typedef
struct
{
int8_t
extend
;
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_
KEY
_LEN
];
char
pass
[
TSDB_
PASS
_LEN
];
SAcctCfg
cfg
;
}
SCreateAcctMsg
,
SAlterAcctMsg
;
...
...
@@ -384,7 +384,7 @@ typedef struct {
typedef
struct
{
int8_t
extend
;
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_
KEY
_LEN
];
char
pass
[
TSDB_
PASS
_LEN
];
int8_t
privilege
;
int8_t
flag
;
}
SCreateUserMsg
,
SAlterUserMsg
;
...
...
src/kit/shell/src/shellDarwin.c
浏览文件 @
f882b496
...
...
@@ -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
(
"%s"
,
g_password
)
>
1
)
{
if
(
scanf
(
"%
128
s"
,
g_password
)
>
1
)
{
fprintf
(
stderr
,
"password read error
\n
"
);
}
taosSetConsoleEcho
(
true
);
...
...
src/kit/shell/src/shellLinux.c
浏览文件 @
f882b496
...
...
@@ -186,7 +186,7 @@ static void parse_args(
||
(
strncmp
(
argv
[
i
],
"--password"
,
10
)
==
0
))
{
printf
(
"Enter password: "
);
taosSetConsoleEcho
(
false
);
if
(
scanf
(
"%
20
s"
,
g_password
)
>
1
)
{
if
(
scanf
(
"%
128
s"
,
g_password
)
>
1
)
{
fprintf
(
stderr
,
"password reading error
\n
"
);
}
taosSetConsoleEcho
(
true
);
...
...
src/kit/shell/src/shellWindows.c
浏览文件 @
f882b496
...
...
@@ -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
(
"%s"
,
g_password
)
>
1
)
{
if
(
scanf
(
"%
128
s"
,
g_password
)
>
1
)
{
fprintf
(
stderr
,
"password read error!
\n
"
);
}
taosSetConsoleEcho
(
true
);
...
...
src/mnode/src/mnodeUser.c
浏览文件 @
f882b496
...
...
@@ -625,11 +625,18 @@ int32_t mnodeRetriveAuth(char *user, char *spi, char *encrypt, char *secret, cha
mError
(
"user:%s, failed to auth user, reason:%s"
,
user
,
tstrerror
(
TSDB_CODE_MND_INVALID_USER
));
return
TSDB_CODE_MND_INVALID_USER
;
}
else
{
if
(
pUser
->
superAuth
)
{
SAcctObj
*
pAcct
=
mnodeGetAcct
(
user
);
memcpy
(
secret
,
pAcct
->
pass
,
TSDB_KEY_LEN
);
mnodeDecAcctRef
(
pAcct
);
}
else
{
memcpy
(
secret
,
pUser
->
pass
,
TSDB_KEY_LEN
);
}
*
spi
=
1
;
*
encrypt
=
0
;
*
ckey
=
0
;
memcpy
(
secret
,
pUser
->
pass
,
TSDB_KEY_LEN
);
mnodeDecUserRef
(
pUser
);
mDebug
(
"user:%s, auth info is returned"
,
user
);
return
TSDB_CODE_SUCCESS
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录