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
8ac3b790
Commit
8ac3b790
authored
Oct 22, 2004
by
dellis@goetia.(none)
Browse files
Options
Browse Files
Download
Plain Diff
After-merge fixes.
parents
a3089812
e1d58153
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
59 deletions
+71
-59
sql/sql_acl.cc
sql/sql_acl.cc
+71
-59
No files found.
sql/sql_acl.cc
View file @
8ac3b790
...
@@ -3591,7 +3591,7 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)
...
@@ -3591,7 +3591,7 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)
int
mysql_revoke_all
(
THD
*
thd
,
List
<
LEX_USER
>
&
list
)
int
mysql_revoke_all
(
THD
*
thd
,
List
<
LEX_USER
>
&
list
)
{
{
uint
counter
;
uint
counter
,
revoked
;
int
result
;
int
result
;
ACL_DB
*
acl_db
;
ACL_DB
*
acl_db
;
TABLE_LIST
tables
[
4
];
TABLE_LIST
tables
[
4
];
...
@@ -3624,74 +3624,86 @@ int mysql_revoke_all(THD *thd, List <LEX_USER> &list)
...
@@ -3624,74 +3624,86 @@ int mysql_revoke_all(THD *thd, List <LEX_USER> &list)
}
}
/* Remove db access privileges */
/* Remove db access privileges */
for
(
counter
=
0
;
counter
<
acl_dbs
.
elements
;
)
/*
Because acl_dbs and column_priv_hash shrink and may re-order
as privileges are removed, removal occurs in a repeated loop
until no more privileges are revoked.
*/
do
{
{
const
char
*
user
,
*
host
;
for
(
counter
=
0
,
revoked
=
0
;
counter
<
acl_dbs
.
elements
;
)
acl_db
=
dynamic_element
(
&
acl_dbs
,
counter
,
ACL_DB
*
);
if
(
!
(
user
=
acl_db
->
user
))
user
=
""
;
if
(
!
(
host
=
acl_db
->
host
.
hostname
))
host
=
""
;
if
(
!
strcmp
(
lex_user
->
user
.
str
,
user
)
&&
!
my_strcasecmp
(
system_charset_info
,
lex_user
->
host
.
str
,
host
))
{
{
if
(
!
replace_db_table
(
tables
[
1
].
table
,
acl_db
->
db
,
*
lex_user
,
~
0
,
1
))
const
char
*
user
,
*
host
;
{
/*
acl_db
=
dynamic_element
(
&
acl_dbs
,
counter
,
ACL_DB
*
);
Don't increment counter as replace_db_table deleted the
if
(
!
(
user
=
acl_db
->
user
))
current element in acl_db's and shifted the higher elements down
user
=
""
;
*/
if
(
!
(
host
=
acl_db
->
host
.
hostname
))
continue
;
host
=
""
;
}
result
=
-
1
;
// Something went wrong
if
(
!
strcmp
(
lex_user
->
user
.
str
,
user
)
&&
!
my_strcasecmp
(
system_charset_info
,
lex_user
->
host
.
str
,
host
))
{
if
(
!
replace_db_table
(
tables
[
1
].
table
,
acl_db
->
db
,
*
lex_user
,
~
0
,
1
))
{
/*
Don't increment counter as replace_db_table deleted the
current element in acl_dbs.
*/
revoked
=
1
;
continue
;
}
result
=
-
1
;
// Something went wrong
}
counter
++
;
}
}
counter
++
;
}
while
(
revoked
);
}
/* Remove column access */
/* Remove column access */
for
(
counter
=
0
;
counter
<
column_priv_hash
.
records
;
)
do
{
{
const
char
*
user
,
*
host
;
for
(
counter
=
0
,
revoked
=
0
;
counter
<
column_priv_hash
.
records
;
)
GRANT_TABLE
*
grant_table
=
(
GRANT_TABLE
*
)
hash_element
(
&
column_priv_hash
,
counter
);
if
(
!
(
user
=
grant_table
->
user
))
user
=
""
;
if
(
!
(
host
=
grant_table
->
host
))
host
=
""
;
if
(
!
strcmp
(
lex_user
->
user
.
str
,
user
)
&&
!
my_strcasecmp
(
system_charset_info
,
lex_user
->
host
.
str
,
host
))
{
{
if
(
replace_table_table
(
thd
,
grant_table
,
tables
[
2
].
table
,
*
lex_user
,
const
char
*
user
,
*
host
;
grant_table
->
db
,
GRANT_TABLE
*
grant_table
=
(
GRANT_TABLE
*
)
hash_element
(
&
column_priv_hash
,
grant_table
->
tname
,
counter
);
~
0
,
0
,
1
))
if
(
!
(
user
=
grant_table
->
user
))
{
user
=
""
;
result
=
-
1
;
if
(
!
(
host
=
grant_table
->
host
))
continue
;
host
=
""
;
}
else
if
(
!
strcmp
(
lex_user
->
user
.
str
,
user
)
&&
!
my_strcasecmp
(
system_charset_info
,
lex_user
->
host
.
str
,
host
))
{
{
if
(
!
grant_table
->
cols
)
if
(
replace_table_table
(
thd
,
grant_table
,
tables
[
2
].
table
,
*
lex_user
,
continue
;
grant_table
->
db
,
List
<
LEX_COLUMN
>
columns
;
grant_table
->
tname
,
if
(
replace_column_table
(
grant_table
,
tables
[
3
].
table
,
*
lex_user
,
~
0
,
0
,
1
))
columns
,
{
grant_table
->
db
,
result
=
-
1
;
grant_table
->
tname
,
}
~
0
,
1
))
else
result
=
-
1
;
if
(
!
grant_table
->
cols
)
/*
{
Safer to do continue here as replace_table_table changed
revoked
=
1
;
column_priv_hash and we want to test the current element
continue
;
*/
}
continue
;
List
<
LEX_COLUMN
>
columns
;
if
(
!
replace_column_table
(
grant_table
,
tables
[
3
].
table
,
*
lex_user
,
columns
,
grant_table
->
db
,
grant_table
->
tname
,
~
0
,
1
))
{
revoked
=
1
;
continue
;
}
result
=
-
1
;
}
}
}
counter
++
;
}
}
counter
++
;
}
while
(
revoked
);
}
}
}
VOID
(
pthread_mutex_unlock
(
&
acl_cache
->
lock
));
VOID
(
pthread_mutex_unlock
(
&
acl_cache
->
lock
));
...
...
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