Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7e89f1c4
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看板
提交
7e89f1c4
编写于
5月 18, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: remove auth func
上级
b81ba96c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
14 addition
and
76 deletion
+14
-76
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
+2
-3
source/dnode/mgmt/node_mgmt/src/dmTransport.c
source/dnode/mgmt/node_mgmt/src/dmTransport.c
+0
-61
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+1
-2
source/dnode/mnode/impl/src/mnode.c
source/dnode/mnode/impl/src/mnode.c
+11
-10
未找到文件。
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
浏览文件 @
7e89f1c4
...
...
@@ -275,7 +275,7 @@ static void dmGetServerStartupStatus(SDnode *pDnode, SServerStatusRsp *pStatus)
}
void
dmProcessNetTestReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
)
{
dDebug
(
"
start to process net test req"
);
dDebug
(
"
msg:%p, net test req will be processed"
,
pMsg
);
SRpcMsg
rsp
=
{.
code
=
0
,
.
info
=
pMsg
->
info
};
rsp
.
pCont
=
rpcMallocCont
(
pMsg
->
contLen
);
if
(
rsp
.
pCont
==
NULL
)
{
...
...
@@ -287,8 +287,7 @@ void dmProcessNetTestReq(SDnode *pDnode, SRpcMsg *pMsg) {
}
void
dmProcessServerStartupStatus
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
)
{
dDebug
(
"start to process server startup status req"
);
dDebug
(
"msg:%p, server startup status req will be processed"
,
pMsg
);
SServerStatusRsp
statusRsp
=
{
0
};
dmGetServerStartupStatus
(
pDnode
,
&
statusRsp
);
...
...
source/dnode/mgmt/node_mgmt/src/dmTransport.c
浏览文件 @
7e89f1c4
...
...
@@ -344,66 +344,6 @@ void dmCleanupClient(SDnode *pDnode) {
}
}
static
inline
int32_t
dmGetHideUserAuth
(
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
int32_t
code
=
0
;
char
pass
[
TSDB_PASSWORD_LEN
+
1
]
=
{
0
};
if
(
strcmp
(
user
,
INTERNAL_USER
)
==
0
)
{
taosEncryptPass_c
((
uint8_t
*
)(
INTERNAL_SECRET
),
strlen
(
INTERNAL_SECRET
),
pass
);
}
else
if
(
strcmp
(
user
,
TSDB_NETTEST_USER
)
==
0
)
{
taosEncryptPass_c
((
uint8_t
*
)(
TSDB_NETTEST_USER
),
strlen
(
TSDB_NETTEST_USER
),
pass
);
}
else
{
code
=
-
1
;
}
if
(
code
==
0
)
{
memcpy
(
secret
,
pass
,
TSDB_PASSWORD_LEN
);
*
spi
=
1
;
*
encrypt
=
0
;
*
ckey
=
0
;
}
return
code
;
}
static
inline
int32_t
dmRetrieveUserAuthInfo
(
SDnode
*
pDnode
,
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
if
(
dmGetHideUserAuth
(
user
,
spi
,
encrypt
,
secret
,
ckey
)
==
0
)
{
dTrace
(
"user:%s, get auth from mnode, spi:%d encrypt:%d"
,
user
,
*
spi
,
*
encrypt
);
return
0
;
}
SAuthReq
authReq
=
{
0
};
tstrncpy
(
authReq
.
user
,
user
,
TSDB_USER_LEN
);
int32_t
contLen
=
tSerializeSAuthReq
(
NULL
,
0
,
&
authReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSAuthReq
(
pReq
,
contLen
,
&
authReq
);
SRpcMsg
rpcMsg
=
{.
pCont
=
pReq
,
.
contLen
=
contLen
,
.
msgType
=
TDMT_MND_AUTH
,
.
info
.
ahandle
=
(
void
*
)
9528
};
SRpcMsg
rpcRsp
=
{
0
};
SEpSet
epSet
=
{
0
};
dTrace
(
"user:%s, send user auth req to other mnodes, spi:%d encrypt:%d"
,
user
,
authReq
.
spi
,
authReq
.
encrypt
);
dmGetMnodeEpSet
(
&
pDnode
->
data
,
&
epSet
);
dmSendRecv
(
&
epSet
,
&
rpcMsg
,
&
rpcRsp
);
if
(
rpcRsp
.
code
!=
0
)
{
terrno
=
rpcRsp
.
code
;
dError
(
"user:%s, failed to get user auth from other mnodes since %s"
,
user
,
terrstr
());
}
else
{
SAuthRsp
authRsp
=
{
0
};
tDeserializeSAuthReq
(
rpcRsp
.
pCont
,
rpcRsp
.
contLen
,
&
authRsp
);
memcpy
(
secret
,
authRsp
.
secret
,
TSDB_PASSWORD_LEN
);
memcpy
(
ckey
,
authRsp
.
ckey
,
TSDB_PASSWORD_LEN
);
*
spi
=
authRsp
.
spi
;
*
encrypt
=
authRsp
.
encrypt
;
dTrace
(
"user:%s, success to get user auth from other mnodes, spi:%d encrypt:%d"
,
user
,
authRsp
.
spi
,
authRsp
.
encrypt
);
}
rpcFreeCont
(
rpcRsp
.
pCont
);
return
rpcRsp
.
code
;
}
int32_t
dmInitServer
(
SDnode
*
pDnode
)
{
SDnodeTrans
*
pTrans
=
&
pDnode
->
trans
;
...
...
@@ -416,7 +356,6 @@ int32_t dmInitServer(SDnode *pDnode) {
rpcInit
.
sessions
=
tsMaxShellConns
;
rpcInit
.
connType
=
TAOS_CONN_SERVER
;
rpcInit
.
idleTime
=
tsShellActivityTimer
*
1000
;
rpcInit
.
afp
=
(
RpcAfp
)
dmRetrieveUserAuthInfo
;
rpcInit
.
parent
=
pDnode
;
pTrans
->
serverRpc
=
rpcOpen
(
&
rpcInit
);
...
...
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
7e89f1c4
...
...
@@ -197,8 +197,7 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) {
goto
CONN_OVER
;
}
if
(
0
!=
strncmp
(
connReq
.
passwd
,
pUser
->
pass
,
TSDB_PASSWORD_LEN
-
1
))
{
mError
(
"user:%s, failed to auth while acquire user, input:%s saved:%s"
,
pReq
->
conn
.
user
,
connReq
.
passwd
,
pUser
->
pass
);
mError
(
"user:%s, failed to auth while acquire user, input:%s"
,
pReq
->
conn
.
user
,
connReq
.
passwd
);
code
=
TSDB_CODE_RPC_AUTH_FAILURE
;
goto
CONN_OVER
;
}
...
...
source/dnode/mnode/impl/src/mnode.c
浏览文件 @
7e89f1c4
...
...
@@ -343,19 +343,20 @@ void mndStop(SMnode *pMnode) { return mndCleanupTimer(pMnode); }
int32_t
mndProcessMsg
(
SRpcMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
info
.
node
;
void
*
ahandle
=
pMsg
->
info
.
ahandle
;
mTrace
(
"msg:%p, will be processed, type:%s app:%p"
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
),
ahandle
);
if
(
IsReq
(
pMsg
)
&&
!
mndIsMaster
(
pMnode
))
{
terrno
=
TSDB_CODE_APP_NOT_READY
;
mDebug
(
"msg:%p, failed to process since %s, app:%p"
,
pMsg
,
terrstr
(),
ahandle
);
return
-
1
;
}
if
(
IsReq
(
pMsg
))
{
if
(
!
mndIsMaster
(
pMnode
))
{
terrno
=
TSDB_CODE_APP_NOT_READY
;
mDebug
(
"msg:%p, failed to process since %s, app:%p"
,
pMsg
,
terrstr
(),
ahandle
);
return
-
1
;
}
if
(
IsReq
(
pMsg
)
&&
(
pMsg
->
contLen
==
0
||
pMsg
->
pCont
==
NULL
))
{
terrno
=
TSDB_CODE_INVALID_MSG_LEN
;
mError
(
"msg:%p, failed to process since %s, app:%p"
,
pMsg
,
terrstr
(),
ahandle
);
return
-
1
;
if
(
pMsg
->
contLen
==
0
||
pMsg
->
pCont
==
NULL
)
{
terrno
=
TSDB_CODE_INVALID_MSG_LEN
;
mError
(
"msg:%p, failed to process since %s, app:%p"
,
pMsg
,
terrstr
(),
ahandle
);
return
-
1
;
}
}
MndMsgFp
fp
=
pMnode
->
msgFp
[
TMSG_INDEX
(
pMsg
->
msgType
)];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录