Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
clmforever
oceanbase
提交
30327651
O
oceanbase
项目概览
clmforever
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
30327651
编写于
3月 23, 2022
作者:
B
bf0
提交者:
LINGuanRen
3月 23, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix core when expanding privs of roles
上级
c0e38601
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
23 addition
and
19 deletion
+23
-19
src/share/schema/ob_schema_getter_guard.cpp
src/share/schema/ob_schema_getter_guard.cpp
+9
-8
src/sql/resolver/dcl/ob_alter_user_profile_resolver.cpp
src/sql/resolver/dcl/ob_alter_user_profile_resolver.cpp
+1
-1
src/sql/resolver/dcl/ob_grant_resolver.cpp
src/sql/resolver/dcl/ob_grant_resolver.cpp
+1
-1
src/sql/resolver/dcl/ob_revoke_resolver.cpp
src/sql/resolver/dcl/ob_revoke_resolver.cpp
+12
-9
未找到文件。
src/share/schema/ob_schema_getter_guard.cpp
浏览文件 @
30327651
...
...
@@ -1900,18 +1900,19 @@ int ObSchemaGetterGuard::add_role_id_recursively(uint64_t role_id, ObSessionPriv
int
ret
=
OB_SUCCESS
;
const
ObUserInfo
*
role_info
=
NULL
;
/* 1. put itself */
if
(
!
has_exist_in_array
(
s_priv
.
enable_role_id_array_
,
role_id
))
{
/* 1. put itself */
OZ
(
s_priv
.
enable_role_id_array_
.
push_back
(
role_id
));
}
/* 2. get role recursively */
OZ
(
get_user_info
(
role_id
,
role_info
));
if
(
OB_SUCC
(
ret
)
&&
role_info
!=
NULL
)
{
const
ObSEArray
<
uint64_t
,
8
>&
role_id_array
=
role_info
->
get_role_id_array
();
const
ObSEArray
<
uint64_t
,
8
>
&
role_id_array
=
role_info
->
get_role_id_array
();
for
(
int
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
role_id_array
.
count
();
++
i
)
{
OZ
(
add_role_id_recursively
(
role_info
->
get_role_id_array
().
at
(
i
),
s_priv
));
}
}
}
return
ret
;
}
...
...
src/sql/resolver/dcl/ob_alter_user_profile_resolver.cpp
浏览文件 @
30327651
...
...
@@ -101,7 +101,7 @@ int ObAlterUserProfileResolver::resolve_role_list(const ParseNode* role_list, ob
role_name
.
assign_ptr
(
const_cast
<
char
*>
(
role
->
str_value_
),
static_cast
<
int32_t
>
(
role
->
str_len_
));
ObString
host_name
(
OB_DEFAULT_HOST_NAME
);
if
(
OB_FAIL
(
params_
.
schema_checker_
->
get_user_info
(
arg
.
tenant_id_
,
role_name
,
host_name
,
role_info
)))
{
if
(
OB_USER_NOT_EXIST
==
ret
)
{
if
(
OB_USER_NOT_EXIST
==
ret
||
OB_ISNULL
(
role_info
)
||
!
role_info
->
is_role
()
)
{
if
(
for_default_role_stmt
)
{
ret
=
OB_ROLE_NOT_EXIST
;
LOG_USER_ERROR
(
OB_ROLE_NOT_EXIST
,
role_name
.
length
(),
role_name
.
ptr
());
...
...
src/sql/resolver/dcl/ob_grant_resolver.cpp
浏览文件 @
30327651
...
...
@@ -198,7 +198,7 @@ int ObGrantResolver::resolve_grant_role_to_ur(const ParseNode* grant_role, ObGra
role_info
),
tenant_id
,
role_name
);
if
(
OB_USER_NOT_EXIST
==
ret
)
{
if
(
OB_USER_NOT_EXIST
==
ret
||
OB_ISNULL
(
role_info
)
||
!
role_info
->
is_role
()
)
{
ret
=
OB_ROLE_NOT_EXIST
;
LOG_USER_ERROR
(
OB_ROLE_NOT_EXIST
,
role_name
.
length
(),
role_name
.
ptr
());
}
...
...
src/sql/resolver/dcl/ob_revoke_resolver.cpp
浏览文件 @
30327651
...
...
@@ -41,6 +41,7 @@ int ObRevokeResolver::resolve_revoke_role_inner(const ParseNode* revoke_role, Ob
// 1. resolve role list
ParseNode
*
role_list
=
revoke_role
->
children_
[
0
];
for
(
int
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
role_list
->
num_child_
;
++
i
)
{
const
ObUserInfo
*
role_info
=
NULL
;
uint64_t
role_id
=
OB_INVALID_ID
;
ParseNode
*
role
=
role_list
->
children_
[
i
];
if
(
NULL
==
role
)
{
...
...
@@ -49,20 +50,22 @@ int ObRevokeResolver::resolve_revoke_role_inner(const ParseNode* revoke_role, Ob
}
else
{
ObString
role_name
;
role_name
.
assign_ptr
(
const_cast
<
char
*>
(
role
->
str_value_
),
static_cast
<
int32_t
>
(
role
->
str_len_
));
ObString
host_name
(
OB_DEFAULT_HOST_NAME
);
if
(
OB_FAIL
(
params_
.
schema_checker_
->
get_user_id
(
tenant_id
,
role_name
,
host_name
,
role_id
)))
{
if
(
OB_USER_NOT_EXIST
==
ret
)
{
OZ
(
params_
.
schema_checker_
->
get_user_info
(
tenant_id
,
role_name
,
host_name
,
role_info
),
role_name
,
host_name
);
if
(
OB_USER_NOT_EXIST
==
ret
||
OB_ISNULL
(
role_info
)
||
!
role_info
->
is_role
()
)
{
ret
=
OB_ROLE_NOT_EXIST
;
LOG_USER_ERROR
(
OB_ROLE_NOT_EXIST
,
role_name
.
length
(),
role_name
.
ptr
());
}
SQL_RESV_LOG
(
WARN
,
"fail to get user id"
,
K
(
ret
),
K
(
role_name
),
K
(
host_name
)
);
}
else
if
(
OB_FAIL
(
revoke_stmt
->
add_role
(
role_id
)))
{
}
else
{
role_id
=
role_info
->
get_user_id
(
);
if
(
OB_FAIL
(
revoke_stmt
->
add_role
(
role_id
)))
{
LOG_WARN
(
"failed to add role"
,
K
(
ret
));
}
else
{
OZ
(
role_id_array
.
push_back
(
role_id
));
}
}
}
}
// 2. check privilege
if
(
OB_SUCC
(
ret
)
&&
ObSchemaChecker
::
is_ora_priv_check
())
{
OZ
(
params_
.
schema_checker_
->
check_ora_grant_role_priv
(
revoke_stmt
->
get_tenant_id
(),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录