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
3061a749
Commit
3061a749
authored
Apr 02, 2005
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix of required privileges for altering view VIEW (DELETE->DROP) (BUG#9260)
parent
2292480e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
6 deletions
+20
-6
mysql-test/r/view.result
mysql-test/r/view.result
+6
-2
mysql-test/t/view.test
mysql-test/t/view.test
+11
-1
sql/sql_view.cc
sql/sql_view.cc
+3
-3
No files found.
mysql-test/r/view.result
View file @
3061a749
...
...
@@ -237,13 +237,17 @@ grant select on mysqltest.t1 to mysqltest_1@localhost;
grant create view,select on test.* to mysqltest_1@localhost;
create view v1 as select * from mysqltest.t1;
alter view v1 as select * from mysqltest.t1;
ERROR 42000: D
ELETE
command denied to user 'mysqltest_1'@'localhost' for table 'v1'
ERROR 42000: D
ROP
command denied to user 'mysqltest_1'@'localhost' for table 'v1'
create or replace view v1 as select * from mysqltest.t1;
ERROR 42000: D
ELETE
command denied to user 'mysqltest_1'@'localhost' for table 'v1'
ERROR 42000: D
ROP
command denied to user 'mysqltest_1'@'localhost' for table 'v1'
create view mysqltest.v2 as select * from mysqltest.t1;
ERROR 42000: CREATE VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v2'
create view v2 as select * from mysqltest.t2;
ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for table 't2'
grant create view,drop,select on test.* to mysqltest_1@localhost;
use test;
alter view v1 as select * from mysqltest.t1;
create or replace view v1 as select * from mysqltest.t1;
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
revoke all privileges on test.* from mysqltest_1@localhost;
drop database mysqltest;
...
...
mysql-test/t/view.test
View file @
3061a749
...
...
@@ -181,7 +181,7 @@ connect (user1,localhost,mysqltest_1,,test);
connection
user1
;
create
view
v1
as
select
*
from
mysqltest
.
t1
;
# try to modify view without D
ELETE
privilege on it
# try to modify view without D
ROP
privilege on it
--
error
1142
alter
view
v1
as
select
*
from
mysqltest
.
t1
;
--
error
1142
...
...
@@ -193,6 +193,16 @@ create view mysqltest.v2 as select * from mysqltest.t1;
--
error
1142
create
view
v2
as
select
*
from
mysqltest
.
t2
;
connection
root
;
grant
create
view
,
drop
,
select
on
test
.*
to
mysqltest_1
@
localhost
;
connection
user1
;
# following 'use' command is workaround of bug #9582 and should be removed
# when that bug will be fixed
use
test
;
alter
view
v1
as
select
*
from
mysqltest
.
t1
;
create
or
replace
view
v1
as
select
*
from
mysqltest
.
t1
;
connection
root
;
revoke
all
privileges
on
mysqltest
.
t1
from
mysqltest_1
@
localhost
;
revoke
all
privileges
on
test
.*
from
mysqltest_1
@
localhost
;
...
...
sql/sql_view.cc
View file @
3061a749
...
...
@@ -89,7 +89,7 @@ bool mysql_create_view(THD *thd,
/*
Privilege check for view creation:
- user have CREATE VIEW privilege on view table
- user have D
ELETE
privilege in case of ALTER VIEW or CREATE OR REPLACE
- user have D
ROP
privilege in case of ALTER VIEW or CREATE OR REPLACE
VIEW
- have some (SELECT/UPDATE/INSERT/DELETE) privileges on columns of
underlying tables used on top of SELECT list (because it can be
...
...
@@ -104,9 +104,9 @@ bool mysql_create_view(THD *thd,
0
,
0
)
||
grant_option
&&
check_grant
(
thd
,
CREATE_VIEW_ACL
,
view
,
0
,
1
,
0
))
||
(
mode
!=
VIEW_CREATE_NEW
&&
(
check_access
(
thd
,
D
ELETE
_ACL
,
view
->
db
,
&
view
->
grant
.
privilege
,
(
check_access
(
thd
,
D
ROP
_ACL
,
view
->
db
,
&
view
->
grant
.
privilege
,
0
,
0
)
||
grant_option
&&
check_grant
(
thd
,
D
ELETE
_ACL
,
view
,
0
,
1
,
0
))))
grant_option
&&
check_grant
(
thd
,
D
ROP
_ACL
,
view
,
0
,
1
,
0
))))
DBUG_RETURN
(
TRUE
);
for
(
sl
=
select_lex
;
sl
;
sl
=
sl
->
next_select
())
{
...
...
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