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
d1fa6ba8
Commit
d1fa6ba8
authored
Jun 08, 2019
by
Oleksandr Byelkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-18328: Make DISKS plugin check some privilege to access information_schema.DISKS table
Check FILE privelege.
parent
65e0c9b9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
3 deletions
+47
-3
plugin/disks/information_schema_disks.cc
plugin/disks/information_schema_disks.cc
+7
-3
plugin/disks/mysql-test/disks/disks_notembedded.result
plugin/disks/mysql-test/disks/disks_notembedded.result
+15
-0
plugin/disks/mysql-test/disks/disks_notembedded.test
plugin/disks/mysql-test/disks/disks_notembedded.test
+25
-0
No files found.
plugin/disks/information_schema_disks.cc
View file @
d1fa6ba8
...
...
@@ -19,6 +19,7 @@
#include <mntent.h>
#include <sql_class.h>
#include <table.h>
#include <sql_acl.h>
/* check_global_access() */
bool
schema_table_store_record
(
THD
*
thd
,
TABLE
*
table
);
...
...
@@ -83,6 +84,9 @@ int disks_fill_table(THD* pThd, TABLE_LIST* pTables, Item* pCond)
int
rv
=
1
;
TABLE
*
pTable
=
pTables
->
table
;
if
(
check_global_access
(
pThd
,
FILE_ACL
,
true
))
return
0
;
FILE
*
pFile
=
setmntent
(
"/etc/mtab"
,
"r"
);
if
(
pFile
)
...
...
@@ -144,11 +148,11 @@ maria_declare_plugin(disks)
PLUGIN_LICENSE_GPL
,
/* license type */
disks_table_init
,
/* init function */
NULL
,
/* deinit function */
0x010
0
,
/* version = 1.0
*/
0x010
1
,
/* version = 1.1
*/
NULL
,
/* no status variables */
NULL
,
/* no system variables */
"1.
0
"
,
/* String version representation */
MariaDB_PLUGIN_MATURITY_
BETA
/* Maturity (see include/mysql/plugin.h)*/
"1.
1
"
,
/* String version representation */
MariaDB_PLUGIN_MATURITY_
STABLE
/* Maturity (see include/mysql/plugin.h)*/
}
mysql_declare_plugin_end
;
...
...
plugin/disks/mysql-test/disks/disks_notembedded.result
0 → 100644
View file @
d1fa6ba8
#
# MDEV-18328: Make DISKS plugin check some privilege to access
# information_schema.DISKS table
#
CREATE USER user1@localhost;
GRANT SELECT ON *.* TO user1@localhost;
select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
sum(Total) > sum(Available) sum(Total)>sum(Used)
NULL NULL
GRANT FILE ON *.* TO user1@localhost;
select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
sum(Total) > sum(Available) sum(Total)>sum(Used)
1 1
DROP USER user1@localhost;
# End of 10.1 tests
plugin/disks/mysql-test/disks/disks_notembedded.test
0 → 100644
View file @
d1fa6ba8
source
include
/
not_embedded
.
inc
;
--
echo
#
--
echo
# MDEV-18328: Make DISKS plugin check some privilege to access
--
echo
# information_schema.DISKS table
--
echo
#
CREATE
USER
user1
@
localhost
;
GRANT
SELECT
ON
*.*
TO
user1
@
localhost
;
connect
(
con1
,
localhost
,
user1
,,);
connection
con1
;
select
sum
(
Total
)
>
sum
(
Available
),
sum
(
Total
)
>
sum
(
Used
)
from
information_schema
.
disks
;
disconnect
con1
;
connection
default
;
GRANT
FILE
ON
*.*
TO
user1
@
localhost
;
connect
(
con1
,
localhost
,
user1
,,);
connection
con1
;
select
sum
(
Total
)
>
sum
(
Available
),
sum
(
Total
)
>
sum
(
Used
)
from
information_schema
.
disks
;
connection
default
;
DROP
USER
user1
@
localhost
;
--
echo
# End of 10.1 tests
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