mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 11:01:52 +01:00
Merge dellis@bk-internal.mysql.com:/home/bk/mysql-4.1
into goetia.(none):/home/dellis/mysqlab/bk/mysql-4.1
This commit is contained in:
commit
f5bc0d774e
1 changed files with 71 additions and 59 deletions
|
@ -3591,7 +3591,7 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)
|
|||
|
||||
int mysql_revoke_all(THD *thd, List <LEX_USER> &list)
|
||||
{
|
||||
uint counter;
|
||||
uint counter, revoked;
|
||||
int result;
|
||||
ACL_DB *acl_db;
|
||||
TABLE_LIST tables[4];
|
||||
|
@ -3624,7 +3624,14 @@ int mysql_revoke_all(THD *thd, List <LEX_USER> &list)
|
|||
}
|
||||
|
||||
/* 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
|
||||
{
|
||||
for (counter= 0, revoked= 0 ; counter < acl_dbs.elements ; )
|
||||
{
|
||||
const char *user,*host;
|
||||
|
||||
|
@ -3641,20 +3648,24 @@ int mysql_revoke_all(THD *thd, List <LEX_USER> &list)
|
|||
{
|
||||
/*
|
||||
Don't increment counter as replace_db_table deleted the
|
||||
current element in acl_db's and shifted the higher elements down
|
||||
current element in acl_dbs.
|
||||
*/
|
||||
revoked= 1;
|
||||
continue;
|
||||
}
|
||||
result= -1; // Something went wrong
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
} while (revoked);
|
||||
|
||||
/* Remove column access */
|
||||
for (counter= 0 ; counter < column_priv_hash.records ; )
|
||||
do
|
||||
{
|
||||
for (counter= 0, revoked= 0 ; counter < column_priv_hash.records ; )
|
||||
{
|
||||
const char *user,*host;
|
||||
GRANT_TABLE *grant_table= (GRANT_TABLE*) hash_element(&column_priv_hash,
|
||||
GRANT_TABLE *grant_table= (GRANT_TABLE*)hash_element(&column_priv_hash,
|
||||
counter);
|
||||
if (!(user=grant_table->user))
|
||||
user= "";
|
||||
|
@ -3670,28 +3681,29 @@ int mysql_revoke_all(THD *thd, List <LEX_USER> &list)
|
|||
~0, 0, 1))
|
||||
{
|
||||
result= -1;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!grant_table->cols)
|
||||
{
|
||||
revoked= 1;
|
||||
continue;
|
||||
}
|
||||
List<LEX_COLUMN> columns;
|
||||
if (replace_column_table(grant_table,tables[3].table, *lex_user,
|
||||
if (!replace_column_table(grant_table,tables[3].table, *lex_user,
|
||||
columns,
|
||||
grant_table->db,
|
||||
grant_table->tname,
|
||||
~0, 1))
|
||||
result= -1;
|
||||
/*
|
||||
Safer to do continue here as replace_table_table changed
|
||||
column_priv_hash and we want to test the current element
|
||||
*/
|
||||
{
|
||||
revoked= 1;
|
||||
continue;
|
||||
}
|
||||
result= -1;
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
} while (revoked);
|
||||
}
|
||||
|
||||
VOID(pthread_mutex_unlock(&acl_cache->lock));
|
||||
|
|
Loading…
Add table
Reference in a new issue