1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-8280: crash in 'show global status' with --skip-grant-tables

The crash was caused by attempting to use a hashtable without
it getting initialized, due to the --skip-grant-tables switch.
This commit is contained in:
Vicențiu Ciorbaru
2015-06-22 08:44:46 +03:00
parent cbb8b2d033
commit 0357791e3c
3 changed files with 24 additions and 5 deletions

View File

@ -80,3 +80,14 @@ End of 5.0 tests
select no_such_function(1);
ERROR 42000: FUNCTION test.no_such_function does not exist
End of 5.1 tests
show global status like 'Acl%';
Variable_name Value
Acl_column_grants 0
Acl_database_grants 0
Acl_function_grants 0
Acl_procedure_grants 0
Acl_proxy_users 0
Acl_role_grants 0
Acl_roles 0
Acl_table_grants 0
Acl_users 0

View File

@ -132,3 +132,8 @@ select count(*) from information_schema.USER_PRIVILEGES;
select no_such_function(1);
--echo End of 5.1 tests
#
# MDEV-8280 crash in 'show global status' with --skip-grant-tables
#
show global status like 'Acl%';

View File

@ -10383,11 +10383,14 @@ static int show_column_grants(THD *thd, SHOW_VAR *var, char *buff,
var->type= SHOW_ULONG;
var->value= buff;
*(ulong *)buff= 0;
if (initialized)
{
mysql_rwlock_rdlock(&LOCK_grant);
mysql_mutex_lock(&acl_cache->lock);
my_hash_iterate(&column_priv_hash, count_column_grants, buff);
mysql_mutex_unlock(&acl_cache->lock);
mysql_rwlock_unlock(&LOCK_grant);
}
return 0;
}