Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b086dcaf
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看板
提交
b086dcaf
编写于
4月 14, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact<cluster>: adjust auth code
上级
495e417c
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
25 addition
and
35 deletion
+25
-35
include/dnode/mnode/mnode.h
include/dnode/mnode/mnode.h
+4
-19
source/dnode/mnode/impl/src/mndAuth.c
source/dnode/mnode/impl/src/mndAuth.c
+21
-16
未找到文件。
include/dnode/mnode/mnode.h
浏览文件 @
b086dcaf
...
...
@@ -74,26 +74,12 @@ void mndStop(SMnode *pMnode);
* @brief Get mnode monitor info.
*
* @param pMnode The mnode object.
* @param pCluster
Info
* @param pVgroup
Info
* @param pGrant
Info
* @param pCluster
* @param pVgroup
* @param pGrant
* @return int32_t 0 for success, -1 for failure.
*/
int32_t
mndGetMonitorInfo
(
SMnode
*
pMnode
,
SMonClusterInfo
*
pClusterInfo
,
SMonVgroupInfo
*
pVgroupInfo
,
SMonGrantInfo
*
pGrantInfo
);
/**
* @brief Get user authentication info.
*
* @param pMnode The mnode object.
* @param user
* @param spi
* @param encrypt
* @param secret
* @param ckey
* @return int32_t 0 for success, -1 for failure.
*/
int32_t
mndRetriveAuth
(
SMnode
*
pMnode
,
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
);
int32_t
mndGetMonitorInfo
(
SMnode
*
pMnode
,
SMonClusterInfo
*
pCluster
,
SMonVgroupInfo
*
pVgroup
,
SMonGrantInfo
*
pGrant
);
/**
* @brief Process the read, write, sync request.
...
...
@@ -105,7 +91,6 @@ int32_t mndProcessMsg(SNodeMsg *pMsg);
/**
* @brief Generate machine code
*
*/
void
mndGenerateMachineCode
();
...
...
source/dnode/mnode/impl/src/mndAuth.c
浏览文件 @
b086dcaf
...
...
@@ -26,22 +26,22 @@ int32_t mndInitAuth(SMnode *pMnode) {
void
mndCleanupAuth
(
SMnode
*
pMnode
)
{}
int32_t
mndRetriveAuth
(
SMnode
*
pMnode
,
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
user
);
static
int32_t
mndRetriveAuth
(
SMnode
*
pMnode
,
SAuthRsp
*
pRsp
)
{
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
pRsp
->
user
);
if
(
pUser
==
NULL
)
{
*
secret
=
0
;
mError
(
"user:%s, failed to auth user since %s"
,
user
,
terrstr
());
*
pRsp
->
secret
=
0
;
mError
(
"user:%s, failed to auth user since %s"
,
pRsp
->
user
,
terrstr
());
return
-
1
;
}
*
spi
=
1
;
*
encrypt
=
0
;
*
ckey
=
0
;
pRsp
->
spi
=
1
;
pRsp
->
encrypt
=
0
;
*
pRsp
->
ckey
=
0
;
memcpy
(
secret
,
pUser
->
pass
,
TSDB_PASSWORD_LEN
);
memcpy
(
pRsp
->
secret
,
pUser
->
pass
,
TSDB_PASSWORD_LEN
);
mndReleaseUser
(
pMnode
,
pUser
);
mDebug
(
"user:%s, auth info is returned"
,
user
);
mDebug
(
"user:%s, auth info is returned"
,
pRsp
->
user
);
return
0
;
}
...
...
@@ -55,14 +55,19 @@ static int32_t mndProcessAuthReq(SNodeMsg *pReq) {
SAuthReq
authRsp
=
{
0
};
memcpy
(
authRsp
.
user
,
authReq
.
user
,
TSDB_USER_LEN
);
int32_t
code
=
mndRetriveAuth
(
pReq
->
pNode
,
authRsp
.
user
,
&
authRsp
.
spi
,
&
authRsp
.
encrypt
,
authRsp
.
secret
,
authRsp
.
ckey
);
int32_t
code
=
mndRetriveAuth
(
pReq
->
pNode
,
&
authRsp
);
mTrace
(
"user:%s, auth req received, spi:%d encrypt:%d ruser:%s"
,
pReq
->
user
,
authRsp
.
spi
,
authRsp
.
encrypt
,
authRsp
.
user
);
int32_t
contLen
=
tSerializeSAuthReq
(
NULL
,
0
,
&
authRsp
);
void
*
pRsp
=
rpcMallocCont
(
contLen
);
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeSAuthReq
(
pRsp
,
contLen
,
&
authRsp
);
pReq
->
pRsp
=
pRsp
;
pReq
->
rspLen
=
contLen
;
return
code
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录