This commit is contained in:
VilhoRaatikka
2014-11-11 14:25:49 +02:00
10 changed files with 84 additions and 22 deletions

View File

@ -44,6 +44,7 @@
* 12/09/2013 Massimiliano Pinto Added checks in gw_read_backend_event() for gw_read_backend_handshake
* 27/09/2013 Massimiliano Pinto Changed in gw_read_backend_event the check for dcb_read(), now is if rc < 0
* 24/10/2014 Massimiliano Pinto Added Mysql user@host @db authentication support
* 10/11/2014 Massimiliano Pinto Client charset is passed to backend
*
*/
#include <modinfo.h>
@ -914,6 +915,9 @@ static int gw_create_backend_connection(
/** Copy client flags to backend protocol */
protocol->client_capabilities =
((MySQLProtocol *)(backend_dcb->session->client->protocol))->client_capabilities;
/** Copy client charset to backend protocol */
protocol->charset =
((MySQLProtocol *)(backend_dcb->session->client->protocol))->charset;
/*< if succeed, fd > 0, -1 otherwise */
rv = gw_do_connect_to_backend(server->name, server->port, &fd);
@ -1262,6 +1266,16 @@ static int gw_change_user(
/* get new database name */
strcpy(database, (char *)client_auth_packet);
/* get character set */
if (strlen(database)) {
client_auth_packet += strlen(database) + 1;
} else {
client_auth_packet++;
}
if (client_auth_packet && *client_auth_packet)
memcpy(&backend_protocol->charset, client_auth_packet, sizeof(int));
/* save current_database name */
strcpy(current_database, current_session->db);
@ -1515,4 +1529,4 @@ static bool sescmd_response_complete(
succp = false;
}
return succp;
}
}