Merge pull request #3961 from sysown/v2.x-ldap_fixes

V2.x ldap fixes
pull/3967/head
René Cannaò 4 years ago committed by GitHub
commit ea999b48a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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;
}
}
}

@ -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;
}
}

@ -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 {

@ -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);

Loading…
Cancel
Save