Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
7944320f
Commit
7944320f
authored
Sep 29, 2011
by
Tatjana Azundris Nuernberg
Browse files
Options
Browse Files
Download
Plain Diff
manual merge
parents
1922d65f
8932ae21
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
604 additions
and
15 deletions
+604
-15
mysql-test/r/view_grant.result
mysql-test/r/view_grant.result
+215
-9
mysql-test/t/view_grant.test
mysql-test/t/view_grant.test
+357
-4
sql/sql_view.cc
sql/sql_view.cc
+32
-2
No files found.
mysql-test/r/view_grant.result
View file @
7944320f
This diff is collapsed.
Click to expand it.
mysql-test/t/view_grant.test
View file @
7944320f
This diff is collapsed.
Click to expand it.
sql/sql_view.cc
View file @
7944320f
...
...
@@ -1265,8 +1265,38 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
if
(
!
table
->
prelocking_placeholder
&&
(
old_lex
->
sql_command
==
SQLCOM_SELECT
&&
old_lex
->
describe
))
{
if
(
check_table_access
(
thd
,
SELECT_ACL
,
view_tables
,
UINT_MAX
,
TRUE
)
&&
check_table_access
(
thd
,
SHOW_VIEW_ACL
,
table
,
UINT_MAX
,
TRUE
))
/*
The user we run EXPLAIN as (either the connected user who issued
the EXPLAIN statement, or the definer of a SUID stored routine
which contains the EXPLAIN) should have both SHOW_VIEW_ACL and
SELECT_ACL on the view being opened as well as on all underlying
views since EXPLAIN will disclose their structure. This user also
should have SELECT_ACL on all underlying tables of the view since
this EXPLAIN will disclose information about the number of rows in it.
To perform this privilege check we create auxiliary TABLE_LIST object
for the view in order a) to avoid trashing "table->grant" member for
original table list element, which contents can be important at later
stage for column-level privilege checking b) get TABLE_LIST object
with "security_ctx" member set to 0, i.e. forcing check_table_access()
to use active user's security context.
There is no need for creating similar copies of table list elements
for underlying tables since they are just have been constructed and
thus have TABLE_LIST::security_ctx == 0 and fresh TABLE_LIST::grant
member.
Finally at this point making sure we have SHOW_VIEW_ACL on the views
will suffice as we implicitly require SELECT_ACL anyway.
*/
TABLE_LIST
view
;
bzero
((
char
*
)
&
view
,
sizeof
(
TABLE_LIST
));
view
.
db
=
table
->
db
;
view
.
table_name
=
table
->
table_name
;
if
(
check_table_access
(
thd
,
SELECT_ACL
,
view_tables
,
UINT_MAX
,
TRUE
)
||
check_table_access
(
thd
,
SHOW_VIEW_ACL
,
&
view
,
UINT_MAX
,
TRUE
))
{
my_message
(
ER_VIEW_NO_EXPLAIN
,
ER
(
ER_VIEW_NO_EXPLAIN
),
MYF
(
0
));
goto
err
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment