MDEV-35663 Sporadic connection failures during FLUSH PRIVILEGES

during FLUSH PRIVILEGES, allow_all_hosts temporarily goes out of sync
with acl_check_hosts and acl_wild_hosts.

As it's tested in acl_check_host() without a mutex, let's re-test it
under a mutex to make sure the value is correct.

Note that it's just an optimization and it's ok to see outdated
allow_all_hosts value here.
This commit is contained in:
Sergei Golubchik 2024-12-24 17:53:03 +01:00
parent 9f9072c344
commit 0031f4a74f

View file

@ -3948,7 +3948,8 @@ bool acl_check_host(const char *host, const char *ip)
return 0;
mysql_mutex_lock(&acl_cache->lock);
if ((host && my_hash_search(&acl_check_hosts,(uchar*) host,strlen(host))) ||
if (allow_all_hosts ||
(host && my_hash_search(&acl_check_hosts,(uchar*) host,strlen(host))) ||
(ip && my_hash_search(&acl_check_hosts,(uchar*) ip, strlen(ip))))
{
mysql_mutex_unlock(&acl_cache->lock);