MXS-1717 Show which listener users are coming from
Earlier, if a service had multiple listeners you would have had MaxScale> show dbusers MyService User names: alice@% ... User names: bob@% ... That is, no indication of which listener is reporting what. With this commit the result will be User names (MyListener1): alice@% ... User names (MyListener2): bob@% ... Further, the diagnostics function of an authenticator is now expected to write the list of users to the provided DCB, without performing any other formatting. The formatting (printing "User names" and appending a line-feed) is now handled by the handler for the MaxAdmin command "show dbusers".
This commit is contained in:
parent
78123a0333
commit
633b08ed0d
@ -2485,7 +2485,11 @@ void service_print_users(DCB *dcb, const SERVICE *service)
|
||||
if (listener_is_active(listener) && listener->listener &&
|
||||
listener->listener->authfunc.diagnostic)
|
||||
{
|
||||
dcb_printf(dcb, "User names (%s): ", listener->name);
|
||||
|
||||
listener->listener->authfunc.diagnostic(dcb, listener);
|
||||
|
||||
dcb_printf(dcb, "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -166,7 +166,6 @@ public:
|
||||
dcb_printf(dcb, "%s%s", sep, it->first.c_str());
|
||||
sep = ", ";
|
||||
}
|
||||
dcb_printf(dcb, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -324,17 +323,7 @@ void users_default_diagnostic(DCB* dcb, SERV_LISTENER* port)
|
||||
{
|
||||
if (port->users)
|
||||
{
|
||||
Users* u = reinterpret_cast<Users*>(port->users);
|
||||
|
||||
if (u->empty())
|
||||
{
|
||||
dcb_printf(dcb, "Users table is empty\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
dcb_printf(dcb, "User names: ");
|
||||
users_diagnostic(dcb, port->users);
|
||||
}
|
||||
users_diagnostic(dcb, port->users);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -641,8 +641,6 @@ int diag_cb(void *data, int columns, char **row, char **field_names)
|
||||
|
||||
void mysql_auth_diagnostic(DCB *dcb, SERV_LISTENER *port)
|
||||
{
|
||||
dcb_printf(dcb, "User names: ");
|
||||
|
||||
MYSQL_AUTH *instance = (MYSQL_AUTH*)port->auth_instance;
|
||||
sqlite3* handle = get_handle(instance);
|
||||
char *err;
|
||||
@ -650,11 +648,10 @@ void mysql_auth_diagnostic(DCB *dcb, SERV_LISTENER *port)
|
||||
if (sqlite3_exec(handle, "SELECT user, host FROM " MYSQLAUTH_USERS_TABLE_NAME,
|
||||
diag_cb, dcb, &err) != SQLITE_OK)
|
||||
{
|
||||
dcb_printf(dcb, "Failed to print users: %s\n", err);
|
||||
MXS_ERROR("Failed to print users: %s", err);
|
||||
dcb_printf(dcb, "Could not access users: %s", err);
|
||||
MXS_ERROR("Could not access users: %s", err);
|
||||
sqlite3_free(err);
|
||||
}
|
||||
dcb_printf(dcb, "\n");
|
||||
}
|
||||
|
||||
int diag_cb_json(void *data, int columns, char **row, char **field_names)
|
||||
|
Loading…
x
Reference in New Issue
Block a user