Partially revert 4ba011266843857bbd3201e5b925a47e88e1808f

Add back leading operator enforcement.
This commit is contained in:
Markus Mäkelä
2018-09-20 15:26:51 +03:00
parent d8d0b1a29c
commit 71ffef5708
95 changed files with 1395 additions and 1392 deletions

View File

@ -369,8 +369,8 @@ static void handle_error_response(DCB* dcb, GWBUF* buffer)
mxs_auth_state_t handle_server_response(DCB* dcb, GWBUF* buffer)
{
MySQLProtocol* proto = (MySQLProtocol*)dcb->protocol;
mxs_auth_state_t rval = proto->protocol_auth_state == MXS_AUTH_STATE_CONNECTED
? MXS_AUTH_STATE_HANDSHAKE_FAILED : MXS_AUTH_STATE_FAILED;
mxs_auth_state_t rval = proto->protocol_auth_state == MXS_AUTH_STATE_CONNECTED ?
MXS_AUTH_STATE_HANDSHAKE_FAILED : MXS_AUTH_STATE_FAILED;
if (dcb->authfunc.extract(dcb, buffer))
{
@ -1236,8 +1236,8 @@ static int gw_MySQLWrite_backend(DCB* dcb, GWBUF* queue)
MXS_ERROR("Unable to write to backend '%s' due to "
"%s failure. Server in state %s.",
dcb->server->name,
backend_protocol->protocol_auth_state == MXS_AUTH_STATE_HANDSHAKE_FAILED
? "handshake" : "authentication",
backend_protocol->protocol_auth_state == MXS_AUTH_STATE_HANDSHAKE_FAILED ?
"handshake" : "authentication",
STRSRVSTATUS(dcb->server));
}

View File

@ -280,13 +280,13 @@ int MySQLSendHandshake(DCB* dcb)
const char* plugin_name = DEFAULT_MYSQL_AUTH_PLUGIN;
int plugin_name_len = strlen(plugin_name);
mysql_payload_size
= sizeof(mysql_protocol_version) + (len_version_string + 1) + sizeof(mysql_thread_id_num) + 8
+ sizeof( /* mysql_filler */ uint8_t) + sizeof(mysql_server_capabilities_one)
+ sizeof(mysql_server_language)
+ sizeof(mysql_server_status) + sizeof(mysql_server_capabilities_two) + sizeof(mysql_scramble_len)
+ sizeof(mysql_filler_ten) + 12 + sizeof( /* mysql_last_byte */ uint8_t) + plugin_name_len
+ sizeof( /* mysql_last_byte */ uint8_t);
mysql_payload_size =
sizeof(mysql_protocol_version) + (len_version_string + 1) + sizeof(mysql_thread_id_num) + 8
+ sizeof( /* mysql_filler */ uint8_t) + sizeof(mysql_server_capabilities_one)
+ sizeof(mysql_server_language)
+ sizeof(mysql_server_status) + sizeof(mysql_server_capabilities_two) + sizeof(mysql_scramble_len)
+ sizeof(mysql_filler_ten) + 12 + sizeof( /* mysql_last_byte */ uint8_t) + plugin_name_len
+ sizeof( /* mysql_last_byte */ uint8_t);
// allocate memory for packet header + payload
if ((buf = gwbuf_alloc(sizeof(mysql_packet_header) + mysql_payload_size)) == NULL)
@ -739,8 +739,8 @@ static int gw_read_do_authentication(DCB* dcb, GWBUF* read_buffer, int nbytes_re
* is changed so that future data will go through the
* normal data handling function instead of this one.
*/
MXS_SESSION* session
= session_alloc_with_id(dcb->service, dcb, protocol->thread_id);
MXS_SESSION* session =
session_alloc_with_id(dcb->service, dcb, protocol->thread_id);
if (session != NULL)
{
@ -1784,8 +1784,8 @@ static spec_com_res_t process_special_commands(DCB* dcb, GWBUF* read_buffer, int
{
spec_com_res_t rval = RES_CONTINUE;
bool is_complete = false;
unsigned int packet_len
= MYSQL_GET_PAYLOAD_LEN((uint8_t*)GWBUF_DATA(read_buffer)) + MYSQL_HEADER_LEN;
unsigned int packet_len =
MYSQL_GET_PAYLOAD_LEN((uint8_t*)GWBUF_DATA(read_buffer)) + MYSQL_HEADER_LEN;
if (gwbuf_length(read_buffer) == packet_len)
{
is_complete = true;

View File

@ -215,11 +215,11 @@ GWBUF* mysql_create_custom_error(int packet_number,
mysql_error_msg = msg;
}
mysql_payload_size
= sizeof(field_count)
+ sizeof(mysql_err)
+ sizeof(mysql_statemsg)
+ strlen(mysql_error_msg);
mysql_payload_size =
sizeof(field_count)
+ sizeof(mysql_err)
+ sizeof(mysql_statemsg)
+ strlen(mysql_error_msg);
/** allocate memory for packet header + payload */
errbuf = gwbuf_alloc(sizeof(mysql_packet_header) + mysql_payload_size);
@ -413,8 +413,8 @@ int mysql_send_auth_error(DCB* dcb,
mysql_error_msg = mysql_message;
}
mysql_payload_size
= sizeof(field_count) + sizeof(mysql_err) + sizeof(mysql_statemsg) + strlen(mysql_error_msg);
mysql_payload_size =
sizeof(field_count) + sizeof(mysql_err) + sizeof(mysql_statemsg) + strlen(mysql_error_msg);
// allocate memory for packet header + payload
if ((buf = gwbuf_alloc(sizeof(mysql_packet_header) + mysql_payload_size)) == NULL)
@ -636,12 +636,12 @@ int mxs_mysql_send_ok(DCB* dcb, int sequence, uint8_t affected_rows, const char*
GWBUF* buf;
mysql_payload_size
= sizeof(field_count)
+ sizeof(affected_rows)
+ sizeof(insert_id)
+ sizeof(mysql_server_status)
+ sizeof(mysql_warning_counter);
mysql_payload_size =
sizeof(field_count)
+ sizeof(affected_rows)
+ sizeof(insert_id)
+ sizeof(mysql_server_status)
+ sizeof(mysql_warning_counter);
if (message != NULL)
{
@ -1014,8 +1014,8 @@ int send_mysql_native_password_response(DCB* dcb)
MYSQL_session local_session;
gw_get_shared_session_auth_info(dcb, &local_session);
uint8_t* curr_passwd = memcmp(local_session.client_sha1, null_client_sha1, MYSQL_SCRAMBLE_LEN)
? local_session.client_sha1 : null_client_sha1;
uint8_t* curr_passwd = memcmp(local_session.client_sha1, null_client_sha1, MYSQL_SCRAMBLE_LEN) ?
local_session.client_sha1 : null_client_sha1;
GWBUF* buffer = gwbuf_alloc(MYSQL_HEADER_LEN + GW_MYSQL_SCRAMBLE_SIZE);
uint8_t* data = GWBUF_DATA(buffer);
@ -1501,8 +1501,8 @@ void mxs_mysql_parse_ok_packet(GWBUF* buff, size_t packet_offset, size_t packet_
while (ptr < (local_buf + packet_len))
{
enum_session_state_type type
= (enum enum_session_state_type)mxs_leint_consume(&ptr);
enum_session_state_type type =
(enum enum_session_state_type)mxs_leint_consume(&ptr);
#if defined (SS_DEBUG)
mxb_assert(type <= SESSION_TRACK_TRANSACTION_TYPE);
#endif