From 4359b1f72fb92f0f1333237b9084a4e9dbdd734f Mon Sep 17 00:00:00 2001 From: Christos Soulios <1561376+csoulios@users.noreply.github.com> Date: Fri, 2 Jul 2021 18:49:45 +0300 Subject: [PATCH] Count connections for frontend user, not backend --- include/MySQL_LDAP_Authentication.hpp | 2 +- lib/MySQL_Session.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/MySQL_LDAP_Authentication.hpp b/include/MySQL_LDAP_Authentication.hpp index f42b7edfd..b4aea1dde 100644 --- a/include/MySQL_LDAP_Authentication.hpp +++ b/include/MySQL_LDAP_Authentication.hpp @@ -9,7 +9,7 @@ public: bool *fast_forward, int *max_connections, void **sha1_pass, char **attributes, char **backend_username) {return NULL;}; - virtual int increase_frontend_user_connections(char *username, int *mc=NULL) {return 0;}; + virtual int increase_frontend_user_connections(char *username, int *max_connections = NULL) { return 0; }; virtual void decrease_frontend_user_connections(char *username) {}; virtual void wrlock() {}; diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index 57d5639fb..56f53e46a 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -4927,7 +4927,7 @@ void MySQL_Session::handler___status_CONNECTING_CLIENT___STATE_SERVER_HANDSHAKE( case PROXYSQL_SESSION_MYSQL: proxy_debug(PROXY_DEBUG_MYSQL_CONNECTION,8,"Session=%p , DS=%p , session_type=PROXYSQL_SESSION_MYSQL\n", this, client_myds); if (use_ldap_auth == true) { - free_users = GloMyLdapAuth->increase_frontend_user_connections(client_myds->myconn->userinfo->username, &used_users); + free_users = GloMyLdapAuth->increase_frontend_user_connections(client_myds->myconn->userinfo->fe_username, &used_users); } else { free_users = GloMyAuth->increase_frontend_user_connections(client_myds->myconn->userinfo->username, &used_users); } @@ -6203,7 +6203,7 @@ void MySQL_Session::handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_C init(); if (client_authenticated) { if (use_ldap_auth == true) { - GloMyLdapAuth->decrease_frontend_user_connections(client_myds->myconn->userinfo->username); + GloMyLdapAuth->decrease_frontend_user_connections(client_myds->myconn->userinfo->fe_username); } else { GloMyAuth->decrease_frontend_user_connections(client_myds->myconn->userinfo->username); }