Merge branch 'release-1.0beta-refresh' into cmake_build
This commit is contained in:
@ -492,6 +492,7 @@ static int gw_read_backend_event(DCB *dcb) {
|
||||
dcb->dcb_readqueue = NULL;
|
||||
}
|
||||
}
|
||||
/** This may be either short prefix of a packet, or the tail of it. */
|
||||
else
|
||||
{
|
||||
if (nbytes_read < 5)
|
||||
|
||||
@ -42,6 +42,7 @@
|
||||
#include <mysql_client_server_protocol.h>
|
||||
#include <gw.h>
|
||||
#include <modinfo.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
MODULE_INFO info = {
|
||||
MODULE_API_PROTOCOL,
|
||||
@ -552,15 +553,16 @@ int gw_read_client_event(
|
||||
*/
|
||||
if (dcb->dcb_readqueue)
|
||||
{
|
||||
uint8_t* data = (uint8_t *)GWBUF_DATA(read_buffer);
|
||||
uint8_t* data;
|
||||
|
||||
read_buffer = gwbuf_append(dcb->dcb_readqueue, read_buffer);
|
||||
nbytes_read = gwbuf_length(read_buffer);
|
||||
dcb->dcb_readqueue = gwbuf_append(dcb->dcb_readqueue, read_buffer);
|
||||
nbytes_read = gwbuf_length(dcb->dcb_readqueue);
|
||||
data = (uint8_t *)GWBUF_DATA(dcb->dcb_readqueue);
|
||||
|
||||
if (nbytes_read < 3 || nbytes_read < MYSQL_GET_PACKET_LEN(data))
|
||||
{
|
||||
rc = 0;
|
||||
goto return_rc;
|
||||
rc = 0;
|
||||
goto return_rc;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -578,8 +580,8 @@ int gw_read_client_event(
|
||||
|
||||
if (nbytes_read < 3 || nbytes_read < MYSQL_GET_PACKET_LEN(data)+4)
|
||||
{
|
||||
gwbuf_append(dcb->dcb_readqueue, read_buffer);
|
||||
rc = 0;
|
||||
dcb->dcb_readqueue = gwbuf_append(dcb->dcb_readqueue, read_buffer);
|
||||
rc = 0;
|
||||
goto return_rc;
|
||||
}
|
||||
}
|
||||
@ -789,7 +791,7 @@ int gw_read_client_event(
|
||||
if (read_buffer != NULL)
|
||||
{
|
||||
/** add incomplete mysql packet to read queue */
|
||||
gwbuf_append(dcb->dcb_readqueue, read_buffer);
|
||||
dcb->dcb_readqueue = gwbuf_append(dcb->dcb_readqueue, read_buffer);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1443,7 +1445,11 @@ static int route_by_statement(
|
||||
do
|
||||
{
|
||||
ss_dassert(GWBUF_IS_TYPE_MYSQL((*p_readbuf)));
|
||||
|
||||
|
||||
/**
|
||||
* Collect incoming bytes to a buffer until complete packet has
|
||||
* arrived and then return the buffer.
|
||||
*/
|
||||
packetbuf = gw_MySQL_get_next_packet(p_readbuf);
|
||||
|
||||
if (packetbuf != NULL)
|
||||
|
||||
@ -26,6 +26,11 @@
|
||||
* 04/09/2013 Massimiliano Pinto Added dcb NULL assert in mysql_send_custom_error
|
||||
* 12/09/2013 Massimiliano Pinto Added checks in gw_decode_mysql_server_handshake and gw_read_backend_handshake
|
||||
* 10/02/2014 Massimiliano Pinto Added MySQL Authentication with user@host
|
||||
* 10/09/2014 Massimiliano Pinto Added MySQL Authentication option enabling localhost match with any host (wildcard %)
|
||||
* Backend server configuration may differ so default is 0, don't match and an explicit
|
||||
* localhost entry should be added for the selected user in the backends.
|
||||
* Setting to 1 allow localhost (127.0.0.1 or socket) to match the any host grant via
|
||||
* user@%
|
||||
*
|
||||
*/
|
||||
|
||||
@ -1345,12 +1350,12 @@ int gw_find_mysql_user_password_sha1(char *username, uint8_t *gateway_password,
|
||||
* The check for localhost is 127.0.0.1 (IPv4 only)
|
||||
*/
|
||||
|
||||
if (key.ipv4.sin_addr.s_addr == 0x0100007F) {
|
||||
if ((key.ipv4.sin_addr.s_addr == 0x0100007F) && !dcb->service->localhost_match_wildcard_host) {
|
||||
/* Skip the wildcard check and return 1 */
|
||||
LOGIF(LD,
|
||||
LOGIF(LE,
|
||||
(skygw_log_write_flush(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [MySQL Client Auth], user [%s@%s] not existent",
|
||||
LOGFILE_ERROR,
|
||||
"%lu [MySQL Client Auth], user [%s@%s] not found, please try with 'localhost_match_wildcard_host=1' in service definition",
|
||||
pthread_self(),
|
||||
key.user,
|
||||
dcb->remote)));
|
||||
@ -1530,9 +1535,7 @@ GWBUF* gw_MySQL_get_next_packet(
|
||||
{
|
||||
packetbuf = NULL;
|
||||
goto return_packetbuf;
|
||||
}
|
||||
|
||||
buflen = GWBUF_LENGTH((readbuf));
|
||||
}
|
||||
totalbuflen = gwbuf_length(readbuf);
|
||||
data = (uint8_t *)GWBUF_DATA((readbuf));
|
||||
packetlen = MYSQL_GET_PACKET_LEN(data)+4;
|
||||
@ -1556,6 +1559,7 @@ GWBUF* gw_MySQL_get_next_packet(
|
||||
uint8_t* src = GWBUF_DATA((*p_readbuf));
|
||||
size_t bytestocopy;
|
||||
|
||||
buflen = GWBUF_LENGTH((*p_readbuf));
|
||||
bytestocopy = MIN(buflen,packetlen-nbytes_copied);
|
||||
|
||||
memcpy(target+nbytes_copied, src, bytestocopy);
|
||||
@ -1569,7 +1573,6 @@ return_packetbuf:
|
||||
return packetbuf;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Move <npackets> from buffer pointed to by <*p_readbuf>.
|
||||
*/
|
||||
@ -1694,8 +1697,9 @@ void protocol_add_srv_command(
|
||||
MySQLProtocol* p,
|
||||
mysql_server_cmd_t cmd)
|
||||
{
|
||||
#if defined(SS_DEBUG)
|
||||
server_command_t* c;
|
||||
|
||||
#endif
|
||||
spinlock_acquire(&p->protocol_lock);
|
||||
|
||||
if (p->protocol_state != MYSQL_PROTOCOL_ACTIVE)
|
||||
|
||||
Reference in New Issue
Block a user