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
de523f7f
Commit
de523f7f
authored
Oct 17, 2013
by
Vicențiu Ciorbaru
Committed by
Sergei Golubchik
Oct 17, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored function to allow for better code clarity.
parent
887a1ac8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
sql/sql_acl.cc
sql/sql_acl.cc
+18
-6
No files found.
sql/sql_acl.cc
View file @
de523f7f
...
...
@@ -608,8 +608,7 @@ static my_bool grant_load(THD *thd, TABLE_LIST *tables);
static
inline
void
get_grantor
(
THD
*
thd
,
char
*
grantor
);
static
my_bool
acl_user_reset_grant
(
ACL_USER
*
user
,
void
*
not_used
__attribute__
((
unused
)));
static
my_bool
add_role_user_mapping
(
ROLE_GRANT_PAIR
*
entry
,
void
*
not_used
__attribute__
((
unused
)));
static
my_bool
add_role_user_mapping
(
ROLE_GRANT_PAIR
*
entry
);
/*
Enumeration of various ACL's and Hashes used in handle_grant_struct()
...
...
@@ -1253,7 +1252,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
mapping
->
hashkey
.
str
=
buff
;
mapping
->
hashkey
.
length
=
len
[
0
]
+
len
[
1
]
+
len
[
2
]
+
len
[
3
];
if
(
add_role_user_mapping
(
mapping
,
NULL
)
==
1
)
{
if
(
add_role_user_mapping
(
mapping
)
==
1
)
{
sql_print_error
(
"Invalid roles_mapping table entry '%s@%s', '%s@%s'"
,
mapping
->
u_uname
?
mapping
->
u_uname
:
""
,
mapping
->
u_hname
?
mapping
->
u_hname
:
""
,
...
...
@@ -2026,8 +2025,12 @@ my_bool acl_user_reset_grant(ACL_USER *user,
return
0
;
}
my_bool
add_role_user_mapping
(
ROLE_GRANT_PAIR
*
mapping
,
void
*
not_used
__attribute__
((
unused
)))
/*
Add a the coresponding pointers present in the mapping to the entries in
acl_users and acl_roles
*/
my_bool
add_role_user_mapping
(
ROLE_GRANT_PAIR
*
mapping
)
{
ACL_USER
*
user
=
find_acl_user
((
mapping
->
u_hname
)
?
mapping
->
u_hname
:
""
,
(
mapping
->
u_uname
)
?
mapping
->
u_uname
:
""
,
...
...
@@ -2046,6 +2049,15 @@ my_bool add_role_user_mapping(ROLE_GRANT_PAIR *mapping,
}
static
my_bool
roles_mappings_walk_action
(
ROLE_GRANT_PAIR
*
mapping
,
void
*
not_used
__attribute__
((
unused
)))
{
if
(
add_role_user_mapping
(
mapping
))
{
//the mapping is invalid, the mapping can be safely deleted
my_hash_delete
(
&
acl_roles_mappings
,
(
uchar
*
)
mapping
);
}
return
0
;
}
void
rebuild_role_grants
(
void
)
{
/*
...
...
@@ -2059,7 +2071,7 @@ void rebuild_role_grants(void)
(
my_hash_walk_action
)
acl_user_reset_grant
,
NULL
);
my_hash_iterate
(
&
acl_roles_mappings
,
(
my_hash_walk_action
)
add_role_user_mapping
,
NULL
);
(
my_hash_walk_action
)
roles_mappings_walk_action
,
0
);
}
/* Return true if there is no users that can match the given host */
...
...
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