Merge branch '2.1' into 2.2
This commit is contained in:
@ -629,6 +629,25 @@ static bool check_server_permissions(SERVICE *service, SERVER* server,
|
||||
}
|
||||
}
|
||||
|
||||
// Check whether the current user has the SHOW DATABASES privilege
|
||||
if (mxs_mysql_query(mysql, "SELECT show_db_priv FROM mysql.user "
|
||||
"WHERE CONCAT(user, '@', host) = CURRENT_USER()") == 0)
|
||||
{
|
||||
MYSQL_RES* res = mysql_use_result(mysql);
|
||||
if (res)
|
||||
{
|
||||
MYSQL_ROW row = mysql_fetch_row(res);
|
||||
|
||||
if (row && strcasecmp(row[0], "Y") != 0)
|
||||
{
|
||||
MXS_WARNING("[%s] User '%s' is missing the SHOW DATABASES privilege.",
|
||||
service->name, user);
|
||||
}
|
||||
|
||||
mysql_free_result(res);
|
||||
}
|
||||
}
|
||||
|
||||
mysql_close(mysql);
|
||||
|
||||
return rval;
|
||||
|
@ -1435,7 +1435,7 @@ static bool do_show_slave_status(MYSQL_MONITOR* mon,
|
||||
* root master server.
|
||||
* Please note, there could be no slaves at all if Slave_SQL_Running == 'No'
|
||||
*/
|
||||
if (serv_info->slave_status.slave_io_running && server_version != MYSQL_SERVER_VERSION_51)
|
||||
if (server_version != MYSQL_SERVER_VERSION_51)
|
||||
{
|
||||
/* Get Master_Server_Id */
|
||||
master_server_id = scan_server_id(row[i_master_server_id]);
|
||||
|
@ -548,27 +548,20 @@ static inline bool connection_is_valid(ROUTER_INSTANCE* inst, ROUTER_CLIENT_SES*
|
||||
if (SERVER_IS_RUNNING(router_cli_ses->backend->server) &&
|
||||
(router_cli_ses->backend->server->status & inst->bitmask & inst->bitvalue))
|
||||
{
|
||||
if (inst->bitvalue & SERVER_MASTER)
|
||||
if ((inst->bitvalue & SERVER_MASTER) && router_cli_ses->backend->active)
|
||||
{
|
||||
SERVER_REF* master = get_root_master(inst->service->dbref);
|
||||
|
||||
if (master)
|
||||
{
|
||||
/** Check that the master we are connected to and the one we
|
||||
* determined from the replication topology are one and the same */
|
||||
rval = router_cli_ses->backend == get_root_master(inst->service->dbref);
|
||||
}
|
||||
else
|
||||
{
|
||||
/** No master is available but the one we are connected to is
|
||||
* still a master. This most likely means that the servers for
|
||||
* the service have been modified at runtime. */
|
||||
rval = true;
|
||||
}
|
||||
// If we're using an active master server, verify that it is still a master
|
||||
rval = router_cli_ses->backend == get_root_master(inst->service->dbref);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not a master and bitmask check is OK, everything is OK
|
||||
/**
|
||||
* Either we don't use master type servers or the server reference
|
||||
* is deactivated. We let deactivated connection close gracefully
|
||||
* so we simply assume it is OK. This allows a server to be taken
|
||||
* out of use in a manner that won't cause errors to the connected
|
||||
* clients.
|
||||
*/
|
||||
rval = true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user