Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
26934679
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
26934679
编写于
10月 19, 2021
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TS-463]<feature> grant check for query while not for write
上级
8bfcf8eb
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
32 addition
and
7 deletion
+32
-7
src/mnode/src/mnodeDb.c
src/mnode/src/mnodeDb.c
+6
-1
src/mnode/src/mnodeDnode.c
src/mnode/src/mnodeDnode.c
+2
-1
src/mnode/src/mnodeFunc.c
src/mnode/src/mnodeFunc.c
+4
-2
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+3
-1
src/mnode/src/mnodeUser.c
src/mnode/src/mnodeUser.c
+3
-1
src/mnode/src/mnodeWrite.c
src/mnode/src/mnodeWrite.c
+3
-1
src/vnode/src/vnodeRead.c
src/vnode/src/vnodeRead.c
+11
-0
未找到文件。
src/mnode/src/mnodeDb.c
浏览文件 @
26934679
...
...
@@ -429,8 +429,10 @@ static int32_t mnodeCreateDb(SAcctObj *pAcct, SCreateDbMsg *pCreate, SMnodeMsg *
}
}
#ifdef GRANT_CHECK_WRITE
code
=
grantCheck
(
TSDB_GRANT_DB
);
if
(
code
!=
0
)
return
code
;
#endif
pDb
=
calloc
(
1
,
sizeof
(
SDbObj
));
tstrncpy
(
pDb
->
name
,
pCreate
->
db
,
sizeof
(
pDb
->
name
));
...
...
@@ -927,9 +929,12 @@ static int32_t mnodeProcessCreateDbMsg(SMnodeMsg *pMsg) {
pCreate
->
maxRowsPerFileBlock
=
htonl
(
pCreate
->
maxRowsPerFileBlock
);
int32_t
code
;
#ifdef GRANT_CHECK_WRITE
if
(
grantCheck
(
TSDB_GRANT_TIME
)
!=
TSDB_CODE_SUCCESS
)
{
code
=
TSDB_CODE_GRANT_EXPIRED
;
}
else
if
(
!
pMsg
->
pUser
->
writeAuth
)
{
}
else
#endif
if
(
!
pMsg
->
pUser
->
writeAuth
)
{
code
=
TSDB_CODE_MND_NO_RIGHTS
;
}
else
{
code
=
mnodeCreateDb
(
pMsg
->
pUser
->
pAcct
,
pCreate
,
pMsg
);
...
...
src/mnode/src/mnodeDnode.c
浏览文件 @
26934679
...
...
@@ -663,11 +663,12 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
}
static
int32_t
mnodeCreateDnode
(
char
*
ep
,
SMnodeMsg
*
pMsg
)
{
#ifndef GRANT_CHECK_WRITE
int32_t
grantCode
=
grantCheck
(
TSDB_GRANT_DNODE
);
if
(
grantCode
!=
TSDB_CODE_SUCCESS
)
{
return
grantCode
;
}
#endif
char
dnodeEp
[
TSDB_EP_LEN
]
=
{
0
};
tstrncpy
(
dnodeEp
,
ep
,
TSDB_EP_LEN
);
strtrim
(
dnodeEp
);
...
...
src/mnode/src/mnodeFunc.c
浏览文件 @
26934679
...
...
@@ -191,9 +191,11 @@ static int32_t mnodeUpdateFunc(SFuncObj *pFunc, void *pMsg) {
}
*/
int32_t
mnodeCreateFunc
(
SAcctObj
*
pAcct
,
char
*
name
,
int32_t
codeLen
,
char
*
codeScript
,
char
*
path
,
uint8_t
outputType
,
int16_t
outputLen
,
int32_t
funcType
,
int32_t
bufSize
,
SMnodeMsg
*
pMsg
)
{
#ifdef GRANT_CHECK_WRITE
if
(
grantCheck
(
TSDB_GRANT_TIME
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_GRANT_EXPIRED
;
}
#endif
if
(
!
pMsg
->
pUser
->
writeAuth
)
{
return
TSDB_CODE_MND_NO_RIGHTS
;
...
...
@@ -203,12 +205,12 @@ int32_t mnodeCreateFunc(SAcctObj *pAcct, char *name, int32_t codeLen, char *code
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
#ifdef GRANT_CHECK_WRITE
code
=
grantCheck
(
TSDB_GRANT_USER
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
#endif
if
(
name
[
0
]
==
0
)
{
return
TSDB_CODE_MND_INVALID_FUNC_NAME
;
}
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
26934679
...
...
@@ -2216,18 +2216,20 @@ static int32_t mnodeProcessCreateChildTableMsg(SMnodeMsg *pMsg) {
//SCMCreateTableMsg* p1 = pMsg->rpcMsg.pCont; // there are several tables here.
SCreateTableMsg
*
pCreate
=
(
SCreateTableMsg
*
)((
char
*
)
pMsg
->
rpcMsg
.
pCont
+
sizeof
(
SCMCreateTableMsg
));
#ifdef GRANT_CHECK_WRITE
int32_t
code
=
grantCheck
(
TSDB_GRANT_TIMESERIES
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"msg:%p, app:%p table:%s, failed to create, grant timeseries failed"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pCreate
->
tableName
);
return
code
;
}
#endif
if
(
pMsg
->
retry
==
0
)
{
if
(
pMsg
->
pTable
==
NULL
)
{
SVgObj
*
pVgroup
=
NULL
;
int32_t
tid
=
0
;
code
=
mnodeGetAvailableVgroup
(
pMsg
,
&
pVgroup
,
&
tid
);
int32_t
code
=
mnodeGetAvailableVgroup
(
pMsg
,
&
pVgroup
,
&
tid
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
mDebug
(
"msg:%p, app:%p table:%s, failed to get available vgroup, reason:%s"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pCreate
->
tableName
,
tstrerror
(
code
));
...
...
src/mnode/src/mnodeUser.c
浏览文件 @
26934679
...
...
@@ -250,10 +250,12 @@ int32_t mnodeCreateUser(SAcctObj *pAcct, char *name, char *pass, void *pMsg) {
return
TSDB_CODE_MND_USER_ALREADY_EXIST
;
}
#ifdef GRANT_CHECK_WRITE
code
=
grantCheck
(
TSDB_GRANT_USER
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
#endif
pUser
=
calloc
(
1
,
sizeof
(
SUserObj
));
tstrncpy
(
pUser
->
user
,
name
,
TSDB_USER_LEN
);
...
...
src/mnode/src/mnodeWrite.c
浏览文件 @
26934679
...
...
@@ -65,14 +65,16 @@ int32_t mnodeProcessWrite(SMnodeMsg *pMsg) {
return
TSDB_CODE_MND_MSG_NOT_PROCESSED
;
}
#ifdef GRANT_CHECK_WRITE
int32_t
code
=
grantCheck
(
TSDB_GRANT_TIME
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"msg:%p, app:%p type:%s not processed, reason:%s"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
taosMsg
[
pMsg
->
rpcMsg
.
msgType
],
tstrerror
(
code
));
return
code
;
}
#endif
code
=
mnodeInitMsg
(
pMsg
);
int32_t
code
=
mnodeInitMsg
(
pMsg
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"msg:%p, app:%p type:%s not processed, reason:%s"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
taosMsg
[
pMsg
->
rpcMsg
.
msgType
],
tstrerror
(
code
));
...
...
src/vnode/src/vnodeRead.c
浏览文件 @
26934679
...
...
@@ -20,6 +20,7 @@
#include "tglobal.h"
#include "query.h"
#include "vnodeStatus.h"
#include "tgrant.h"
int32_t
vNumOfExistedQHandle
;
// current initialized and existed query handle in current dnode
...
...
@@ -227,6 +228,16 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
vError
(
"error rpc msg in query, %s"
,
tstrerror
(
pRead
->
code
));
}
if
(
grantCheck
(
TSDB_GRANT_TIME
)
!=
TSDB_CODE_SUCCESS
)
{
SQueryTableRsp
*
pRsp
=
(
SQueryTableRsp
*
)
rpcMallocCont
(
sizeof
(
SQueryTableRsp
));
pRsp
->
code
=
TSDB_CODE_GRANT_EXPIRED
;
pRsp
->
qId
=
0
;
pRet
->
len
=
sizeof
(
SQueryTableRsp
);
pRet
->
rsp
=
pRsp
;
return
pRsp
->
code
;
}
int32_t
code
=
TSDB_CODE_SUCCESS
;
void
**
handle
=
NULL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录