Added logging to place where authentication with backend fails and the reason is unknown.
This commit is contained in:
@ -315,12 +315,17 @@ int gw_receive_backend_auth(
|
|||||||
/*<
|
/*<
|
||||||
* 5th byte is 0x0 if successful.
|
* 5th byte is 0x0 if successful.
|
||||||
*/
|
*/
|
||||||
if (ptr[4] == '\x00') {
|
if (ptr[4] == 0x00)
|
||||||
|
{
|
||||||
rc = 1;
|
rc = 1;
|
||||||
} else {
|
}
|
||||||
uint8_t* tmpbuf =
|
else if (ptr[4] == 0xff)
|
||||||
(uint8_t *)calloc(1, GWBUF_LENGTH(head)+1);
|
{
|
||||||
memcpy(tmpbuf, ptr, GWBUF_LENGTH(head));
|
size_t packetlen = MYSQL_GET_PACKET_LEN(ptr)+4;
|
||||||
|
char* bufstr = (char *)calloc(1, packetlen-3);
|
||||||
|
|
||||||
|
snprintf(bufstr, packetlen-6, "%s", &ptr[7]);
|
||||||
|
|
||||||
LOGIF(LD, (skygw_log_write(
|
LOGIF(LD, (skygw_log_write(
|
||||||
LOGFILE_DEBUG,
|
LOGFILE_DEBUG,
|
||||||
"%lu [gw_receive_backend_auth] Invalid "
|
"%lu [gw_receive_backend_auth] Invalid "
|
||||||
@ -329,11 +334,35 @@ int gw_receive_backend_auth(
|
|||||||
pthread_self(),
|
pthread_self(),
|
||||||
dcb,
|
dcb,
|
||||||
dcb->fd,
|
dcb->fd,
|
||||||
tmpbuf[4],
|
ptr[4],
|
||||||
tmpbuf)));
|
bufstr)));
|
||||||
|
|
||||||
free(tmpbuf);
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
rc = -1;
|
LOGFILE_ERROR,
|
||||||
|
"Error : Invalid authentication message "
|
||||||
|
"from backend. Msg : %s",
|
||||||
|
bufstr)));
|
||||||
|
|
||||||
|
free(bufstr);
|
||||||
|
rc = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOGIF(LD, (skygw_log_write(
|
||||||
|
LOGFILE_DEBUG,
|
||||||
|
"%lu [gw_receive_backend_auth] Invalid "
|
||||||
|
"authentication message from backend dcb %p "
|
||||||
|
"fd %d, ptr[4] = %p",
|
||||||
|
pthread_self(),
|
||||||
|
dcb,
|
||||||
|
dcb->fd,
|
||||||
|
ptr[4])));
|
||||||
|
|
||||||
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"Error : Invalid authentication message "
|
||||||
|
"from backend. Packet type : %p",
|
||||||
|
ptr[4])));
|
||||||
}
|
}
|
||||||
/*<
|
/*<
|
||||||
* Remove data from buffer.
|
* Remove data from buffer.
|
||||||
|
Reference in New Issue
Block a user