MXS-1457: Inject service credentials if no users are loaded

If the authenticator option is enabled, no users are loaded and no errors
have occurred in the user loading process, the service credentials are
injected.
This commit is contained in:
Markus Mäkelä 2017-09-27 20:00:39 +03:00
parent 395b445336
commit 016ad77b62

View File

@ -621,11 +621,15 @@ static int mysql_auth_load_users(SERV_LISTENER *port)
}
int loaded = replace_mysql_users(port, skip_local);
bool injected = false;
if (loaded < 0)
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 : "::", port->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 : "::", port->port);
}
if (instance->inject_service_user)
{
@ -635,10 +639,20 @@ static int mysql_auth_load_users(SERV_LISTENER *port)
{
MXS_ERROR("[%s] Failed to inject service user.", port->service->name);
}
else
{
injected = true;
}
}
}
if (loaded == 0 && !skip_local)
if (injected)
{
MXS_NOTICE("[%s] No users were loaded but 'inject_service_user' is enabled. "
"Enabling service credentials for authentication until "
"database users have been successfully loaded.", service->name);
}
else if (loaded == 0 && !skip_local)
{
MXS_WARNING("[%s]: failed to load any user information. Authentication"
" will probably fail as a result.", service->name);