diff --git a/lib/MySQL_Protocol.cpp b/lib/MySQL_Protocol.cpp index c33bafac0..27caba7ca 100644 --- a/lib/MySQL_Protocol.cpp +++ b/lib/MySQL_Protocol.cpp @@ -2038,7 +2038,8 @@ __do_auth: proxy_error("Unable to load credentials for backend user %s , associated to LDAP user %s\n", backend_username, user); } } else { - ret=true; + proxy_error("Unable to find backend user associated to LDAP user '%s'\n", user); + ret=false; } } } diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index b10caeb03..c5be72dba 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -641,7 +641,11 @@ MySQL_Session::~MySQL_Session() { break; #endif /* PROXYSQLCLICKHOUSE */ default: - GloMyAuth->decrease_frontend_user_connections(client_myds->myconn->userinfo->username); + if (use_ldap_auth == false) { + GloMyAuth->decrease_frontend_user_connections(client_myds->myconn->userinfo->username); + } else { + GloMyLdapAuth->decrease_frontend_user_connections(client_myds->myconn->userinfo->fe_username); + } break; } } diff --git a/lib/ProxySQL_Admin.cpp b/lib/ProxySQL_Admin.cpp index 6bb1e9f29..2862efc8b 100644 --- a/lib/ProxySQL_Admin.cpp +++ b/lib/ProxySQL_Admin.cpp @@ -1760,12 +1760,12 @@ bool is_valid_global_variable(const char *var_name) { return true; } else if (strlen(var_name) > 6 && !strncmp(var_name, "admin-", 6) && SPA->has_variable(var_name + 6)) { return true; - } else if (strlen(var_name) > 5 && !strncmp(var_name, "ldap-", 5) && GloMyLdapAuth->has_variable(var_name + 5)) { + } else if (strlen(var_name) > 5 && !strncmp(var_name, "ldap-", 5) && GloMyLdapAuth && GloMyLdapAuth->has_variable(var_name + 5)) { return true; - } else if (strlen(var_name) > 13 && !strncmp(var_name, "sqliteserver-", 13) && GloSQLite3Server->has_variable(var_name + 13)) { + } else if (strlen(var_name) > 13 && !strncmp(var_name, "sqliteserver-", 13) && GloSQLite3Server && GloSQLite3Server->has_variable(var_name + 13)) { return true; #ifdef PROXYSQLCLICKHOUSE - } else if (strlen(var_name) > 11 && !strncmp(var_name, "clickhouse-", 11) && GloClickHouseServer->has_variable(var_name + 11)) { + } else if (strlen(var_name) > 11 && !strncmp(var_name, "clickhouse-", 11) && GloClickHouseServer && GloClickHouseServer->has_variable(var_name + 11)) { return true; #endif /* PROXYSQLCLICKHOUSE */ } else { diff --git a/lib/sqlite3db.cpp b/lib/sqlite3db.cpp index d97ccf485..e839ef211 100644 --- a/lib/sqlite3db.cpp +++ b/lib/sqlite3db.cpp @@ -730,7 +730,7 @@ void SQLite3DB::LoadPlugin(const char *plugin_name) { SHA1(fb, statbuf.st_size, temp); memset(binary_sha1_sqlite3, 0, SHA_DIGEST_LENGTH*2+1); char buf[SHA_DIGEST_LENGTH*2]; - for (int i=0; i < SHA_DIGEST_LENGTH; i++) { + for (int i=0; i < SHA_DIGEST_LENGTH - 1; i++) { sprintf((char*)&(buf[i*2]), "%02x", temp[i]); } memcpy(binary_sha1_sqlite3, buf, SHA_DIGEST_LENGTH*2);