Backport authentication fix from 2.2

The authentication code assumed that the initial request only had
authentication related data. This is not true if the client library
predicts that the authentication will succeed and it sends a query right
after it sends the authentication data.
This commit is contained in:
Markus Mäkelä
2017-10-30 12:20:18 +02:00
parent 69178318a7
commit 1287b0e595

View File

@ -502,17 +502,12 @@ int gw_read_client_event(DCB* dcb)
*
*/
case MXS_AUTH_STATE_MESSAGE_READ:
/* After this call read_buffer will point to freed data */
if (nbytes_read < 3 || (0 == max_bytes && nbytes_read <
(MYSQL_GET_PAYLOAD_LEN((uint8_t *) GWBUF_DATA(read_buffer)) + 4)) ||
(0 != max_bytes && nbytes_read < max_bytes))
dcb->dcb_readqueue = gwbuf_append(dcb->dcb_readqueue, read_buffer);
if ((read_buffer = modutil_get_next_MySQL_packet(&dcb->dcb_readqueue)))
{
dcb->dcb_readqueue = read_buffer;
return 0;
return_code = gw_read_do_authentication(dcb, read_buffer, gwbuf_length(read_buffer));
}
return_code = gw_read_do_authentication(dcb, read_buffer, nbytes_read);
break;
/**