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
9e7228dc
Commit
9e7228dc
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
Added implementation for DYNAMIC_ARRAY in ACL_USER
TODO: Memory allocated for the array is never freed
parent
69a3deb5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
20 deletions
+22
-20
sql/sql_acl.cc
sql/sql_acl.cc
+22
-20
No files found.
sql/sql_acl.cc
View file @
9e7228dc
...
...
@@ -230,6 +230,7 @@ class ACL_USER :public ACL_ACCESS
if the instance of the class represents a user, or a user if the
instance of the class represents a role.
*/
//TODO this array does not get freed automatically when acl_users is freed
DYNAMIC_ARRAY
role_grants
;
ACL_USER
*
copy
(
MEM_ROOT
*
root
)
...
...
@@ -597,10 +598,8 @@ enum enum_acl_lists
typedef
struct
st_role_grant
{
char
*
user_username
;
char
*
user_hostname
;
char
*
role_username
;
char
*
role_hostname
;
char
*
username
;
char
*
hostname
;
}
ROLE_GRANT_PAIR
;
/*
Convert scrambled password to binary form, according to scramble type,
...
...
@@ -1054,6 +1053,10 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
user
.
access
|=
SUPER_ACL
|
EXECUTE_ACL
;
#endif
}
(
void
)
my_init_dynamic_array
(
&
user
.
role_grants
,
sizeof
(
ROLE_GRANT_PAIR
),
50
,
100
,
MYF
(
0
));
if
(
is_role
)
{
sql_print_information
(
"Found role %s"
,
user
.
user
.
str
);
my_hash_insert
(
&
acl_roles
,
(
uchar
*
)
user
.
copy
(
&
mem
));
...
...
@@ -1188,32 +1191,31 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
if
(
!
initialized
)
mysql_mutex_lock
(
&
acl_cache
->
lock
);
/* (void) my_init_dynamic_array(&role_grants,sizeof(ROLE_GRANT_PAIR), 50, 100,
MYF(0));
*/
while
(
!
(
read_record_info
.
read_record
(
&
read_record_info
)))
{
ROLE_GRANT_PAIR
p
;
p
.
user_hostname
=
get_field
(
&
mem
,
table
->
field
[
0
]);
p
.
user_username
=
get_field
(
&
mem
,
table
->
field
[
1
]);
p
.
role_hostname
=
get_field
(
&
mem
,
table
->
field
[
2
]);
p
.
role_username
=
get_field
(
&
mem
,
table
->
field
[
3
]);
ACL_USER
*
user
=
find_acl_user
((
p
.
user_hostname
)
?
p
.
user_hostname
:
""
,
(
p
.
user_username
)
?
p
.
user_username
:
""
,
ROLE_GRANT_PAIR
role_ref
;
ROLE_GRANT_PAIR
user_ref
;
user_ref
.
hostname
=
get_field
(
&
mem
,
table
->
field
[
0
]);
user_ref
.
username
=
get_field
(
&
mem
,
table
->
field
[
1
]);
role_ref
.
hostname
=
get_field
(
&
mem
,
table
->
field
[
2
]);
role_ref
.
username
=
get_field
(
&
mem
,
table
->
field
[
3
]);
ACL_USER
*
user
=
find_acl_user
((
user_ref
.
hostname
)
?
user_ref
.
hostname
:
""
,
(
user_ref
.
username
)
?
user_ref
.
username
:
""
,
TRUE
);
ACL_USER
*
role
=
find_acl_role
(
p
.
role_username
?
p
.
role_
username
:
""
);
ACL_USER
*
role
=
find_acl_role
(
role_ref
.
username
?
role_ref
.
username
:
""
);
if
(
user
==
NULL
||
role
==
NULL
)
{
sql_print_error
(
"Invalid roles_mapping table entry '%s@%s', '%s@%s'"
,
p
.
user_username
?
p
.
user_
username
:
""
,
p
.
user_hostname
?
p
.
user_
hostname
:
""
,
p
.
role_username
?
p
.
role_
username
:
""
,
p
.
role_hostname
?
p
.
role_
hostname
:
""
,
user_ref
.
username
?
user_ref
.
username
:
""
,
user_ref
.
hostname
?
user_ref
.
hostname
:
""
,
role_ref
.
username
?
role_ref
.
username
:
""
,
role_ref
.
hostname
?
role_ref
.
hostname
:
""
,
user
,
role
);
continue
;
}
// push_dynamic(&role_grants, (uchar*) &p);
push_dynamic
(
&
user
->
role_grants
,
(
uchar
*
)
&
role_ref
);
push_dynamic
(
&
role
->
role_grants
,
(
uchar
*
)
&
user_ref
);
sql_print_information
(
"Found user %s@%s having role granted %s@%s
\n
"
,
user
->
user
.
str
,
user
->
host
.
hostname
,
role
->
user
.
str
,
role
->
host
.
hostname
);
...
...
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