From 66be882ae04d2a984f4c9d11684def632f1330c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 11 Dec 2017 11:33:50 +0200 Subject: [PATCH] Don't reload users for dummy sessions The service for a dummy session will be NULL. If authentication fails for a dummy session, then no service level actions should be taken. Only the binlogrouter can trigger authentication failure with a dummy session as it creates connections before the service itself has started. --- server/core/service.c | 1 + server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/server/core/service.c b/server/core/service.c index d44805132..da1053402 100644 --- a/server/core/service.c +++ b/server/core/service.c @@ -1606,6 +1606,7 @@ service_update(SERVICE *service, char *router, char *user, char *auth) */ int service_refresh_users(SERVICE *service) { + ss_dassert(service); int ret = 1; if (spinlock_acquire_nowait(&service->spin)) diff --git a/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c b/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c index e03761cf7..9d70cc3e3 100644 --- a/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c +++ b/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c @@ -358,8 +358,11 @@ static void handle_error_response(DCB *dcb, GWBUF *buffer) errcode == ER_DBACCESS_DENIED_ERROR || errcode == ER_ACCESS_DENIED_NO_PASSWORD_ERROR) { - // Authentication failed, reload users - service_refresh_users(dcb->service); + if (dcb->session->state != SESSION_STATE_DUMMY) + { + // Authentication failed, reload users + service_refresh_users(dcb->service); + } } }