Removed 'extern' keyword from function declaration in headers. Functions are 'extern' by default.
Changed mysql_protocol_init prototype and implementation to return MySQLProtocol pointer instead of boolean.
This commit is contained in:
@ -234,28 +234,63 @@ typedef enum
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void gw_mysql_close(MySQLProtocol **ptr);
|
void gw_mysql_close(MySQLProtocol **ptr);
|
||||||
|
MySQLProtocol* mysql_protocol_init(DCB* dcb);
|
||||||
MySQLProtocol *gw_mysql_init(MySQLProtocol *data);
|
MySQLProtocol *gw_mysql_init(MySQLProtocol *data);
|
||||||
void gw_mysql_close(MySQLProtocol **ptr);
|
void gw_mysql_close(MySQLProtocol **ptr);
|
||||||
int gw_receive_backend_auth(MySQLProtocol *conn);
|
int gw_receive_backend_auth(MySQLProtocol *conn);
|
||||||
int gw_decode_mysql_server_handshake(MySQLProtocol *conn, uint8_t *payload);
|
int gw_decode_mysql_server_handshake(MySQLProtocol *conn, uint8_t *payload);
|
||||||
int gw_read_backend_handshake(MySQLProtocol *conn);
|
int gw_read_backend_handshake(MySQLProtocol *conn);
|
||||||
int gw_send_authentication_to_backend(char *dbname, char *user, uint8_t *passwd, MySQLProtocol *conn);
|
int gw_send_authentication_to_backend(
|
||||||
|
char *dbname,
|
||||||
|
char *user,
|
||||||
|
uint8_t *passwd,
|
||||||
|
MySQLProtocol *conn);
|
||||||
const char *gw_mysql_protocol_state2string(int state);
|
const char *gw_mysql_protocol_state2string(int state);
|
||||||
int gw_do_connect_to_backend(char *host, int port, MySQLProtocol *conn);
|
int gw_do_connect_to_backend(char *host, int port, MySQLProtocol *conn);
|
||||||
int mysql_send_custom_error (DCB *dcb, int packet_number, int in_affected_rows, const char* mysql_message);
|
int mysql_send_custom_error (
|
||||||
int gw_send_change_user_to_backend(char *dbname, char *user, uint8_t *passwd, MySQLProtocol *conn);
|
DCB *dcb,
|
||||||
int gw_find_mysql_user_password_sha1(char *username, uint8_t *gateway_password, void *repository);
|
int packet_number,
|
||||||
int gw_check_mysql_scramble_data(DCB *dcb, uint8_t *token, unsigned int token_len, uint8_t *scramble, unsigned int scramble_len, char *username, uint8_t *stage1_hash);
|
int in_affected_rows,
|
||||||
int mysql_send_auth_error (DCB *dcb, int packet_number, int in_affected_rows, const char* mysql_message);
|
const char* mysql_message);
|
||||||
|
int gw_send_change_user_to_backend(
|
||||||
|
char *dbname,
|
||||||
|
char *user,
|
||||||
|
uint8_t *passwd,
|
||||||
|
MySQLProtocol *conn);
|
||||||
|
int gw_find_mysql_user_password_sha1(
|
||||||
|
char *username,
|
||||||
|
uint8_t *gateway_password,
|
||||||
|
void *repository);
|
||||||
|
int gw_check_mysql_scramble_data(
|
||||||
|
DCB *dcb,
|
||||||
|
uint8_t *token,
|
||||||
|
unsigned int token_len,
|
||||||
|
uint8_t *scramble,
|
||||||
|
unsigned int scramble_len,
|
||||||
|
char *username,
|
||||||
|
uint8_t *stage1_hash);
|
||||||
|
int mysql_send_auth_error (
|
||||||
|
DCB *dcb,
|
||||||
|
int packet_number,
|
||||||
|
int in_affected_rows,
|
||||||
|
const char* mysql_message);
|
||||||
|
|
||||||
extern void gw_sha1_str(const uint8_t *in, int in_len, uint8_t *out);
|
void gw_sha1_str(const uint8_t *in, int in_len, uint8_t *out);
|
||||||
extern void gw_sha1_2_str(const uint8_t *in, int in_len, const uint8_t *in2, int in2_len, uint8_t *out);
|
void gw_sha1_2_str(
|
||||||
extern void gw_str_xor(uint8_t *output, const uint8_t *input1, const uint8_t *input2, unsigned int len);
|
const uint8_t *in,
|
||||||
extern char *gw_bin2hex(char *out, const uint8_t *in, unsigned int len);
|
int in_len,
|
||||||
extern int gw_hex2bin(uint8_t *out, const char *in, unsigned int len);
|
const uint8_t *in2,
|
||||||
extern int gw_generate_random_str(char *output, int len);
|
int in2_len,
|
||||||
extern char *gw_strend(register const char *s);
|
uint8_t *out);
|
||||||
extern int setnonblocking(int fd);
|
void gw_str_xor(
|
||||||
extern void setipaddress(struct in_addr *a, char *p);
|
uint8_t *output,
|
||||||
extern int gw_read_gwbuff(DCB *dcb, GWBUF **head, int b);
|
const uint8_t *input1,
|
||||||
bool mysql_protocol_init(DCB* dcb);
|
const uint8_t *input2,
|
||||||
|
unsigned int len);
|
||||||
|
char *gw_bin2hex(char *out, const uint8_t *in, unsigned int len);
|
||||||
|
int gw_hex2bin(uint8_t *out, const char *in, unsigned int len);
|
||||||
|
int gw_generate_random_str(char *output, int len);
|
||||||
|
char *gw_strend(register const char *s);
|
||||||
|
int setnonblocking(int fd);
|
||||||
|
void setipaddress(struct in_addr *a, char *p);
|
||||||
|
int gw_read_gwbuff(DCB *dcb, GWBUF **head, int b);
|
||||||
|
@ -36,14 +36,16 @@ extern int gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue);
|
|||||||
extern int gw_error_backend_event(DCB *dcb);
|
extern int gw_error_backend_event(DCB *dcb);
|
||||||
|
|
||||||
|
|
||||||
bool mysql_protocol_init(
|
MySQLProtocol* mysql_protocol_init(
|
||||||
DCB* dcb)
|
DCB* dcb)
|
||||||
{
|
{
|
||||||
MySQLProtocol* p = NULL;
|
MySQLProtocol* p;
|
||||||
bool succp = false;
|
|
||||||
|
|
||||||
|
if (dcb != NULL) {
|
||||||
CHK_DCB(dcb);
|
CHK_DCB(dcb);
|
||||||
|
}
|
||||||
p = (MySQLProtocol *) calloc(1, sizeof(MySQLProtocol));
|
p = (MySQLProtocol *) calloc(1, sizeof(MySQLProtocol));
|
||||||
|
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
int eno = errno;
|
int eno = errno;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
@ -54,16 +56,17 @@ bool mysql_protocol_init(
|
|||||||
pthread_self(),
|
pthread_self(),
|
||||||
eno,
|
eno,
|
||||||
strerror(eno));
|
strerror(eno));
|
||||||
goto return_succp;
|
goto return_p;
|
||||||
}
|
}
|
||||||
p->state = MYSQL_ALLOC;
|
p->state = MYSQL_ALLOC;
|
||||||
p->protocol_chk_top = CHK_NUM_PROTOCOL;
|
p->protocol_chk_top = CHK_NUM_PROTOCOL;
|
||||||
p->protocol_chk_tail = CHK_NUM_PROTOCOL;
|
p->protocol_chk_tail = CHK_NUM_PROTOCOL;
|
||||||
|
p->fd = dcb->fd;
|
||||||
p->descriptor = dcb;
|
p->descriptor = dcb;
|
||||||
dcb->protocol = p;
|
dcb->protocol = p;
|
||||||
succp = true;
|
CHK_PROTOCOL(p);
|
||||||
return_succp:
|
return_p:
|
||||||
return succp;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@ -544,8 +547,6 @@ int gw_do_connect_to_backend(
|
|||||||
strerror(eno));
|
strerror(eno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return_with_dcb:
|
|
||||||
/**
|
/**
|
||||||
* Add the dcb in the poll set
|
* Add the dcb in the poll set
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user