Format protocol modules

Formatted protocol modules with Astyle.
This commit is contained in:
Markus Mäkelä
2017-01-17 13:34:02 +02:00
parent 0b6b9c3d81
commit 1766e3a06b
6 changed files with 342 additions and 303 deletions

View File

@ -127,88 +127,88 @@ cdc_read_event(DCB* dcb)
{ {
switch (protocol->state) switch (protocol->state)
{ {
case CDC_STATE_WAIT_FOR_AUTH: case CDC_STATE_WAIT_FOR_AUTH:
if (CDC_STATE_AUTH_OK == ( if (CDC_STATE_AUTH_OK == (
/* Fill CDC_session from incoming packet */ /* Fill CDC_session from incoming packet */
auth_val = dcb->authfunc.extract(dcb, head))) auth_val = dcb->authfunc.extract(dcb, head)))
{
/* Call protocol authentication */
auth_val = dcb->authfunc.authenticate(dcb);
}
/* Discard input buffer */
gwbuf_free(head);
if (auth_val == CDC_STATE_AUTH_OK)
{
/* start a real session */
session = session_alloc(dcb->service, dcb);
if (session != NULL)
{ {
/* Call protocol authentication */ protocol->state = CDC_STATE_HANDLE_REQUEST;
auth_val = dcb->authfunc.authenticate(dcb);
}
/* Discard input buffer */ write_auth_ack(dcb);
gwbuf_free(head);
if (auth_val == CDC_STATE_AUTH_OK) MXS_INFO("%s: Client [%s] authenticated with user [%s]",
{ dcb->service->name, dcb->remote != NULL ? dcb->remote : "",
/* start a real session */ client_data->user);
session = session_alloc(dcb->service, dcb);
if (session != NULL)
{
protocol->state = CDC_STATE_HANDLE_REQUEST;
write_auth_ack(dcb);
MXS_INFO("%s: Client [%s] authenticated with user [%s]",
dcb->service->name, dcb->remote != NULL ? dcb->remote : "",
client_data->user);
}
else
{
auth_val = CDC_STATE_AUTH_NO_SESSION;
}
}
if (auth_val != CDC_STATE_AUTH_OK)
{
protocol->state = CDC_STATE_AUTH_ERR;
write_auth_err(dcb);
MXS_ERROR("%s: authentication failure from [%s], user [%s]",
dcb->service->name, dcb->remote != NULL ? dcb->remote : "",
client_data->user);
/* force the client connection close */
dcb_close(dcb);
}
break;
case CDC_STATE_HANDLE_REQUEST:
// handle CLOSE command, it shoudl be routed as well and client connection closed after last transmission
if (strncmp((char*)GWBUF_DATA(head), "CLOSE", GWBUF_LENGTH(head)) == 0)
{
MXS_INFO("%s: Client [%s] has requested CLOSE action",
dcb->service->name, dcb->remote != NULL ? dcb->remote : "");
// gwbuf_set_type(head, GWBUF_TYPE_CDC);
// the router will close the client connection
//rc = SESSION_ROUTE_QUERY(session, head);
// buffer not handled by router right now, consume it
gwbuf_free(head);
/* right now, just force the client connection close */
dcb_close(dcb);
} }
else else
{ {
MXS_INFO("%s: Client [%s] requested [%.*s] action", auth_val = CDC_STATE_AUTH_NO_SESSION;
dcb->service->name, dcb->remote != NULL ? dcb->remote : "",
(int)GWBUF_LENGTH(head), (char*)GWBUF_DATA(head));
// gwbuf_set_type(head, GWBUF_TYPE_CDC);
rc = SESSION_ROUTE_QUERY(session, head);
} }
break; }
default: if (auth_val != CDC_STATE_AUTH_OK)
MXS_INFO("%s: Client [%s] in unknown state %d", dcb->service->name, {
dcb->remote != NULL ? dcb->remote : "", protocol->state); protocol->state = CDC_STATE_AUTH_ERR;
write_auth_err(dcb);
MXS_ERROR("%s: authentication failure from [%s], user [%s]",
dcb->service->name, dcb->remote != NULL ? dcb->remote : "",
client_data->user);
/* force the client connection close */
dcb_close(dcb);
}
break;
case CDC_STATE_HANDLE_REQUEST:
// handle CLOSE command, it shoudl be routed as well and client connection closed after last transmission
if (strncmp((char*)GWBUF_DATA(head), "CLOSE", GWBUF_LENGTH(head)) == 0)
{
MXS_INFO("%s: Client [%s] has requested CLOSE action",
dcb->service->name, dcb->remote != NULL ? dcb->remote : "");
// gwbuf_set_type(head, GWBUF_TYPE_CDC);
// the router will close the client connection
//rc = SESSION_ROUTE_QUERY(session, head);
// buffer not handled by router right now, consume it
gwbuf_free(head); gwbuf_free(head);
break; /* right now, just force the client connection close */
dcb_close(dcb);
}
else
{
MXS_INFO("%s: Client [%s] requested [%.*s] action",
dcb->service->name, dcb->remote != NULL ? dcb->remote : "",
(int)GWBUF_LENGTH(head), (char*)GWBUF_DATA(head));
// gwbuf_set_type(head, GWBUF_TYPE_CDC);
rc = SESSION_ROUTE_QUERY(session, head);
}
break;
default:
MXS_INFO("%s: Client [%s] in unknown state %d", dcb->service->name,
dcb->remote != NULL ? dcb->remote : "", protocol->state);
gwbuf_free(head);
break;
} }
} }

View File

@ -211,48 +211,48 @@ static int gw_create_backend_connection(DCB *backend_dcb,
/*< Set protocol state */ /*< Set protocol state */
switch (rv) switch (rv)
{ {
case 0: case 0:
ss_dassert(fd > 0); ss_dassert(fd > 0);
protocol->fd = fd; protocol->fd = fd;
protocol->protocol_auth_state = MXS_AUTH_STATE_CONNECTED; protocol->protocol_auth_state = MXS_AUTH_STATE_CONNECTED;
MXS_DEBUG("%lu [gw_create_backend_connection] Established " MXS_DEBUG("%lu [gw_create_backend_connection] Established "
"connection to %s:%i, protocol fd %d client " "connection to %s:%i, protocol fd %d client "
"fd %d.", "fd %d.",
pthread_self(), pthread_self(),
server->name, server->name,
server->port, server->port,
protocol->fd, protocol->fd,
session->client_dcb->fd); session->client_dcb->fd);
break; break;
case 1: case 1:
/* The state MYSQL_PENDING_CONNECT is likely to be transitory, */ /* The state MYSQL_PENDING_CONNECT is likely to be transitory, */
/* as it means the calls have been successful but the connection */ /* as it means the calls have been successful but the connection */
/* has not yet completed and the calls are non-blocking. */ /* has not yet completed and the calls are non-blocking. */
ss_dassert(fd > 0); ss_dassert(fd > 0);
protocol->protocol_auth_state = MXS_AUTH_STATE_PENDING_CONNECT; protocol->protocol_auth_state = MXS_AUTH_STATE_PENDING_CONNECT;
protocol->fd = fd; protocol->fd = fd;
MXS_DEBUG("%lu [gw_create_backend_connection] Connection " MXS_DEBUG("%lu [gw_create_backend_connection] Connection "
"pending to %s:%i, protocol fd %d client fd %d.", "pending to %s:%i, protocol fd %d client fd %d.",
pthread_self(), pthread_self(),
server->name, server->name,
server->port, server->port,
protocol->fd, protocol->fd,
session->client_dcb->fd); session->client_dcb->fd);
break; break;
default: default:
/* Failure - the state reverts to its initial value */ /* Failure - the state reverts to its initial value */
ss_dassert(fd == -1); ss_dassert(fd == -1);
ss_dassert(protocol->protocol_auth_state == MXS_AUTH_STATE_INIT); ss_dassert(protocol->protocol_auth_state == MXS_AUTH_STATE_INIT);
MXS_DEBUG("%lu [gw_create_backend_connection] Connection " MXS_DEBUG("%lu [gw_create_backend_connection] Connection "
"failed to %s:%i, protocol fd %d client fd %d.", "failed to %s:%i, protocol fd %d client fd %d.",
pthread_self(), pthread_self(),
server->name, server->name,
server->port, server->port,
protocol->fd, protocol->fd,
session->client_dcb->fd); session->client_dcb->fd);
break; break;
} /*< switch */ } /*< switch */
return_fd: return_fd:
@ -454,16 +454,16 @@ mxs_auth_state_t handle_server_response(DCB *dcb, GWBUF *buffer)
{ {
switch (dcb->authfunc.authenticate(dcb)) switch (dcb->authfunc.authenticate(dcb))
{ {
case MXS_AUTH_INCOMPLETE: case MXS_AUTH_INCOMPLETE:
case MXS_AUTH_SSL_INCOMPLETE: case MXS_AUTH_SSL_INCOMPLETE:
rval = MXS_AUTH_STATE_RESPONSE_SENT; rval = MXS_AUTH_STATE_RESPONSE_SENT;
break; break;
case MXS_AUTH_SUCCEEDED: case MXS_AUTH_SUCCEEDED:
rval = MXS_AUTH_STATE_COMPLETE; rval = MXS_AUTH_STATE_COMPLETE;
default: default:
break; break;
} }
} }
@ -691,7 +691,7 @@ static inline bool session_ok_to_route(DCB *dcb)
static inline bool expecting_resultset(MySQLProtocol *proto) static inline bool expecting_resultset(MySQLProtocol *proto)
{ {
return proto->current_command == MYSQL_COM_QUERY || return proto->current_command == MYSQL_COM_QUERY ||
proto->current_command == MYSQL_COM_STMT_FETCH; proto->current_command == MYSQL_COM_STMT_FETCH;
} }
/** /**
@ -1011,24 +1011,24 @@ static int gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue)
*/ */
switch (backend_protocol->protocol_auth_state) switch (backend_protocol->protocol_auth_state)
{ {
case MXS_AUTH_STATE_HANDSHAKE_FAILED: case MXS_AUTH_STATE_HANDSHAKE_FAILED:
case MXS_AUTH_STATE_FAILED: case MXS_AUTH_STATE_FAILED:
if (dcb->session->state != SESSION_STATE_STOPPING) if (dcb->session->state != SESSION_STATE_STOPPING)
{ {
MXS_ERROR("Unable to write to backend '%s' due to " MXS_ERROR("Unable to write to backend '%s' due to "
"%s failure. Server in state %s.", "%s failure. Server in state %s.",
dcb->server->unique_name, dcb->server->unique_name,
backend_protocol->protocol_auth_state == MXS_AUTH_STATE_HANDSHAKE_FAILED ? backend_protocol->protocol_auth_state == MXS_AUTH_STATE_HANDSHAKE_FAILED ?
"handshake" : "authentication", "handshake" : "authentication",
STRSRVSTATUS(dcb->server)); STRSRVSTATUS(dcb->server));
} }
gwbuf_free(queue); gwbuf_free(queue);
rc = 0; rc = 0;
break; break;
case MXS_AUTH_STATE_COMPLETE: case MXS_AUTH_STATE_COMPLETE:
{ {
uint8_t* ptr = GWBUF_DATA(queue); uint8_t* ptr = GWBUF_DATA(queue);
mysql_server_cmd_t cmd = MYSQL_GET_COMMAND(ptr); mysql_server_cmd_t cmd = MYSQL_GET_COMMAND(ptr);
@ -1076,7 +1076,7 @@ static int gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue)
} }
break; break;
default: default:
{ {
MXS_DEBUG("%lu [gw_MySQLWrite_backend] delayed write to " MXS_DEBUG("%lu [gw_MySQLWrite_backend] delayed write to "
"dcb %p fd %d protocol state %s.", "dcb %p fd %d protocol state %s.",

View File

@ -462,22 +462,22 @@ int gw_read_client_event(DCB* dcb)
switch (protocol->protocol_auth_state) switch (protocol->protocol_auth_state)
{ {
/** /**
* *
* When a listener receives a new connection request, it creates a * When a listener receives a new connection request, it creates a
* request handler DCB to for the client connection. The listener also * request handler DCB to for the client connection. The listener also
* sends the initial authentication request to the client. The first * sends the initial authentication request to the client. The first
* time this function is called from the poll loop, the client reply * time this function is called from the poll loop, the client reply
* to the authentication request should be available. * to the authentication request should be available.
* *
* If the authentication is successful the protocol authentication state * If the authentication is successful the protocol authentication state
* will be changed to MYSQL_IDLE (see below). * will be changed to MYSQL_IDLE (see below).
* *
*/ */
case MXS_AUTH_STATE_MESSAGE_READ: case MXS_AUTH_STATE_MESSAGE_READ:
/* After this call read_buffer will point to freed data */ /* After this call read_buffer will point to freed data */
if (nbytes_read < 3 || (0 == max_bytes && nbytes_read < if (nbytes_read < 3 || (0 == max_bytes && nbytes_read <
(MYSQL_GET_PAYLOAD_LEN((uint8_t *) GWBUF_DATA(read_buffer)) + 4)) || (MYSQL_GET_PAYLOAD_LEN((uint8_t *) GWBUF_DATA(read_buffer)) + 4)) ||
(0 != max_bytes && nbytes_read < max_bytes)) (0 != max_bytes && nbytes_read < max_bytes))
{ {
@ -488,26 +488,26 @@ int gw_read_client_event(DCB* dcb)
return_code = gw_read_do_authentication(dcb, read_buffer, nbytes_read); return_code = gw_read_do_authentication(dcb, read_buffer, nbytes_read);
break; break;
/** /**
* *
* Once a client connection is authenticated, the protocol authentication * Once a client connection is authenticated, the protocol authentication
* state will be MYSQL_IDLE and so every event of data received will * state will be MYSQL_IDLE and so every event of data received will
* result in a call that comes to this section of code. * result in a call that comes to this section of code.
* *
*/ */
case MXS_AUTH_STATE_COMPLETE: case MXS_AUTH_STATE_COMPLETE:
/* After this call read_buffer will point to freed data */ /* After this call read_buffer will point to freed data */
return_code = gw_read_normal_data(dcb, read_buffer, nbytes_read); return_code = gw_read_normal_data(dcb, read_buffer, nbytes_read);
break; break;
case MXS_AUTH_STATE_FAILED: case MXS_AUTH_STATE_FAILED:
gwbuf_free(read_buffer); gwbuf_free(read_buffer);
return_code = 1; return_code = 1;
break; break;
default: default:
MXS_ERROR("In mysql_client.c unexpected protocol authentication state"); MXS_ERROR("In mysql_client.c unexpected protocol authentication state");
break; break;
} }
return return_code; return return_code;
@ -527,7 +527,7 @@ static void store_client_information(DCB *dcb, GWBUF *buffer)
gwbuf_copy_data(buffer, 0, len, data); gwbuf_copy_data(buffer, 0, len, data);
ss_dassert(MYSQL_GET_PAYLOAD_LEN(data) + MYSQL_HEADER_LEN == len || ss_dassert(MYSQL_GET_PAYLOAD_LEN(data) + MYSQL_HEADER_LEN == len ||
len == MYSQL_AUTH_PACKET_BASE_SIZE); // For SSL request packet len == MYSQL_AUTH_PACKET_BASE_SIZE); // For SSL request packet
proto->client_capabilities = gw_mysql_get_byte4(data + MYSQL_CLIENT_CAP_OFFSET); proto->client_capabilities = gw_mysql_get_byte4(data + MYSQL_CLIENT_CAP_OFFSET);
proto->charset = data[MYSQL_CHARSET_OFFSET]; proto->charset = data[MYSQL_CHARSET_OFFSET];
@ -1016,84 +1016,84 @@ mysql_client_auth_error_handling(DCB *dcb, int auth_val, int packet_number)
switch (auth_val) switch (auth_val)
{ {
case MXS_AUTH_NO_SESSION: case MXS_AUTH_NO_SESSION:
MXS_DEBUG("%lu [gw_read_client_event] session " MXS_DEBUG("%lu [gw_read_client_event] session "
"creation failed. fd %d, " "creation failed. fd %d, "
"state = MYSQL_AUTH_NO_SESSION.", "state = MYSQL_AUTH_NO_SESSION.",
pthread_self(), pthread_self(),
dcb->fd); dcb->fd);
/** Send ERR 1045 to client */ /** Send ERR 1045 to client */
mysql_send_auth_error(dcb, mysql_send_auth_error(dcb,
packet_number, packet_number,
0, 0,
"failed to create new session"); "failed to create new session");
break; break;
case MXS_AUTH_FAILED_DB: case MXS_AUTH_FAILED_DB:
MXS_DEBUG("%lu [gw_read_client_event] database " MXS_DEBUG("%lu [gw_read_client_event] database "
"specified was not valid. fd %d, " "specified was not valid. fd %d, "
"state = MYSQL_FAILED_AUTH_DB.", "state = MYSQL_FAILED_AUTH_DB.",
pthread_self(), pthread_self(),
dcb->fd); dcb->fd);
/** Send error 1049 to client */ /** Send error 1049 to client */
message_len = 25 + MYSQL_DATABASE_MAXLEN; message_len = 25 + MYSQL_DATABASE_MAXLEN;
fail_str = MXS_CALLOC(1, message_len + 1); fail_str = MXS_CALLOC(1, message_len + 1);
MXS_ABORT_IF_NULL(fail_str); MXS_ABORT_IF_NULL(fail_str);
snprintf(fail_str, message_len, "Unknown database '%s'", snprintf(fail_str, message_len, "Unknown database '%s'",
(char*)((MYSQL_session *)dcb->data)->db); (char*)((MYSQL_session *)dcb->data)->db);
modutil_send_mysql_err_packet(dcb, packet_number, 0, 1049, "42000", fail_str); modutil_send_mysql_err_packet(dcb, packet_number, 0, 1049, "42000", fail_str);
break; break;
case MXS_AUTH_FAILED_SSL: case MXS_AUTH_FAILED_SSL:
MXS_DEBUG("%lu [gw_read_client_event] client is " MXS_DEBUG("%lu [gw_read_client_event] client is "
"not SSL capable for SSL listener. fd %d, " "not SSL capable for SSL listener. fd %d, "
"state = MYSQL_FAILED_AUTH_SSL.", "state = MYSQL_FAILED_AUTH_SSL.",
pthread_self(), pthread_self(),
dcb->fd); dcb->fd);
/** Send ERR 1045 to client */ /** Send ERR 1045 to client */
mysql_send_auth_error(dcb, mysql_send_auth_error(dcb,
packet_number, packet_number,
0, 0,
"Access without SSL denied"); "Access without SSL denied");
break; break;
case MXS_AUTH_SSL_INCOMPLETE: case MXS_AUTH_SSL_INCOMPLETE:
MXS_DEBUG("%lu [gw_read_client_event] unable to " MXS_DEBUG("%lu [gw_read_client_event] unable to "
"complete SSL authentication. fd %d, " "complete SSL authentication. fd %d, "
"state = MYSQL_AUTH_SSL_INCOMPLETE.", "state = MYSQL_AUTH_SSL_INCOMPLETE.",
pthread_self(), pthread_self(),
dcb->fd); dcb->fd);
/** Send ERR 1045 to client */ /** Send ERR 1045 to client */
mysql_send_auth_error(dcb, mysql_send_auth_error(dcb,
packet_number, packet_number,
0, 0,
"failed to complete SSL authentication"); "failed to complete SSL authentication");
break; break;
case MXS_AUTH_FAILED: case MXS_AUTH_FAILED:
MXS_DEBUG("%lu [gw_read_client_event] authentication failed. fd %d, " MXS_DEBUG("%lu [gw_read_client_event] authentication failed. fd %d, "
"state = MYSQL_FAILED_AUTH.", "state = MYSQL_FAILED_AUTH.",
pthread_self(), pthread_self(),
dcb->fd); dcb->fd);
/** Send error 1045 to client */ /** Send error 1045 to client */
fail_str = create_auth_fail_str((char *)((MYSQL_session *)dcb->data)->user, fail_str = create_auth_fail_str((char *)((MYSQL_session *)dcb->data)->user,
dcb->remote, dcb->remote,
(char*)((MYSQL_session *)dcb->data)->client_sha1, (char*)((MYSQL_session *)dcb->data)->client_sha1,
(char*)((MYSQL_session *)dcb->data)->db, auth_val); (char*)((MYSQL_session *)dcb->data)->db, auth_val);
modutil_send_mysql_err_packet(dcb, packet_number, 0, 1045, "28000", fail_str); modutil_send_mysql_err_packet(dcb, packet_number, 0, 1045, "28000", fail_str);
break; break;
default: default:
MXS_DEBUG("%lu [gw_read_client_event] authentication failed. fd %d, " MXS_DEBUG("%lu [gw_read_client_event] authentication failed. fd %d, "
"state unrecognized.", "state unrecognized.",
pthread_self(), pthread_self(),
dcb->fd); dcb->fd);
/** Send error 1045 to client */ /** Send error 1045 to client */
fail_str = create_auth_fail_str((char *)((MYSQL_session *)dcb->data)->user, fail_str = create_auth_fail_str((char *)((MYSQL_session *)dcb->data)->user,
dcb->remote, dcb->remote,
(char*)((MYSQL_session *)dcb->data)->client_sha1, (char*)((MYSQL_session *)dcb->data)->client_sha1,
(char*)((MYSQL_session *)dcb->data)->db, auth_val); (char*)((MYSQL_session *)dcb->data)->db, auth_val);
modutil_send_mysql_err_packet(dcb, packet_number, 0, 1045, "28000", fail_str); modutil_send_mysql_err_packet(dcb, packet_number, 0, 1045, "28000", fail_str);
} }
MXS_FREE(fail_str); MXS_FREE(fail_str);
} }

View File

@ -166,22 +166,22 @@ const char* gw_mysql_protocol_state2string (int state)
{ {
switch (state) switch (state)
{ {
case MXS_AUTH_STATE_INIT: case MXS_AUTH_STATE_INIT:
return "Authentication initialized"; return "Authentication initialized";
case MXS_AUTH_STATE_PENDING_CONNECT: case MXS_AUTH_STATE_PENDING_CONNECT:
return "Network connection pending"; return "Network connection pending";
case MXS_AUTH_STATE_CONNECTED: case MXS_AUTH_STATE_CONNECTED:
return "Network connection created"; return "Network connection created";
case MXS_AUTH_STATE_MESSAGE_READ: case MXS_AUTH_STATE_MESSAGE_READ:
return "Read server handshake"; return "Read server handshake";
case MXS_AUTH_STATE_RESPONSE_SENT: case MXS_AUTH_STATE_RESPONSE_SENT:
return "Response to handshake sent"; return "Response to handshake sent";
case MXS_AUTH_STATE_FAILED: case MXS_AUTH_STATE_FAILED:
return "Authentication failed"; return "Authentication failed";
case MXS_AUTH_STATE_COMPLETE: case MXS_AUTH_STATE_COMPLETE:
return "Authentication is complete."; return "Authentication is complete.";
default: default:
return "MySQL (unknown protocol state)"; return "MySQL (unknown protocol state)";
} }
} }
@ -841,27 +841,27 @@ void init_response_status(GWBUF* buf,
{ {
switch (cmd) switch (cmd)
{ {
case MYSQL_COM_STMT_PREPARE: case MYSQL_COM_STMT_PREPARE:
gwbuf_copy_data(buf, 9, 2, readbuf); gwbuf_copy_data(buf, 9, 2, readbuf);
nparam = gw_mysql_get_byte2(readbuf); nparam = gw_mysql_get_byte2(readbuf);
gwbuf_copy_data(buf, 11, 2, readbuf); gwbuf_copy_data(buf, 11, 2, readbuf);
nattr = gw_mysql_get_byte2(readbuf); nattr = gw_mysql_get_byte2(readbuf);
*npackets = 1 + nparam + MXS_MIN(1, nparam) + nattr + MXS_MIN(nattr, 1); *npackets = 1 + nparam + MXS_MIN(1, nparam) + nattr + MXS_MIN(nattr, 1);
break; break;
case MYSQL_COM_QUIT: case MYSQL_COM_QUIT:
case MYSQL_COM_STMT_SEND_LONG_DATA: case MYSQL_COM_STMT_SEND_LONG_DATA:
case MYSQL_COM_STMT_CLOSE: case MYSQL_COM_STMT_CLOSE:
*npackets = 0; /*< these don't reply anything */ *npackets = 0; /*< these don't reply anything */
break; break;
default: default:
/** /**
* assume that other session commands respond * assume that other session commands respond
* OK or ERR * OK or ERR
*/ */
*npackets = 1; *npackets = 1;
break; break;
} }
} }
@ -1570,18 +1570,18 @@ bool mxs_mysql_is_result_set(GWBUF *buffer)
switch (cmd) switch (cmd)
{ {
case MYSQL_REPLY_OK: case MYSQL_REPLY_OK:
case MYSQL_REPLY_ERR: case MYSQL_REPLY_ERR:
case MYSQL_REPLY_LOCAL_INFILE: case MYSQL_REPLY_LOCAL_INFILE:
case MYSQL_REPLY_EOF: case MYSQL_REPLY_EOF:
/** Not a result set */ /** Not a result set */
break; break;
default: default:
if (gwbuf_copy_data(buffer, MYSQL_HEADER_LEN + 1, 1, &cmd) && cmd > 1) if (gwbuf_copy_data(buffer, MYSQL_HEADER_LEN + 1, 1, &cmd) && cmd > 1)
{ {
rval = true; rval = true;
} }
break; break;
} }
} }

View File

@ -424,7 +424,7 @@ static int maxscaled_listen(DCB *listener, char *config)
/* check for default UNIX socket */ /* check for default UNIX socket */
if (strncmp(config, MAXADMIN_CONFIG_DEFAULT_SOCKET_TAG, MAXADMIN_CONFIG_DEFAULT_SOCKET_TAG_LEN) == 0) if (strncmp(config, MAXADMIN_CONFIG_DEFAULT_SOCKET_TAG, MAXADMIN_CONFIG_DEFAULT_SOCKET_TAG_LEN) == 0)
{ {
socket_path = MAXADMIN_DEFAULT_SOCKET; socket_path = MAXADMIN_DEFAULT_SOCKET;
} }
else else
{ {

View File

@ -30,19 +30,58 @@
#include <maxscale/buffer.h> #include <maxscale/buffer.h>
#include <maxscale/protocol.h> #include <maxscale/protocol.h>
static int test_read(DCB* dcb){ return 1;} static int test_read(DCB* dcb)
static int test_write(DCB *dcb, GWBUF* buf){ return 1;} {
static int test_write_ready(DCB *dcb){ return 1;} return 1;
static int test_error(DCB *dcb){ return 1;} }
static int test_hangup(DCB *dcb){ return 1;} static int test_write(DCB *dcb, GWBUF* buf)
static int test_accept(DCB *dcb){ return 1;} {
static int test_connect(struct dcb *dcb, struct server *srv, struct session *ses){ return 1;} return 1;
static int test_close(DCB *dcb){ return 1;} }
static int test_listen(DCB *dcb, char *config){ return 1;} static int test_write_ready(DCB *dcb)
static int test_auth(DCB* dcb, struct server *srv, struct session *ses, GWBUF *buf){ return 1;} {
static int test_session(DCB *dcb, void* data){ return 1;} return 1;
static char *test_default_auth(){return "NullAuthAllow";} }
static int test_connection_limit(DCB *dcb, int limit){return 0;} static int test_error(DCB *dcb)
{
return 1;
}
static int test_hangup(DCB *dcb)
{
return 1;
}
static int test_accept(DCB *dcb)
{
return 1;
}
static int test_connect(struct dcb *dcb, struct server *srv, struct session *ses)
{
return 1;
}
static int test_close(DCB *dcb)
{
return 1;
}
static int test_listen(DCB *dcb, char *config)
{
return 1;
}
static int test_auth(DCB* dcb, struct server *srv, struct session *ses, GWBUF *buf)
{
return 1;
}
static int test_session(DCB *dcb, void* data)
{
return 1;
}
static char *test_default_auth()
{
return "NullAuthAllow";
}
static int test_connection_limit(DCB *dcb, int limit)
{
return 0;
}
/** /**
* The module entry point routine. It is this routine that * The module entry point routine. It is this routine that