Merge branch '2.1' into develop
This commit is contained in:
@ -202,6 +202,20 @@ int validate_mysql_user(sqlite3 *handle, DCB *dcb, MYSQL_session *session,
|
||||
sqlite3_free(err);
|
||||
}
|
||||
|
||||
/** Check for IPv6 mapped IPv4 address */
|
||||
if (!res.ok && strchr(dcb->remote, ':') && strchr(dcb->remote, '.'))
|
||||
{
|
||||
const char *ipv4 = strrchr(dcb->remote, ':') + 1;
|
||||
sprintf(sql, mysqlauth_validate_user_query, session->user, ipv4, ipv4,
|
||||
session->db, session->db);
|
||||
|
||||
if (sqlite3_exec(handle, sql, auth_cb, &res, &err) != SQLITE_OK)
|
||||
{
|
||||
MXS_ERROR("Failed to execute auth query: %s", err);
|
||||
sqlite3_free(err);
|
||||
}
|
||||
}
|
||||
|
||||
if (!res.ok)
|
||||
{
|
||||
/**
|
||||
@ -494,7 +508,7 @@ static bool check_server_permissions(SERVICE *service, SERVER* server,
|
||||
{
|
||||
int my_errno = mysql_errno(mysql);
|
||||
|
||||
MXS_ERROR("[%s] Failed to connect to server '%s' (%s:%d) when"
|
||||
MXS_ERROR("[%s] Failed to connect to server '%s' ([%s]:%d) when"
|
||||
" checking authentication user credentials and permissions: %d %s",
|
||||
service->name, server->unique_name, server->name, server->port,
|
||||
my_errno, mysql_error(mysql));
|
||||
|
@ -350,7 +350,7 @@ mysql_auth_authenticate(DCB *dcb)
|
||||
}
|
||||
else if (dcb->service->log_auth_warnings)
|
||||
{
|
||||
MXS_WARNING("%s: login attempt for user '%s'@%s:%d, authentication failed.",
|
||||
MXS_WARNING("%s: login attempt for user '%s'@[%s]:%d, authentication failed.",
|
||||
dcb->service->name, client_data->user, dcb->remote, dcb_get_port(dcb));
|
||||
|
||||
if (is_localhost_address(&dcb->ip) &&
|
||||
@ -608,12 +608,6 @@ static int mysql_auth_load_users(SERV_LISTENER *port)
|
||||
int rc = MXS_AUTH_LOADUSERS_OK;
|
||||
SERVICE *service = port->listener->service;
|
||||
MYSQL_AUTH *instance = (MYSQL_AUTH*)port->auth_instance;
|
||||
|
||||
if (port->users == NULL && !check_service_permissions(port->service))
|
||||
{
|
||||
return MXS_AUTH_LOADUSERS_FATAL;
|
||||
}
|
||||
|
||||
bool skip_local = false;
|
||||
|
||||
if (instance->handle == NULL)
|
||||
@ -621,7 +615,8 @@ static int mysql_auth_load_users(SERV_LISTENER *port)
|
||||
skip_local = true;
|
||||
char path[PATH_MAX];
|
||||
get_database_path(port, path, sizeof(path));
|
||||
if (!open_instance_database(path, &instance->handle))
|
||||
if (!check_service_permissions(port->service) ||
|
||||
!open_instance_database(path, &instance->handle))
|
||||
{
|
||||
return MXS_AUTH_LOADUSERS_FATAL;
|
||||
}
|
||||
@ -631,8 +626,8 @@ static int mysql_auth_load_users(SERV_LISTENER *port)
|
||||
|
||||
if (loaded < 0)
|
||||
{
|
||||
MXS_ERROR("[%s] Unable to load users for listener %s listening at %s:%d.", service->name,
|
||||
port->name, port->address ? port->address : "0.0.0.0", port->port);
|
||||
MXS_ERROR("[%s] Unable to load users for listener %s listening at [%s]:%d.", service->name,
|
||||
port->name, port->address ? port->address : "::", port->port);
|
||||
|
||||
if (instance->inject_service_user)
|
||||
{
|
||||
|
Reference in New Issue
Block a user