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
cf9ebd72
Commit
cf9ebd72
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 find_mpvio_user. The loop that searches for the user is now a
separate function.
parent
e8d64258
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
12 deletions
+27
-12
sql/sql_acl.cc
sql/sql_acl.cc
+27
-12
No files found.
sql/sql_acl.cc
View file @
cf9ebd72
...
...
@@ -637,6 +637,7 @@ static void rebuild_role_grants(void);
static
void
free_acl_user
(
ACL_USER
*
acl_user
);
static
ACL_USER
*
find_user_no_anon
(
const
char
*
host
,
const
char
*
user
,
my_bool
exact
);
static
ACL_USER
*
find_user
(
const
char
*
host
,
const
char
*
user
,
const
char
*
ip
);
static
ACL_USER
*
find_acl_role
(
const
char
*
user
);
static
bool
update_user_table
(
THD
*
thd
,
TABLE
*
table
,
const
char
*
host
,
const
char
*
user
,
const
char
*
new_password
,
...
...
@@ -2412,6 +2413,26 @@ bool is_acl_user(const char *host, const char *user)
}
static
ACL_USER
*
find_user
(
const
char
*
host
,
const
char
*
user
,
const
char
*
ip
)
{
ACL_USER
*
result
=
NULL
;
mysql_mutex_assert_owner
(
&
acl_cache
->
lock
);
for
(
uint
i
=
0
;
i
<
acl_users
.
elements
;
i
++
)
{
ACL_USER
*
acl_user_tmp
=
dynamic_element
(
&
acl_users
,
i
,
ACL_USER
*
);
if
((
!
acl_user_tmp
->
user
.
str
||
!
strcmp
(
user
,
acl_user_tmp
->
user
.
str
))
&&
compare_hostname
(
&
acl_user_tmp
->
host
,
host
,
ip
))
{
result
=
acl_user_tmp
;
break
;
}
}
return
result
;
}
/*
Find first entry that matches the current user
*/
...
...
@@ -8703,17 +8724,11 @@ static bool find_mpvio_user(MPVIO_EXT *mpvio)
DBUG_ASSERT
(
mpvio
->
acl_user
==
0
);
mysql_mutex_lock
(
&
acl_cache
->
lock
);
for
(
uint
i
=
0
;
i
<
acl_users
.
elements
;
i
++
)
{
ACL_USER
*
acl_user_tmp
=
dynamic_element
(
&
acl_users
,
i
,
ACL_USER
*
);
if
((
!
acl_user_tmp
->
user
.
str
||
!
strcmp
(
sctx
->
user
,
acl_user_tmp
->
user
.
str
))
&&
compare_hostname
(
&
acl_user_tmp
->
host
,
sctx
->
host
,
sctx
->
ip
))
{
mpvio
->
acl_user
=
acl_user_tmp
->
copy
(
mpvio
->
thd
->
mem_root
);
break
;
}
}
ACL_USER
*
user
=
find_user
(
sctx
->
host
,
sctx
->
user
,
sctx
->
ip
);
if
(
user
)
mpvio
->
acl_user
=
user
->
copy
(
&
mem
);
mysql_mutex_unlock
(
&
acl_cache
->
lock
);
if
(
!
mpvio
->
acl_user
)
...
...
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