Merge branch '2.3' into develop
This commit is contained in:
@ -312,17 +312,20 @@ static int database_cb(void* data, int columns, char** rows, char** row_names)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool check_database(sqlite3* handle, const char* database)
|
||||
static bool check_database(MYSQL_AUTH* instance, sqlite3* handle, const char* database)
|
||||
{
|
||||
bool rval = true;
|
||||
|
||||
if (*database)
|
||||
{
|
||||
rval = false;
|
||||
size_t len = sizeof(mysqlauth_validate_database_query) + strlen(database) + 1;
|
||||
const char* query = instance->lower_case_table_names ?
|
||||
mysqlauth_validate_database_query_lower :
|
||||
mysqlauth_validate_database_query;
|
||||
size_t len = strlen(query) + strlen(database) + 1;
|
||||
char sql[len];
|
||||
|
||||
sprintf(sql, mysqlauth_validate_database_query, database);
|
||||
sprintf(sql, query, database);
|
||||
|
||||
char* err;
|
||||
|
||||
@ -453,7 +456,7 @@ int validate_mysql_user(MYSQL_AUTH* instance,
|
||||
session->client_sha1))
|
||||
{
|
||||
/** Password is OK, check that the database exists */
|
||||
if (check_database(handle, session->db))
|
||||
if (check_database(instance, handle, session->db))
|
||||
{
|
||||
rval = MXS_AUTH_SUCCEEDED;
|
||||
}
|
||||
|
@ -71,6 +71,8 @@ static const char mysqlauth_skip_auth_query[] =
|
||||
/** Query that checks that the database exists */
|
||||
static const char mysqlauth_validate_database_query[] =
|
||||
"SELECT * FROM " MYSQLAUTH_DATABASES_TABLE_NAME " WHERE db = '%s' LIMIT 1";
|
||||
static const char mysqlauth_validate_database_query_lower[] =
|
||||
"SELECT * FROM " MYSQLAUTH_DATABASES_TABLE_NAME " WHERE LOWER(db) = LOWER('%s') LIMIT 1";
|
||||
|
||||
/** Delete query used to clean up the database before loading new users */
|
||||
static const char delete_users_query[] = "DELETE FROM " MYSQLAUTH_USERS_TABLE_NAME;
|
||||
|
@ -187,10 +187,6 @@ MariaDBMonitor* MariaDBMonitor::create(const string& name, const string& module)
|
||||
*/
|
||||
bool MariaDBMonitor::configure(const MXS_CONFIG_PARAMETER* params)
|
||||
{
|
||||
/* Reset all monitored state info. The server dependent values must be reset as servers could have been
|
||||
* added, removed and modified. */
|
||||
reset_server_info();
|
||||
|
||||
m_detect_stale_master = params->get_bool("detect_stale_master");
|
||||
m_detect_stale_slave = params->get_bool("detect_stale_slave");
|
||||
m_ignore_external_masters = params->get_bool("ignore_external_masters");
|
||||
@ -210,6 +206,10 @@ bool MariaDBMonitor::configure(const MXS_CONFIG_PARAMETER* params)
|
||||
m_maintenance_on_low_disk_space = params->get_bool(CN_MAINTENANCE_ON_LOW_DISK_SPACE);
|
||||
m_handle_event_scheduler = params->get_bool(CN_HANDLE_EVENTS);
|
||||
|
||||
/* Reset all monitored state info. The server dependent values must be reset as servers could have been
|
||||
* added, removed and modified. */
|
||||
reset_server_info();
|
||||
|
||||
m_excluded_servers.clear();
|
||||
bool settings_ok = true;
|
||||
bool list_error = false;
|
||||
|
@ -332,11 +332,10 @@ static void handle_error_response(DCB* dcb, GWBUF* buffer)
|
||||
* This will prevent repeated authentication failures. */
|
||||
if (errcode == ER_HOST_IS_BLOCKED)
|
||||
{
|
||||
MXS_ERROR("Server %s has been put into maintenance mode due "
|
||||
"to the server blocking connections from MaxScale. "
|
||||
"Run 'mysqladmin -h %s -P %d flush-hosts' on this "
|
||||
"server before taking this server out of maintenance "
|
||||
"mode.",
|
||||
MXS_ERROR("Server %s has been put into maintenance mode due to the server blocking connections "
|
||||
"from MaxScale. Run 'mysqladmin -h %s -P %d flush-hosts' on this server before taking "
|
||||
"this server out of maintenance mode. To avoid this problem in the future, set "
|
||||
"'max_connect_errors' to a larger value in the backend server.",
|
||||
dcb->server->name(),
|
||||
dcb->server->address,
|
||||
dcb->server->port);
|
||||
|
@ -667,11 +667,12 @@ static std::string get_next_filename(std::string file, std::string dir)
|
||||
{
|
||||
// Find the last and second to last dot
|
||||
auto last = file.find_last_of('.');
|
||||
auto almost_last = file.find_last_of('.', last);
|
||||
auto part = file.substr(0, last);
|
||||
auto almost_last = part.find_last_of('.');
|
||||
mxb_assert(last != std::string::npos && almost_last != std::string::npos);
|
||||
|
||||
// Extract the number between the dots
|
||||
std::string number_part = file.substr(almost_last + 1, last);
|
||||
std::string number_part = part.substr(almost_last + 1, std::string::npos);
|
||||
int filenum = strtol(number_part.c_str(), NULL, 10);
|
||||
|
||||
std::string file_part = file.substr(0, almost_last);
|
||||
|
Reference in New Issue
Block a user