mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
Bug#6123 - GRANT USAGE creates useless mysql.db row
Prevent creation of a row which grants no rights Test included
This commit is contained in:
parent
54dac2cfac
commit
2ad7d5c662
3 changed files with 17 additions and 1 deletions
|
@ -150,3 +150,9 @@ GRANT SELECT ON `ab%`.* TO 'test11'@'localhost'
|
|||
GRANT SELECT ON `a%`.* TO 'test11'@'localhost'
|
||||
delete from mysql.user where user='test11';
|
||||
delete from mysql.db where user='test11';
|
||||
create database db6123;
|
||||
grant usage on db6123.* to test6123 identified by 'magic123';
|
||||
select host,db,user,select_priv,insert_priv from mysql.db where db="db6123";
|
||||
host db user select_priv insert_priv
|
||||
delete from mysql.user where user='test6123';
|
||||
drop database db6123;
|
||||
|
|
|
@ -105,3 +105,12 @@ flush privileges;
|
|||
show grants for test11@localhost;
|
||||
delete from mysql.user where user='test11';
|
||||
delete from mysql.db where user='test11';
|
||||
|
||||
#
|
||||
# Bug#6123: GRANT USAGE inserts useless Db row
|
||||
#
|
||||
create database db6123;
|
||||
grant usage on db6123.* to test6123 identified by 'magic123';
|
||||
select host,db,user,select_priv,insert_priv from mysql.db where db="db6123";
|
||||
delete from mysql.user where user='test6123';
|
||||
drop database db6123;
|
||||
|
|
|
@ -1587,7 +1587,7 @@ static int replace_db_table(TABLE *table, const char *db,
|
|||
goto table_error; /* purecov: deadcode */
|
||||
}
|
||||
}
|
||||
else if ((error=table->file->write_row(table->record[0])))
|
||||
else if (rights && (error=table->file->write_row(table->record[0])))
|
||||
{
|
||||
if (error && error != HA_ERR_FOUND_DUPP_KEY) /* purecov: inspected */
|
||||
goto table_error; /* purecov: deadcode */
|
||||
|
@ -1597,6 +1597,7 @@ static int replace_db_table(TABLE *table, const char *db,
|
|||
if (old_row_exists)
|
||||
acl_update_db(combo.user.str,combo.host.str,db,rights);
|
||||
else
|
||||
if (rights)
|
||||
acl_insert_db(combo.user.str,combo.host.str,db,rights);
|
||||
table->file->index_end();
|
||||
DBUG_RETURN(0);
|
||||
|
|
Loading…
Reference in a new issue