Merge branch '2.0' into develop-2.0-merge

This commit is contained in:
Markus Makela
2016-11-15 00:09:24 +02:00
26 changed files with 621 additions and 239 deletions

View File

@ -1112,6 +1112,12 @@ static int gw_error_backend_event(DCB *dcb)
CHK_SESSION(session);
if (SESSION_STATE_DUMMY == session->state)
{
if (dcb->persistentstart == 0)
{
/** Not a persistent connection, something is wrong. */
MXS_ERROR("EPOLLERR event on a non-persistent DCB with no session. "
"Closing connection.");
}
dcb_close(dcb);
return 1;
}
@ -1629,13 +1635,19 @@ static int gw_change_user(DCB *backend,
}
else
{
rv = gw_send_change_user_to_backend(database, username, client_sha1, backend_protocol);
/*
* Now copy new data into user session
*/
/** This assumes that authentication will succeed. If authentication fails,
* the internal session will represent the wrong user. This is wrong and
* a check whether the COM_CHANGE_USER succeeded should be done in the
* backend protocol reply handling.
*
* For the time being, it is simpler to assume a COM_CHANGE_USER will always
* succeed if the authentication in MaxScale is successful. In practice this
* might not be true but these cases are handled by the router modules
* and the servers that fail to execute the COM_CHANGE_USER are discarded. */
strcpy(current_session->user, username);
strcpy(current_session->db, database);
memcpy(current_session->client_sha1, client_sha1, sizeof(current_session->client_sha1));
rv = gw_send_change_user_to_backend(database, username, client_sha1, backend_protocol);
}
retblock:

View File

@ -191,6 +191,11 @@ int MySQLSendHandshake(DCB* dcb)
int len_version_string = 0;
int id_num;
if (dcb->service->dbref)
{
mysql_server_language = dcb->service->dbref->server->charset;
}
MySQLProtocol *protocol = DCB_PROTOCOL(dcb, MySQLProtocol);
GWBUF *buf;