Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CSDN产品汪
TDengine
提交
cbbe8c16
T
TDengine
项目概览
CSDN产品汪
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cbbe8c16
编写于
2月 21, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix compile errors
上级
ce0f8aae
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
27 deletion
+20
-27
src/client/src/tscServer.c
src/client/src/tscServer.c
+7
-9
src/inc/mnode.h
src/inc/mnode.h
+0
-2
src/inc/taosmsg.h
src/inc/taosmsg.h
+0
-2
src/mnode/src/mgmtShell.c
src/mnode/src/mgmtShell.c
+13
-14
未找到文件。
src/client/src/tscServer.c
浏览文件 @
cbbe8c16
...
...
@@ -2601,7 +2601,7 @@ int tscProcessRetrieveMetricRsp(SSqlObj *pSql) {
int
tscProcessEmptyResultRsp
(
SSqlObj
*
pSql
)
{
return
tscLocalResultCommonBuilder
(
pSql
,
0
);
}
int
tscBuildConnectMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
SConnectMsg
*
pConnect
;
SC
MC
onnectMsg
*
pConnect
;
char
*
pMsg
,
*
pStart
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
...
...
@@ -2609,7 +2609,7 @@ int tscBuildConnectMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pMsg
=
pCmd
->
payload
+
tsRpcHeadSize
;
pStart
=
pMsg
;
pConnect
=
(
SConnectMsg
*
)
pMsg
;
pConnect
=
(
SC
MC
onnectMsg
*
)
pMsg
;
char
*
db
;
// ugly code to move the space
db
=
strstr
(
pObj
->
db
,
TS_PATH_DELIMITER
);
...
...
@@ -2618,7 +2618,7 @@ int tscBuildConnectMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
strcpy
(
pConnect
->
clientVersion
,
version
);
pMsg
+=
sizeof
(
SConnectMsg
);
pMsg
+=
sizeof
(
SC
MC
onnectMsg
);
pCmd
->
payloadLen
=
pMsg
-
pStart
;
pCmd
->
msgType
=
TSDB_MSG_TYPE_CONNECT
;
...
...
@@ -3312,13 +3312,11 @@ int tscProcessShowRsp(SSqlObj *pSql) {
}
int
tscProcessConnectRsp
(
SSqlObj
*
pSql
)
{
char
temp
[
TSDB_TABLE_ID_LEN
*
2
];
SConnectRsp
*
pConnect
;
char
temp
[
TSDB_TABLE_ID_LEN
*
2
];
STscObj
*
pObj
=
pSql
->
pTscObj
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
pConnect
=
(
S
ConnectRsp
*
)
pRes
->
pRsp
;
SCMConnectRsp
*
pConnect
=
(
SCM
ConnectRsp
*
)
pRes
->
pRsp
;
strcpy
(
pObj
->
acctId
,
pConnect
->
acctId
);
// copy acctId from response
int32_t
len
=
sprintf
(
temp
,
"%s%s%s"
,
pObj
->
acctId
,
TS_PATH_DELIMITER
,
pObj
->
db
);
...
...
@@ -3326,11 +3324,11 @@ int tscProcessConnectRsp(SSqlObj *pSql) {
strncpy
(
pObj
->
db
,
temp
,
tListLen
(
pObj
->
db
));
SIpList
*
pIpList
;
char
*
rsp
=
pRes
->
pRsp
+
sizeof
(
SConnectRsp
);
char
*
rsp
=
pRes
->
pRsp
+
sizeof
(
SC
MC
onnectRsp
);
pIpList
=
(
SIpList
*
)
rsp
;
tscSetMgmtIpList
(
pIpList
);
strcpy
(
pObj
->
sversion
,
pConnect
->
v
ersion
);
strcpy
(
pObj
->
sversion
,
pConnect
->
serverV
ersion
);
pObj
->
writeAuth
=
pConnect
->
writeAuth
;
pObj
->
superAuth
=
pConnect
->
superAuth
;
taosTmrReset
(
tscProcessActivityTimer
,
tsShellActivityTimer
*
500
,
pObj
,
tscTmr
,
&
pObj
->
pTimer
);
...
...
src/inc/mnode.h
浏览文件 @
cbbe8c16
...
...
@@ -254,8 +254,6 @@ typedef struct _user_obj {
char
reserved
[
16
];
char
updateEnd
[
1
];
struct
_user_obj
*
prev
,
*
next
;
int8_t
writeAuth
;
int8_t
superAuth
;
}
SUserObj
;
typedef
struct
{
...
...
src/inc/taosmsg.h
浏览文件 @
cbbe8c16
...
...
@@ -342,14 +342,12 @@ typedef struct {
char
serverVersion
[
TSDB_MSG_DEF_VERSION_LEN
];
int8_t
writeAuth
;
int8_t
superAuth
;
int8_t
usePublicIp
;
int16_t
index
;
int16_t
numOfIps
;
uint16_t
port
;
uint32_t
ip
[
TSDB_MSG_DEF_MAX_MPEERS
];
}
SCMConnectRsp
;
typedef
struct
{
int32_t
maxUsers
;
int32_t
maxDbs
;
...
...
src/mnode/src/mgmtShell.c
浏览文件 @
cbbe8c16
...
...
@@ -1315,32 +1315,32 @@ int32_t mgmtRetriveUserAuthInfo(char *user, char *spi, char *encrypt, char *secr
int32_t
mgmtProcessConnectMsg
(
int8_t
type
,
void
*
pCont
,
int32_t
contLen
,
void
*
ahandle
,
int32_t
code
)
{
SCMConnectMsg
*
pConnectMsg
=
(
SCMConnectMsg
*
)
pCont
;
uint32_t
destIp
=
0
;
uint32_t
srcIp
=
0
;
SRpcConnInfo
connInfo
;
rpcGetConnInfo
(
ahandle
,
&
connInfo
)
;
SUserObj
*
pUser
=
mgmtGetUser
(
pConnectMsg
->
head
.
userId
);
SUserObj
*
pUser
=
mgmtGetUser
(
connInfo
.
user
);
if
(
pUser
==
NULL
)
{
mLError
(
"user:%s login from %s
to %s, code:%d"
,
pConnectMsg
->
head
.
userId
,
taosIpStr
(
srcIp
),
taosIpStr
(
des
tIp
),
code
);
mLError
(
"user:%s login from %s
, code:%d"
,
connInfo
.
user
,
taosIpStr
(
connInfo
.
clien
tIp
),
code
);
rpcSendResponse
(
ahandle
,
TSDB_CODE_INVALID_USER
,
NULL
,
0
);
return
TSDB_CODE_INVALID_USER
;
}
if
(
mgmtCheckExpired
())
{
mLError
(
"user:%s login from %s
to %s, code:%d"
,
pConnectMsg
->
head
.
userId
,
taosIpStr
(
srcIp
),
taosIpStr
(
des
tIp
),
code
);
mLError
(
"user:%s login from %s
, code:%d"
,
connInfo
.
user
,
taosIpStr
(
connInfo
.
clien
tIp
),
code
);
rpcSendResponse
(
ahandle
,
TSDB_CODE_GRANT_EXPIRED
,
NULL
,
0
);
return
TSDB_CODE_GRANT_EXPIRED
;
}
SAcctObj
*
pAcct
=
mgmtGetAcct
(
pUser
->
acct
);
if
(
pAcct
==
NULL
)
{
mLError
(
"user:%s login from %s
to %s, code:%d"
,
pConnectMsg
->
head
.
userId
,
taosIpStr
(
srcIp
),
taosIpStr
(
des
tIp
),
code
);
mLError
(
"user:%s login from %s
, code:%d"
,
connInfo
.
user
,
taosIpStr
(
connInfo
.
clien
tIp
),
code
);
rpcSendResponse
(
ahandle
,
TSDB_CODE_INVALID_ACCT
,
NULL
,
0
);
return
TSDB_CODE_INVALID_ACCT
;
}
code
=
taosCheckVersion
(
pConnectMsg
->
clientVersion
,
version
,
3
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
mLError
(
"user:%s login from %s
to %s, code:%d"
,
pConnectMsg
->
head
.
userId
,
taosIpStr
(
srcIp
),
taosIpStr
(
des
tIp
),
code
);
mLError
(
"user:%s login from %s
, code:%d"
,
connInfo
.
user
,
taosIpStr
(
connInfo
.
clien
tIp
),
code
);
rpcSendResponse
(
ahandle
,
code
,
NULL
,
0
);
return
code
;
}
...
...
@@ -1350,7 +1350,7 @@ int32_t mgmtProcessConnectMsg(int8_t type, void *pCont, int32_t contLen, void *a
sprintf
(
dbName
,
"%x%s%s"
,
pAcct
->
acctId
,
TS_PATH_DELIMITER
,
pConnectMsg
->
db
);
SDbObj
*
pDb
=
mgmtGetDb
(
dbName
);
if
(
pDb
==
NULL
)
{
mLError
(
"user:%s login from %s
to %s, code:%d"
,
pConnectMsg
->
head
.
userId
,
taosIpStr
(
srcIp
),
taosIpStr
(
des
tIp
),
code
);
mLError
(
"user:%s login from %s
, code:%d"
,
connInfo
.
user
,
taosIpStr
(
connInfo
.
clien
tIp
),
code
);
rpcSendResponse
(
ahandle
,
TSDB_CODE_INVALID_DB
,
NULL
,
0
);
return
TSDB_CODE_INVALID_DB
;
}
...
...
@@ -1358,22 +1358,21 @@ int32_t mgmtProcessConnectMsg(int8_t type, void *pCont, int32_t contLen, void *a
SCMConnectRsp
*
pConnectRsp
=
rpcMallocCont
(
sizeof
(
SCMConnectRsp
));
if
(
pConnectRsp
==
NULL
)
{
mLError
(
"user:%s login from %s
to %s, code:%d"
,
pConnectMsg
->
head
.
userId
,
taosIpStr
(
srcIp
),
taosIpStr
(
des
tIp
),
code
);
mLError
(
"user:%s login from %s
, code:%d"
,
connInfo
.
user
,
taosIpStr
(
connInfo
.
clien
tIp
),
code
);
rpcSendResponse
(
ahandle
,
TSDB_CODE_SERV_OUT_OF_MEMORY
,
NULL
,
0
);
return
TSDB_CODE_SERV_OUT_OF_MEMORY
;
}
sprintf
(
pConnectRsp
->
acctId
,
"%x"
,
pAcct
->
acctId
);
strcpy
(
pConnectRsp
->
serverVersion
,
version
);
pConnectRsp
->
writeAuth
=
p
Conn
->
writeAuth
;
pConnectRsp
->
superAuth
=
p
Conn
->
superAuth
;
pConnectRsp
->
writeAuth
=
p
User
->
writeAuth
;
pConnectRsp
->
superAuth
=
p
User
->
superAuth
;
pConnectRsp
->
index
=
0
;
pConnectRsp
->
usePublicIp
=
(
destIp
==
tsPublicIpInt
?
1
:
0
);
if
(
pSdbPublicIpList
!=
NULL
&&
pSdbIpList
!=
NULL
)
{
pConnectRsp
->
numOfIps
=
htons
(
pSdbPublicIpList
->
numOfIps
);
pConnectRsp
->
port
=
htons
(
tsMgmtShellPort
);
if
(
pConnectRsp
->
usePublicIp
)
{
if
(
connInfo
.
serverIp
==
tsPublicIpInt
)
{
for
(
int
i
=
0
;
i
<
pSdbPublicIpList
->
numOfIps
;
++
i
)
{
pConnectRsp
->
ip
[
i
]
=
htonl
(
pSdbPublicIpList
->
ip
[
i
]);
}
...
...
@@ -1387,7 +1386,7 @@ int32_t mgmtProcessConnectMsg(int8_t type, void *pCont, int32_t contLen, void *a
pConnectRsp
->
port
=
htons
(
tsMgmtShellPort
);
}
mLPrint
(
"user:%s login from %s
to %s, code:%d"
,
pConnectMsg
->
head
.
userId
,
taosIpStr
(
srcIp
),
taosIpStr
(
des
tIp
),
code
);
mLPrint
(
"user:%s login from %s
, code:%d"
,
connInfo
.
user
,
taosIpStr
(
connInfo
.
clien
tIp
),
code
);
return
TSDB_CODE_SUCCESS
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录