MXS-2496: Check for ALL PRIVILEGES grant

If a user has ALL PRIVILEGES as a global privilege, it overshadows the
SHOW DATABASES grant.
This commit is contained in:
Markus Mäkelä 2019-05-21 18:25:07 +03:00
parent 365efb9d3a
commit 8317fec745
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -823,8 +823,10 @@ static bool check_server_permissions(SERVICE* service,
for (MYSQL_ROW row = mysql_fetch_row(res); row; row = mysql_fetch_row(res))
{
if (strcasestr(row[0], "SHOW DATABASES"))
if (strcasestr(row[0], "SHOW DATABASES") || strcasestr(row[0], "ALL PRIVILEGES ON *.*"))
{
// GRANT ALL PRIVILEGES ON *.* will overwrite SHOW DATABASES so it needs to be checked
// separately
found = true;
break;
}