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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
cfd4c976
Commit
cfd4c976
authored
Sep 09, 2008
by
Martin Hansson
Browse files
Options
Browse Files
Download
Plain Diff
Bug#35600: Auto merged.
parents
ac1bcc20
c0cfce21
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
5 deletions
+23
-5
mysql-test/r/view_grant.result
mysql-test/r/view_grant.result
+7
-0
mysql-test/t/view_grant.test
mysql-test/t/view_grant.test
+10
-1
sql/sql_parse.cc
sql/sql_parse.cc
+6
-4
No files found.
mysql-test/r/view_grant.result
View file @
cfd4c976
...
@@ -978,7 +978,9 @@ CREATE DATABASE mysqltest1;
...
@@ -978,7 +978,9 @@ CREATE DATABASE mysqltest1;
USE mysqltest1;
USE mysqltest1;
CREATE VIEW v1 AS SELECT * FROM information_schema.tables LIMIT 1;
CREATE VIEW v1 AS SELECT * FROM information_schema.tables LIMIT 1;
CREATE ALGORITHM = TEMPTABLE VIEW v2 AS SELECT 1 AS A;
CREATE ALGORITHM = TEMPTABLE VIEW v2 AS SELECT 1 AS A;
CREATE VIEW test.v3 AS SELECT 1 AS a;
GRANT SELECT ON mysqltest1.* to mysqluser1@localhost;
GRANT SELECT ON mysqltest1.* to mysqluser1@localhost;
GRANT ALL ON test.* TO mysqluser1@localhost;
PREPARE stmt_v1 FROM "SELECT * FROM mysqltest1.v1";
PREPARE stmt_v1 FROM "SELECT * FROM mysqltest1.v1";
PREPARE stmt_v2 FROM "SELECT * FROM mysqltest1.v2";
PREPARE stmt_v2 FROM "SELECT * FROM mysqltest1.v2";
REVOKE SELECT ON mysqltest1.* FROM mysqluser1@localhost;
REVOKE SELECT ON mysqltest1.* FROM mysqluser1@localhost;
...
@@ -986,6 +988,11 @@ EXECUTE stmt_v1;
...
@@ -986,6 +988,11 @@ EXECUTE stmt_v1;
ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 'v1'
ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 'v1'
EXECUTE stmt_v2;
EXECUTE stmt_v2;
ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 'v2'
ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 'v2'
PREPARE stmt FROM "SELECT a FROM v3";
EXECUTE stmt;
a
1
DROP VIEW v1, v2;
DROP VIEW v1, v2;
DROP DATABASE mysqltest1;
DROP DATABASE mysqltest1;
DROP VIEW test.v3;
DROP USER mysqluser1@localhost;
DROP USER mysqluser1@localhost;
mysql-test/t/view_grant.test
View file @
cfd4c976
...
@@ -1265,8 +1265,11 @@ USE mysqltest1;
...
@@ -1265,8 +1265,11 @@ USE mysqltest1;
CREATE
VIEW
v1
AS
SELECT
*
FROM
information_schema
.
tables
LIMIT
1
;
CREATE
VIEW
v1
AS
SELECT
*
FROM
information_schema
.
tables
LIMIT
1
;
CREATE
ALGORITHM
=
TEMPTABLE
VIEW
v2
AS
SELECT
1
AS
A
;
CREATE
ALGORITHM
=
TEMPTABLE
VIEW
v2
AS
SELECT
1
AS
A
;
CREATE
VIEW
test
.
v3
AS
SELECT
1
AS
a
;
--
connection
default
--
connection
default
GRANT
SELECT
ON
mysqltest1
.*
to
mysqluser1
@
localhost
;
GRANT
SELECT
ON
mysqltest1
.*
to
mysqluser1
@
localhost
;
GRANT
ALL
ON
test
.*
TO
mysqluser1
@
localhost
;
--
connect
(
connection1
,
localhost
,
mysqluser1
,
,
test
)
--
connect
(
connection1
,
localhost
,
mysqluser1
,
,
test
)
PREPARE
stmt_v1
FROM
"SELECT * FROM mysqltest1.v1"
;
PREPARE
stmt_v1
FROM
"SELECT * FROM mysqltest1.v1"
;
...
@@ -1281,9 +1284,15 @@ REVOKE SELECT ON mysqltest1.* FROM mysqluser1@localhost;
...
@@ -1281,9 +1284,15 @@ REVOKE SELECT ON mysqltest1.* FROM mysqluser1@localhost;
EXECUTE
stmt_v1
;
EXECUTE
stmt_v1
;
--
error
ER_TABLEACCESS_DENIED_ERROR
--
error
ER_TABLEACCESS_DENIED_ERROR
EXECUTE
stmt_v2
;
EXECUTE
stmt_v2
;
--
disconnect
connection1
--
disconnect
connection1
--
connect
(
connection2
,
localhost
,
mysqluser1
,,)
PREPARE
stmt
FROM
"SELECT a FROM v3"
;
EXECUTE
stmt
;
--
disconnect
connection2
--
connection
default
--
connection
default
DROP
VIEW
v1
,
v2
;
DROP
VIEW
v1
,
v2
;
DROP
DATABASE
mysqltest1
;
DROP
DATABASE
mysqltest1
;
DROP
VIEW
test
.
v3
;
DROP
USER
mysqluser1
@
localhost
;
DROP
USER
mysqluser1
@
localhost
;
sql/sql_parse.cc
View file @
cfd4c976
...
@@ -5196,12 +5196,14 @@ check_table_access(THD *thd, ulong want_access,TABLE_LIST *tables,
...
@@ -5196,12 +5196,14 @@ check_table_access(THD *thd, ulong want_access,TABLE_LIST *tables,
tables
->
grant
.
privilege
=
want_access
;
tables
->
grant
.
privilege
=
want_access
;
else
if
(
tables
->
db
&&
thd
->
db
&&
strcmp
(
tables
->
db
,
thd
->
db
)
==
0
)
else
if
(
tables
->
db
&&
thd
->
db
&&
strcmp
(
tables
->
db
,
thd
->
db
)
==
0
)
{
{
if
(
check_access
(
thd
,
want_access
,
tables
->
db
,
&
tables
->
grant
.
privilege
,
if
(
check_access
(
thd
,
want_access
,
tables
->
get_db_name
(),
0
,
no_errors
,
test
(
tables
->
schema_table
)))
&
tables
->
grant
.
privilege
,
0
,
no_errors
,
test
(
tables
->
schema_table
)))
goto
deny
;
// Access denied
goto
deny
;
// Access denied
}
}
else
if
(
check_access
(
thd
,
want_access
,
tables
->
db
,
&
tables
->
grant
.
privilege
,
else
if
(
check_access
(
thd
,
want_access
,
tables
->
get_db_name
(),
0
,
no_errors
,
test
(
tables
->
schema_table
)))
&
tables
->
grant
.
privilege
,
0
,
no_errors
,
test
(
tables
->
schema_table
)))
goto
deny
;
goto
deny
;
}
}
thd
->
security_ctx
=
backup_ctx
;
thd
->
security_ctx
=
backup_ctx
;
...
...
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