mysql_common.c and mysql_client.c astyled
This commit is contained in:
@ -59,9 +59,9 @@
|
|||||||
|
|
||||||
#include <maxscale/gw_authenticator.h>
|
#include <maxscale/gw_authenticator.h>
|
||||||
|
|
||||||
/* @see function load_module in load_utils.c for explanation of the following
|
/* @see function load_module in load_utils.c for explanation of the following
|
||||||
* lint directives.
|
* lint directives.
|
||||||
*/
|
*/
|
||||||
/*lint -e14 */
|
/*lint -e14 */
|
||||||
MODULE_INFO info =
|
MODULE_INFO info =
|
||||||
{
|
{
|
||||||
@ -90,7 +90,7 @@ static void mysql_client_auth_error_handling(DCB *dcb, int auth_val);
|
|||||||
static int gw_read_do_authentication(DCB *dcb, GWBUF *read_buffer, int nbytes_read);
|
static int gw_read_do_authentication(DCB *dcb, GWBUF *read_buffer, int nbytes_read);
|
||||||
static int gw_read_normal_data(DCB *dcb, GWBUF *read_buffer, int nbytes_read);
|
static int gw_read_normal_data(DCB *dcb, GWBUF *read_buffer, int nbytes_read);
|
||||||
static int gw_read_finish_processing(DCB *dcb, GWBUF *read_buffer, uint8_t capabilities);
|
static int gw_read_finish_processing(DCB *dcb, GWBUF *read_buffer, uint8_t capabilities);
|
||||||
extern char* create_auth_fail_str(char *username, char *hostaddr, char *sha1, char *db,int);
|
extern char* create_auth_fail_str(char *username, char *hostaddr, char *sha1, char *db, int);
|
||||||
static bool ensure_complete_packet(DCB *dcb, GWBUF **read_buffer, int nbytes_read);
|
static bool ensure_complete_packet(DCB *dcb, GWBUF **read_buffer, int nbytes_read);
|
||||||
static void gw_process_one_new_client(DCB *client_dcb);
|
static void gw_process_one_new_client(DCB *client_dcb);
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ int MySQLSendHandshake(DCB* dcb)
|
|||||||
uint8_t mysql_scramble_len = 21;
|
uint8_t mysql_scramble_len = 21;
|
||||||
uint8_t mysql_filler_ten[10];
|
uint8_t mysql_filler_ten[10];
|
||||||
/* uint8_t mysql_last_byte = 0x00; not needed */
|
/* uint8_t mysql_last_byte = 0x00; not needed */
|
||||||
char server_scramble[GW_MYSQL_SCRAMBLE_SIZE + 1]="";
|
char server_scramble[GW_MYSQL_SCRAMBLE_SIZE + 1] = "";
|
||||||
char *version_string;
|
char *version_string;
|
||||||
int len_version_string = 0;
|
int len_version_string = 0;
|
||||||
int id_num;
|
int id_num;
|
||||||
@ -249,7 +249,7 @@ int MySQLSendHandshake(DCB* dcb)
|
|||||||
gw_mysql_set_byte3(mysql_packet_header, mysql_payload_size);
|
gw_mysql_set_byte3(mysql_packet_header, mysql_payload_size);
|
||||||
|
|
||||||
// write packet number, now is 0
|
// write packet number, now is 0
|
||||||
mysql_packet_header[3]= mysql_packet_id;
|
mysql_packet_header[3] = mysql_packet_id;
|
||||||
memcpy(outbuf, mysql_packet_header, sizeof(mysql_packet_header));
|
memcpy(outbuf, mysql_packet_header, sizeof(mysql_packet_header));
|
||||||
|
|
||||||
// current buffer pointer
|
// current buffer pointer
|
||||||
@ -955,7 +955,7 @@ mysql_client_auth_error_handling(DCB *dcb, int auth_val)
|
|||||||
/** 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);
|
||||||
@ -1342,7 +1342,7 @@ static int route_by_statement(SESSION* session, GWBUF** p_readbuf)
|
|||||||
while (tmpbuf != NULL)
|
while (tmpbuf != NULL)
|
||||||
{
|
{
|
||||||
ss_dassert(GWBUF_IS_TYPE_MYSQL(tmpbuf));
|
ss_dassert(GWBUF_IS_TYPE_MYSQL(tmpbuf));
|
||||||
tmpbuf=tmpbuf->next;
|
tmpbuf = tmpbuf->next;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
do
|
do
|
||||||
|
|||||||
@ -160,7 +160,7 @@ retblock:
|
|||||||
*/
|
*/
|
||||||
const char* gw_mysql_protocol_state2string (int state)
|
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";
|
||||||
@ -267,7 +267,7 @@ GWBUF* mysql_create_custom_error(int packet_number,
|
|||||||
|
|
||||||
field_count = 0xff;
|
field_count = 0xff;
|
||||||
gw_mysql_set_byte2(mysql_err, /* mysql_errno */ 2003);
|
gw_mysql_set_byte2(mysql_err, /* mysql_errno */ 2003);
|
||||||
mysql_statemsg[0]='#';
|
mysql_statemsg[0] = '#';
|
||||||
memcpy(mysql_statemsg + 1, mysql_state, 5);
|
memcpy(mysql_statemsg + 1, mysql_state, 5);
|
||||||
|
|
||||||
if (msg != NULL)
|
if (msg != NULL)
|
||||||
@ -356,7 +356,7 @@ mysql_create_standard_error(int packet_number,
|
|||||||
gw_mysql_set_byte3(mysql_packet_header, mysql_payload_size);
|
gw_mysql_set_byte3(mysql_packet_header, mysql_payload_size);
|
||||||
|
|
||||||
// write packet number, now is 0
|
// write packet number, now is 0
|
||||||
mysql_packet_header[3]= 0;
|
mysql_packet_header[3] = 0;
|
||||||
memcpy(outbuf, mysql_packet_header, sizeof(mysql_packet_header));
|
memcpy(outbuf, mysql_packet_header, sizeof(mysql_packet_header));
|
||||||
|
|
||||||
// current buffer pointer
|
// current buffer pointer
|
||||||
@ -469,7 +469,7 @@ int mysql_send_auth_error(DCB *dcb,
|
|||||||
|
|
||||||
field_count = 0xff;
|
field_count = 0xff;
|
||||||
gw_mysql_set_byte2(mysql_err, /*mysql_errno */ 1045);
|
gw_mysql_set_byte2(mysql_err, /*mysql_errno */ 1045);
|
||||||
mysql_statemsg[0]='#';
|
mysql_statemsg[0] = '#';
|
||||||
memcpy(mysql_statemsg + 1, mysql_state, 5);
|
memcpy(mysql_statemsg + 1, mysql_state, 5);
|
||||||
|
|
||||||
if (mysql_message != NULL)
|
if (mysql_message != NULL)
|
||||||
@ -923,7 +923,7 @@ char* create_auth_failed_msg(GWBUF*readbuf,
|
|||||||
uint8_t* sha1)
|
uint8_t* sha1)
|
||||||
{
|
{
|
||||||
char* errstr;
|
char* errstr;
|
||||||
char* uname=(char *)GWBUF_DATA(readbuf) + 5;
|
char* uname = (char *)GWBUF_DATA(readbuf) + 5;
|
||||||
const char* ferrstr = "Access denied for user '%s'@'%s' (using password: %s)";
|
const char* ferrstr = "Access denied for user '%s'@'%s' (using password: %s)";
|
||||||
|
|
||||||
/** -4 comes from 2X'%s' minus terminating char */
|
/** -4 comes from 2X'%s' minus terminating char */
|
||||||
|
|||||||
Reference in New Issue
Block a user