Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c21911fd
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c21911fd
编写于
12月 15, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: user auth error
上级
473338cf
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
74 addition
and
25 deletion
+74
-25
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+4
-4
source/libs/command/src/command.c
source/libs/command/src/command.c
+3
-7
source/libs/parser/src/parAstParser.c
source/libs/parser/src/parAstParser.c
+43
-14
source/libs/parser/src/parAuthenticator.c
source/libs/parser/src/parAuthenticator.c
+20
-0
source/libs/planner/src/planLogicCreater.c
source/libs/planner/src/planLogicCreater.c
+4
-0
未找到文件。
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
c21911fd
...
...
@@ -838,9 +838,9 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock
if
(
pUser
->
superUser
)
{
cols
=
0
;
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
char
userName
[
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
userName
[
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
userName
,
pUser
->
user
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
userName
,
false
);
char
privilege
[
20
]
=
{
0
};
...
...
@@ -859,9 +859,9 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock
char
*
db
=
taosHashIterate
(
pUser
->
readDbs
,
NULL
);
while
(
db
!=
NULL
)
{
cols
=
0
;
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
char
userName
[
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
userName
[
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
userName
,
pUser
->
user
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
userName
,
false
);
char
privilege
[
20
]
=
{
0
};
...
...
source/libs/command/src/command.c
浏览文件 @
c21911fd
...
...
@@ -231,10 +231,6 @@ static const char* cacheModelStr(int8_t cacheModel) {
return
TSDB_CACHE_MODEL_NONE_STR
;
}
static
const
char
*
strictStr
(
int8_t
strict
)
{
return
TSDB_DB_STRICT_ON
==
strict
?
TSDB_DB_STRICT_ON_STR
:
TSDB_DB_STRICT_OFF_STR
;
}
static
void
setCreateDBResultIntoDataBlock
(
SSDataBlock
*
pBlock
,
char
*
dbFName
,
SDbCfgInfo
*
pCfg
)
{
blockDataEnsureCapacity
(
pBlock
,
1
);
pBlock
->
info
.
rows
=
1
;
...
...
@@ -269,11 +265,11 @@ static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbFName, S
buf2
+
VARSTR_HEADER_SIZE
,
"CREATE DATABASE `%s` BUFFER %d CACHESIZE %d CACHEMODEL '%s' COMP %d DURATION %dm "
"WAL_FSYNC_PERIOD %d MAXROWS %d MINROWS %d KEEP %dm,%dm,%dm PAGES %d PAGESIZE %d PRECISION '%s' REPLICA %d "
"
STRICT '%s'
WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d"
,
"WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d"
,
dbFName
,
pCfg
->
buffer
,
pCfg
->
cacheSize
,
cacheModelStr
(
pCfg
->
cacheLast
),
pCfg
->
compression
,
pCfg
->
daysPerFile
,
pCfg
->
walFsyncPeriod
,
pCfg
->
maxRows
,
pCfg
->
minRows
,
pCfg
->
daysToKeep0
,
pCfg
->
daysToKeep1
,
pCfg
->
daysToKeep2
,
pCfg
->
pages
,
pCfg
->
pageSize
,
prec
,
pCfg
->
replications
,
strictStr
(
pCfg
->
strict
),
pCfg
->
walLevel
,
pCfg
->
numOfVgroups
,
1
==
pCfg
->
numOfStables
);
pCfg
->
pages
,
pCfg
->
pageSize
,
prec
,
pCfg
->
replications
,
pCfg
->
walLevel
,
pCfg
->
numOfVgroups
,
1
==
pCfg
->
numOfStables
);
if
(
retentions
)
{
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
+
len
,
" RETENTIONS %s"
,
retentions
);
...
...
source/libs/parser/src/parAstParser.c
浏览文件 @
c21911fd
...
...
@@ -245,6 +245,10 @@ static int32_t collectMetaKeyFromCreateTable(SCollectMetaKeyCxt* pCxt, SCreateTa
if
(
TSDB_CODE_SUCCESS
==
code
&&
NULL
==
pStmt
->
pTags
)
{
code
=
reserveTableVgroupInCache
(
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
dbName
,
pStmt
->
tableName
,
pCxt
->
pMetaCache
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
reserveUserAuthInCache
(
pCxt
->
pParseCxt
->
acctId
,
pCxt
->
pParseCxt
->
pUser
,
pStmt
->
dbName
,
AUTH_TYPE_WRITE
,
pCxt
->
pMetaCache
);
}
return
code
;
}
...
...
@@ -261,6 +265,10 @@ static int32_t collectMetaKeyFromCreateMultiTable(SCollectMetaKeyCxt* pCxt, SCre
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
reserveTableVgroupInCache
(
pCxt
->
pParseCxt
->
acctId
,
pClause
->
dbName
,
pClause
->
tableName
,
pCxt
->
pMetaCache
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
reserveUserAuthInCache
(
pCxt
->
pParseCxt
->
acctId
,
pCxt
->
pParseCxt
->
pUser
,
pClause
->
dbName
,
AUTH_TYPE_WRITE
,
pCxt
->
pMetaCache
);
}
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
break
;
}
...
...
@@ -351,38 +359,59 @@ static int32_t collectMetaKeyFromCreateStream(SCollectMetaKeyCxt* pCxt, SCreateS
}
static
int32_t
collectMetaKeyFromShowDnodes
(
SCollectMetaKeyCxt
*
pCxt
,
SShowStmt
*
pStmt
)
{
return
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_DNODES
,
pCxt
->
pMetaCache
);
if
(
pCxt
->
pParseCxt
->
enableSysInfo
)
{
return
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_DNODES
,
pCxt
->
pMetaCache
);
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
collectMetaKeyFromShowMnodes
(
SCollectMetaKeyCxt
*
pCxt
,
SShowStmt
*
pStmt
)
{
return
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_MNODES
,
pCxt
->
pMetaCache
);
if
(
pCxt
->
pParseCxt
->
enableSysInfo
)
{
return
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_MNODES
,
pCxt
->
pMetaCache
);
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
collectMetaKeyFromShowModules
(
SCollectMetaKeyCxt
*
pCxt
,
SShowStmt
*
pStmt
)
{
return
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_MODULES
,
pCxt
->
pMetaCache
);
if
(
pCxt
->
pParseCxt
->
enableSysInfo
)
{
return
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_MODULES
,
pCxt
->
pMetaCache
);
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
collectMetaKeyFromShowQnodes
(
SCollectMetaKeyCxt
*
pCxt
,
SShowStmt
*
pStmt
)
{
return
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_QNODES
,
pCxt
->
pMetaCache
);
if
(
pCxt
->
pParseCxt
->
enableSysInfo
)
{
return
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_QNODES
,
pCxt
->
pMetaCache
);
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
collectMetaKeyFromShowSnodes
(
SCollectMetaKeyCxt
*
pCxt
,
SShowStmt
*
pStmt
)
{
return
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_SNODES
,
pCxt
->
pMetaCache
);
if
(
pCxt
->
pParseCxt
->
enableSysInfo
)
{
return
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_SNODES
,
pCxt
->
pMetaCache
);
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
collectMetaKeyFromShowBnodes
(
SCollectMetaKeyCxt
*
pCxt
,
SShowStmt
*
pStmt
)
{
return
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_BNODES
,
pCxt
->
pMetaCache
);
if
(
pCxt
->
pParseCxt
->
enableSysInfo
)
{
return
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_BNODES
,
pCxt
->
pMetaCache
);
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
collectMetaKeyFromShowCluster
(
SCollectMetaKeyCxt
*
pCxt
,
SShowStmt
*
pStmt
)
{
return
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_CLUSTER
,
pCxt
->
pMetaCache
);
if
(
pCxt
->
pParseCxt
->
enableSysInfo
)
{
return
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_CLUSTER
,
pCxt
->
pMetaCache
);
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
collectMetaKeyFromShowDatabases
(
SCollectMetaKeyCxt
*
pCxt
,
SShowStmt
*
pStmt
)
{
...
...
source/libs/parser/src/parAuthenticator.c
浏览文件 @
c21911fd
...
...
@@ -104,6 +104,22 @@ static int32_t authShowCreateTable(SAuthCxt* pCxt, SShowCreateTableStmt* pStmt)
return
checkAuth
(
pCxt
,
pStmt
->
dbName
,
AUTH_TYPE_READ
);
}
static
int32_t
authCreateTable
(
SAuthCxt
*
pCxt
,
SCreateTableStmt
*
pStmt
)
{
return
checkAuth
(
pCxt
,
pStmt
->
dbName
,
AUTH_TYPE_WRITE
);
}
static
int32_t
authCreateMultiTable
(
SAuthCxt
*
pCxt
,
SCreateMultiTableStmt
*
pStmt
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
SNode
*
pNode
=
NULL
;
FOREACH
(
pNode
,
pStmt
->
pSubTables
)
{
code
=
checkAuth
(
pCxt
,
((
SCreateSubTableClause
*
)
pNode
)
->
dbName
,
AUTH_TYPE_WRITE
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
break
;
}
}
return
code
;
}
static
int32_t
authQuery
(
SAuthCxt
*
pCxt
,
SNode
*
pStmt
)
{
switch
(
nodeType
(
pStmt
))
{
case
QUERY_NODE_SET_OPERATOR
:
...
...
@@ -116,6 +132,10 @@ static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) {
return
authDelete
(
pCxt
,
(
SDeleteStmt
*
)
pStmt
);
case
QUERY_NODE_INSERT_STMT
:
return
authInsert
(
pCxt
,
(
SInsertStmt
*
)
pStmt
);
case
QUERY_NODE_CREATE_TABLE_STMT
:
return
authCreateTable
(
pCxt
,
(
SCreateTableStmt
*
)
pStmt
);
case
QUERY_NODE_CREATE_MULTI_TABLE_STMT
:
return
authCreateMultiTable
(
pCxt
,
(
SCreateMultiTableStmt
*
)
pStmt
);
case
QUERY_NODE_SHOW_DNODES_STMT
:
case
QUERY_NODE_SHOW_MNODES_STMT
:
case
QUERY_NODE_SHOW_MODULES_STMT
:
...
...
source/libs/planner/src/planLogicCreater.c
浏览文件 @
c21911fd
...
...
@@ -928,6 +928,10 @@ static int32_t createFillLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
code
=
TSDB_CODE_OUT_OF_MEMORY
;
}
if
(
TSDB_CODE_SUCCESS
==
code
&&
0
==
LIST_LENGTH
(
pFill
->
node
.
pTargets
))
{
code
=
createColumnByRewriteExpr
(
pFill
->
pWStartTs
,
&
pFill
->
node
.
pTargets
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
*
pLogicNode
=
(
SLogicNode
*
)
pFill
;
}
else
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录