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
ee555f8f
Commit
ee555f8f
authored
Jul 24, 2019
by
Anel Husakovic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-19948 `SHOW GRANTS` return privileges individually update in 10.2
parent
8fb39b2c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
36 deletions
+50
-36
sql/sql_acl.cc
sql/sql_acl.cc
+50
-36
No files found.
sql/sql_acl.cc
View file @
ee555f8f
...
...
@@ -997,6 +997,56 @@ class User_table: public Grant_table_base
return
get_YN_as_bool
(
is_role
());
}
ulong
get_access
()
const
{
ulong
access
=
Grant_table_base
::
get_access
();
if
((
num_fields
()
<=
13
)
&&
(
access
&
CREATE_ACL
))
access
|=
REFERENCES_ACL
|
INDEX_ACL
|
ALTER_ACL
;
if
(
num_fields
()
<=
18
)
{
access
|=
LOCK_TABLES_ACL
|
CREATE_TMP_ACL
|
SHOW_DB_ACL
;
if
(
access
&
FILE_ACL
)
access
|=
REPL_CLIENT_ACL
|
REPL_SLAVE_ACL
;
if
(
access
&
PROCESS_ACL
)
access
|=
SUPER_ACL
|
EXECUTE_ACL
;
}
/*
If it is pre 5.0.1 privilege table then map CREATE privilege on
CREATE VIEW & SHOW VIEW privileges.
*/
if
(
num_fields
()
<=
31
&&
(
access
&
CREATE_ACL
))
access
|=
(
CREATE_VIEW_ACL
|
SHOW_VIEW_ACL
);
/*
If it is pre 5.0.2 privilege table then map CREATE/ALTER privilege on
CREATE PROCEDURE & ALTER PROCEDURE privileges.
*/
if
(
num_fields
()
<=
33
)
{
if
(
access
&
CREATE_ACL
)
access
|=
CREATE_PROC_ACL
;
if
(
access
&
ALTER_ACL
)
access
|=
ALTER_PROC_ACL
;
}
/*
Pre 5.0.3 did not have CREATE_USER_ACL.
*/
if
(
num_fields
()
<=
36
&&
(
access
&
GRANT_ACL
))
access
|=
CREATE_USER_ACL
;
/*
If it is pre 5.1.6 privilege table then map CREATE privilege on
CREATE|ALTER|DROP|EXECUTE EVENT.
*/
if
(
num_fields
()
<=
37
&&
(
access
&
SUPER_ACL
))
access
|=
EVENT_ACL
;
/*
If it is pre 5.1.6 privilege then map TRIGGER privilege on CREATE.
*/
if
(
num_fields
()
<=
38
&&
(
access
&
SUPER_ACL
))
access
|=
TRIGGER_ACL
;
return
access
&
GLOBAL_ACLS
;
}
private:
friend
class
Grant_tables
;
...
...
@@ -1974,42 +2024,6 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
{
user
.
access
=
user_table
.
get_access
()
&
GLOBAL_ACLS
;
/*
if it is pre 5.0.1 privilege table then map CREATE privilege on
CREATE VIEW & SHOW VIEW privileges
*/
if
(
user_table
.
num_fields
()
<=
31
&&
(
user
.
access
&
CREATE_ACL
))
user
.
access
|=
(
CREATE_VIEW_ACL
|
SHOW_VIEW_ACL
);
/*
if it is pre 5.0.2 privilege table then map CREATE/ALTER privilege on
CREATE PROCEDURE & ALTER PROCEDURE privileges
*/
if
(
user_table
.
num_fields
()
<=
33
&&
(
user
.
access
&
CREATE_ACL
))
user
.
access
|=
CREATE_PROC_ACL
;
if
(
user_table
.
num_fields
()
<=
33
&&
(
user
.
access
&
ALTER_ACL
))
user
.
access
|=
ALTER_PROC_ACL
;
/*
pre 5.0.3 did not have CREATE_USER_ACL
*/
if
(
user_table
.
num_fields
()
<=
36
&&
(
user
.
access
&
GRANT_ACL
))
user
.
access
|=
CREATE_USER_ACL
;
/*
if it is pre 5.1.6 privilege table then map CREATE privilege on
CREATE|ALTER|DROP|EXECUTE EVENT
*/
if
(
user_table
.
num_fields
()
<=
37
&&
(
user
.
access
&
SUPER_ACL
))
user
.
access
|=
EVENT_ACL
;
/*
if it is pre 5.1.6 privilege then map TRIGGER privilege on CREATE.
*/
if
(
user_table
.
num_fields
()
<=
38
&&
(
user
.
access
&
SUPER_ACL
))
user
.
access
|=
TRIGGER_ACL
;
user
.
sort
=
get_sort
(
2
,
user
.
host
.
hostname
,
user
.
user
.
str
);
user
.
hostname_length
=
safe_strlen
(
user
.
host
.
hostname
);
user
.
user_resource
.
user_conn
=
0
;
...
...
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