1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-07 02:42:49 +03:00

More 10.2-integ fixes:

- renamed my_net functions (ma_net)
- fixed wrong types in ma_schannel.c
- fixed wrong parameter in client_plugin when building load string
This commit is contained in:
Georg Richter
2016-02-17 10:00:53 +01:00
parent 7287229676
commit d303cf76a7
10 changed files with 74 additions and 75 deletions

View File

@@ -355,15 +355,15 @@ extern unsigned long net_buffer_length;
#define net_new_transaction(net) ((net)->pkt_nr=0) #define net_new_transaction(net) ((net)->pkt_nr=0)
int my_net_init(NET *net, MARIADB_PVIO *pvio); int ma_net_init(NET *net, MARIADB_PVIO *pvio);
void net_end(NET *net); void ma_net_end(NET *net);
void net_clear(NET *net); void ma_net_clear(NET *net);
int net_flush(NET *net); int ma_net_flush(NET *net);
int my_net_write(NET *net,const unsigned char *packet, size_t len); int ma_net_write(NET *net,const unsigned char *packet, size_t len);
int net_write_command(NET *net,unsigned char command,const char *packet, int ma_net_write_command(NET *net,unsigned char command,const char *packet,
size_t len); size_t len);
int net_real_write(NET *net,const char *packet, size_t len); int ma_net_real_write(NET *net,const char *packet, size_t len);
extern unsigned long my_net_read(NET *net); extern unsigned long ma_net_read(NET *net);
struct rand_struct { struct rand_struct {
unsigned long seed1,seed2,max_value; unsigned long seed1,seed2,max_value;

View File

@@ -216,7 +216,7 @@ typedef struct st_mysql_perm_bind {
} MYSQL_PS_CONVERSION; } MYSQL_PS_CONVERSION;
extern MYSQL_PS_CONVERSION mysql_ps_fetch_functions[MYSQL_TYPE_GEOMETRY + 1]; extern MYSQL_PS_CONVERSION mysql_ps_fetch_functions[MYSQL_TYPE_GEOMETRY + 1];
unsigned long net_safe_read(MYSQL *mysql); unsigned long ma_net_safe_read(MYSQL *mysql);
void mysql_init_ps_subsystem(void); void mysql_init_ps_subsystem(void);
unsigned long net_field_length(unsigned char **packet); unsigned long net_field_length(unsigned char **packet);
int ma_simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg, int ma_simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg,

View File

@@ -391,8 +391,7 @@ mysql_load_plugin_v(MYSQL *mysql, const char *name, int type,
snprintf(dlpath, sizeof(dlpath) - 1, "%s/%s%s", snprintf(dlpath, sizeof(dlpath) - 1, "%s/%s%s",
mysql->options.extension && mysql->options.extension->plugin_dir ? mysql->options.extension && mysql->options.extension->plugin_dir ?
mysql->options.extension->plugin_dir : (env_plugin_dir) ? env_plugin_dir : mysql->options.extension->plugin_dir : (env_plugin_dir) ? env_plugin_dir :
PLUGINDIR, "/", PLUGINDIR, name, SO_EXT);
name, SO_EXT);
/* Open new dll handle */ /* Open new dll handle */
if (!(dlhandle= dlopen((const char *)dlpath, RTLD_NOW))) if (!(dlhandle= dlopen((const char *)dlpath, RTLD_NOW)))

View File

@@ -201,8 +201,8 @@ my_bool mysql_handle_local_infile(MYSQL *conn, const char *filename)
if (!(conn->options.client_flag & CLIENT_LOCAL_FILES)) { if (!(conn->options.client_flag & CLIENT_LOCAL_FILES)) {
my_set_error(conn, CR_UNKNOWN_ERROR, SQLSTATE_UNKNOWN, "Load data local infile forbidden"); my_set_error(conn, CR_UNKNOWN_ERROR, SQLSTATE_UNKNOWN, "Load data local infile forbidden");
/* write empty packet to server */ /* write empty packet to server */
my_net_write(&conn->net, "", 0); ma_net_write(&conn->net, "", 0);
net_flush(&conn->net); ma_net_flush(&conn->net);
goto infile_error; goto infile_error;
} }
@@ -218,15 +218,15 @@ my_bool mysql_handle_local_infile(MYSQL *conn, const char *filename)
tmp_errno= conn->options.local_infile_error(info, tmp_buf, sizeof(tmp_buf)); tmp_errno= conn->options.local_infile_error(info, tmp_buf, sizeof(tmp_buf));
my_set_error(conn, tmp_errno, SQLSTATE_UNKNOWN, tmp_buf); my_set_error(conn, tmp_errno, SQLSTATE_UNKNOWN, tmp_buf);
my_net_write(&conn->net, "", 0); ma_net_write(&conn->net, "", 0);
net_flush(&conn->net); ma_net_flush(&conn->net);
goto infile_error; goto infile_error;
} }
/* read data */ /* read data */
while ((bufread= conn->options.local_infile_read(info, (char *)buf, buflen)) > 0) while ((bufread= conn->options.local_infile_read(info, (char *)buf, buflen)) > 0)
{ {
if (my_net_write(&conn->net, (char *)buf, bufread)) if (ma_net_write(&conn->net, (char *)buf, bufread))
{ {
my_set_error(conn, CR_SERVER_LOST, SQLSTATE_UNKNOWN, NULL); my_set_error(conn, CR_SERVER_LOST, SQLSTATE_UNKNOWN, NULL);
goto infile_error; goto infile_error;
@@ -234,7 +234,7 @@ my_bool mysql_handle_local_infile(MYSQL *conn, const char *filename)
} }
/* send empty packet for eof */ /* send empty packet for eof */
if (my_net_write(&conn->net, "", 0) || net_flush(&conn->net)) if (ma_net_write(&conn->net, "", 0) || ma_net_flush(&conn->net))
{ {
my_set_error(conn, CR_SERVER_LOST, SQLSTATE_UNKNOWN, NULL); my_set_error(conn, CR_SERVER_LOST, SQLSTATE_UNKNOWN, NULL);
goto infile_error; goto infile_error;

View File

@@ -93,12 +93,12 @@ extern pthread_mutex_t LOCK_bytes_sent , LOCK_bytes_received;
** can't normally do this the client should have a bigger max-buffer. ** can't normally do this the client should have a bigger max-buffer.
*/ */
static int net_write_buff(NET *net,const char *packet, size_t len); static int ma_net_write_buff(NET *net,const char *packet, size_t len);
/* Init with packet info */ /* Init with packet info */
int my_net_init(NET *net, MARIADB_PVIO* pvio) int ma_net_init(NET *net, MARIADB_PVIO* pvio)
{ {
if (!(net->buff=(uchar*) calloc(1, net_buffer_length))) if (!(net->buff=(uchar*) calloc(1, net_buffer_length)))
return 1; return 1;
@@ -128,7 +128,7 @@ int my_net_init(NET *net, MARIADB_PVIO* pvio)
return 0; return 0;
} }
void net_end(NET *net) void ma_net_end(NET *net)
{ {
free(net->buff); free(net->buff);
free(net->mbuff); free(net->mbuff);
@@ -172,7 +172,7 @@ static my_bool net_realloc(NET *net, my_bool is_multi, size_t length)
} }
/* Remove unwanted characters from connection */ /* Remove unwanted characters from connection */
void net_clear(NET *net) void ma_net_clear(NET *net)
{ {
// size_t len; // size_t len;
/* if (net->pvio) /* if (net->pvio)
@@ -185,13 +185,13 @@ void net_clear(NET *net)
} }
/* Flush write_buffer if not empty. */ /* Flush write_buffer if not empty. */
int net_flush(NET *net) int ma_net_flush(NET *net)
{ {
int error=0; int error=0;
if (net->buff != net->write_pos) if (net->buff != net->write_pos)
{ {
error=net_real_write(net,(char*) net->buff, error=ma_net_real_write(net,(char*) net->buff,
(size_t) (net->write_pos - net->buff)); (size_t) (net->write_pos - net->buff));
net->write_pos=net->buff; net->write_pos=net->buff;
} }
@@ -212,7 +212,7 @@ int net_flush(NET *net)
*/ */
int int
my_net_write(NET *net, const uchar *packet, size_t len) ma_net_write(NET *net, const uchar *packet, size_t len)
{ {
uchar buff[NET_HEADER_SIZE]; uchar buff[NET_HEADER_SIZE];
while (len >= MAX_PACKET_LENGTH) while (len >= MAX_PACKET_LENGTH)
@@ -220,8 +220,8 @@ my_net_write(NET *net, const uchar *packet, size_t len)
const ulong max_len= MAX_PACKET_LENGTH; const ulong max_len= MAX_PACKET_LENGTH;
int3store(buff,max_len); int3store(buff,max_len);
buff[3]= (uchar)net->pkt_nr++; buff[3]= (uchar)net->pkt_nr++;
if (net_write_buff(net,(char*) buff,NET_HEADER_SIZE) || if (ma_net_write_buff(net,(char*) buff,NET_HEADER_SIZE) ||
net_write_buff(net, packet, max_len)) ma_net_write_buff(net, packet, max_len))
return 1; return 1;
packet+= max_len; packet+= max_len;
len-= max_len; len-= max_len;
@@ -229,14 +229,14 @@ my_net_write(NET *net, const uchar *packet, size_t len)
/* write last remaining packet, size can be zero */ /* write last remaining packet, size can be zero */
int3store(buff, len); int3store(buff, len);
buff[3]= (uchar)net->pkt_nr++; buff[3]= (uchar)net->pkt_nr++;
if (net_write_buff(net,(char*) buff,NET_HEADER_SIZE) || if (ma_net_write_buff(net,(char*) buff,NET_HEADER_SIZE) ||
net_write_buff(net, packet, len)) ma_net_write_buff(net, packet, len))
return 1; return 1;
return 0; return 0;
} }
int int
net_write_command(NET *net, uchar command, ma_net_write_command(NET *net, uchar command,
const char *packet, size_t len) const char *packet, size_t len)
{ {
uchar buff[NET_HEADER_SIZE+1]; uchar buff[NET_HEADER_SIZE+1];
@@ -255,8 +255,8 @@ net_write_command(NET *net, uchar command,
int3store(buff, MAX_PACKET_LENGTH); int3store(buff, MAX_PACKET_LENGTH);
buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++); buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++);
if (net_write_buff(net, (char *)buff, buff_size) || if (ma_net_write_buff(net, (char *)buff, buff_size) ||
net_write_buff(net, packet, len)) ma_net_write_buff(net, packet, len))
return(1); return(1);
packet+= len; packet+= len;
length-= MAX_PACKET_LENGTH; length-= MAX_PACKET_LENGTH;
@@ -267,15 +267,15 @@ net_write_command(NET *net, uchar command,
} }
int3store(buff,length); int3store(buff,length);
buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++); buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++);
rc= test (net_write_buff(net,(char *)buff, buff_size) || rc= test (ma_net_write_buff(net,(char *)buff, buff_size) ||
net_write_buff(net,packet,len) || ma_net_write_buff(net,packet,len) ||
net_flush(net)); ma_net_flush(net));
return rc; return rc;
} }
static int static int
net_write_buff(NET *net,const char *packet, size_t len) ma_net_write_buff(NET *net,const char *packet, size_t len)
{ {
size_t left_length; size_t left_length;
@@ -290,7 +290,7 @@ net_write_buff(NET *net,const char *packet, size_t len)
if (net->write_pos != net->buff) if (net->write_pos != net->buff)
{ {
memcpy((char*) net->write_pos,packet,left_length); memcpy((char*) net->write_pos,packet,left_length);
if (net_real_write(net,(char*) net->buff, if (ma_net_real_write(net,(char*) net->buff,
(size_t)(net->write_pos - net->buff) + left_length)) (size_t)(net->write_pos - net->buff) + left_length))
return 1; return 1;
packet+=left_length; packet+=left_length;
@@ -304,14 +304,14 @@ net_write_buff(NET *net,const char *packet, size_t len)
left_length= MAX_PACKET_LENGTH; left_length= MAX_PACKET_LENGTH;
while (len > left_length) while (len > left_length)
{ {
if (net_real_write(net, packet, left_length)) if (ma_net_real_write(net, packet, left_length))
return 1; return 1;
packet+= left_length; packet+= left_length;
len-= left_length; len-= left_length;
} }
} }
if (len > net->max_packet) if (len > net->max_packet)
return(test(net_real_write(net, packet, len))); return(test(ma_net_real_write(net, packet, len)));
} }
memcpy((char*) net->write_pos,packet,len); memcpy((char*) net->write_pos,packet,len);
net->write_pos+=len; net->write_pos+=len;
@@ -325,7 +325,7 @@ int net_add_multi_command(NET *net, uchar command, const uchar *packet,
size_t required_length, current_length; size_t required_length, current_length;
required_length= length + 1 + NET_HEADER_SIZE; required_length= length + 1 + NET_HEADER_SIZE;
/* We didn't allocate memory in my_net_init since it was to early to /* We didn't allocate memory in ma_net_init since it was to early to
* detect if the server supports COM_MULTI command */ * detect if the server supports COM_MULTI command */
if (!net->mbuff) if (!net->mbuff)
{ {
@@ -370,7 +370,7 @@ error:
/* Read and write using timeouts */ /* Read and write using timeouts */
int int
net_real_write(NET *net,const char *packet,size_t len) ma_net_real_write(NET *net,const char *packet,size_t len)
{ {
size_t length; size_t length;
char *pos,*end; char *pos,*end;
@@ -431,7 +431,7 @@ net_real_write(NET *net,const char *packet,size_t len)
** Read something from server/clinet ** Read something from server/clinet
*****************************************************************************/ *****************************************************************************/
static ulong static ulong
my_real_read(NET *net, size_t *complen) ma_real_read(NET *net, size_t *complen)
{ {
uchar *pos; uchar *pos;
size_t length; size_t length;
@@ -507,7 +507,7 @@ end:
return(len); return(len);
} }
ulong my_net_read(NET *net) ulong ma_net_read(NET *net)
{ {
size_t len,complen; size_t len,complen;
@@ -515,7 +515,7 @@ ulong my_net_read(NET *net)
if (!net->compress) if (!net->compress)
{ {
#endif #endif
len = my_real_read (net,(size_t *)&complen); len = ma_real_read (net,(size_t *)&complen);
if (len == MAX_PACKET_LENGTH) if (len == MAX_PACKET_LENGTH)
{ {
/* multi packet read */ /* multi packet read */
@@ -526,7 +526,7 @@ ulong my_net_read(NET *net)
{ {
length+= len; length+= len;
net->where_b+= (unsigned long)len; net->where_b+= (unsigned long)len;
len= my_real_read(net, &complen); len= ma_real_read(net, &complen);
} while (len == MAX_PACKET_LENGTH); } while (len == MAX_PACKET_LENGTH);
net->where_b= last_pos; net->where_b= last_pos;
if (len != packet_error) if (len != packet_error)
@@ -636,7 +636,7 @@ ulong my_net_read(NET *net)
net->where_b=(unsigned long)buffer_length; net->where_b=(unsigned long)buffer_length;
if ((packet_length = my_real_read(net,(size_t *)&complen)) == packet_error) if ((packet_length = ma_real_read(net,(size_t *)&complen)) == packet_error)
return packet_error; return packet_error;
if (_mariadb_uncompress((unsigned char*) net->buff + net->where_b, &packet_length, &complen)) if (_mariadb_uncompress((unsigned char*) net->buff + net->where_b, &packet_length, &complen))
{ {

View File

@@ -111,7 +111,7 @@ const char *ma_pvio_ssl_cipher(MARIADB_SSL *cssl)
void ma_pvio_ssl_end() void ma_pvio_ssl_end()
{ {
return ma_ssl_end(); ma_ssl_end();
} }
my_bool ma_pvio_ssl_get_protocol_version(MARIADB_SSL *cssl, struct st_ssl_version *version) my_bool ma_pvio_ssl_get_protocol_version(MARIADB_SSL *cssl, struct st_ssl_version *version)

View File

@@ -185,14 +185,14 @@ void net_get_error(char *buf, size_t buf_len,
*****************************************************************************/ *****************************************************************************/
ulong ulong
net_safe_read(MYSQL *mysql) ma_net_safe_read(MYSQL *mysql)
{ {
NET *net= &mysql->net; NET *net= &mysql->net;
ulong len=0; ulong len=0;
restart: restart:
if (net->pvio != 0) if (net->pvio != 0)
len=my_net_read(net); len=ma_net_read(net);
if (len == packet_error || len == 0) if (len == packet_error || len == 0)
{ {
@@ -396,11 +396,11 @@ mthd_my_send_cmd(MYSQL *mysql,enum enum_server_command command, const char *arg,
mysql->info=0; mysql->info=0;
mysql->affected_rows= ~(my_ulonglong) 0; mysql->affected_rows= ~(my_ulonglong) 0;
net_clear(net); /* Clear receive buffer */ ma_net_clear(net); /* Clear receive buffer */
if (!arg) if (!arg)
arg=""; arg="";
if (net_write_command(net,(uchar) command,arg, if (ma_net_write_command(net,(uchar) command,arg,
length ? length : (ulong) strlen(arg))) length ? length : (ulong) strlen(arg)))
{ {
if (net->last_errno == ER_NET_PACKET_TOO_LARGE) if (net->last_errno == ER_NET_PACKET_TOO_LARGE)
@@ -411,7 +411,7 @@ mthd_my_send_cmd(MYSQL *mysql,enum enum_server_command command, const char *arg,
end_server(mysql); end_server(mysql);
if (mysql_reconnect(mysql)) if (mysql_reconnect(mysql))
goto end; goto end;
if (net_write_command(net,(uchar) command,arg, if (ma_net_write_command(net,(uchar) command,arg,
length ? length : (ulong) strlen(arg))) length ? length : (ulong) strlen(arg)))
{ {
my_set_error(mysql, CR_SERVER_GONE_ERROR, SQLSTATE_UNKNOWN, 0); my_set_error(mysql, CR_SERVER_GONE_ERROR, SQLSTATE_UNKNOWN, 0);
@@ -420,7 +420,7 @@ mthd_my_send_cmd(MYSQL *mysql,enum enum_server_command command, const char *arg,
} }
result=0; result=0;
if (!skipp_check) { if (!skipp_check) {
result= ((mysql->packet_length=net_safe_read(mysql)) == packet_error ? result= ((mysql->packet_length=ma_net_safe_read(mysql)) == packet_error ?
1 : 0); 1 : 0);
} }
end: end:
@@ -509,7 +509,7 @@ end_server(MYSQL *mysql)
ma_pvio_close(mysql->net.pvio); ma_pvio_close(mysql->net.pvio);
mysql->net.pvio= 0; /* Marker */ mysql->net.pvio= 0; /* Marker */
} }
net_end(&mysql->net); ma_net_end(&mysql->net);
free_old_query(mysql); free_old_query(mysql);
return; return;
} }
@@ -519,7 +519,7 @@ void mthd_my_skip_result(MYSQL *mysql)
ulong pkt_len; ulong pkt_len;
do { do {
pkt_len= net_safe_read(mysql); pkt_len= ma_net_safe_read(mysql);
if (pkt_len == packet_error) if (pkt_len == packet_error)
break; break;
} while (pkt_len > 8 || mysql->net.read_pos[0] != 254); } while (pkt_len > 8 || mysql->net.read_pos[0] != 254);
@@ -794,7 +794,7 @@ MYSQL_DATA *mthd_my_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
MYSQL_ROWS **prev_ptr,*cur; MYSQL_ROWS **prev_ptr,*cur;
NET *net = &mysql->net; NET *net = &mysql->net;
if ((pkt_len= net_safe_read(mysql)) == packet_error) if ((pkt_len= ma_net_safe_read(mysql)) == packet_error)
return(0); return(0);
if (!(result=(MYSQL_DATA*) calloc(1, sizeof(MYSQL_DATA)))) if (!(result=(MYSQL_DATA*) calloc(1, sizeof(MYSQL_DATA))))
{ {
@@ -850,7 +850,7 @@ MYSQL_DATA *mthd_my_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
} }
} }
cur->data[field]=to; /* End of last field */ cur->data[field]=to; /* End of last field */
if ((pkt_len=net_safe_read(mysql)) == packet_error) if ((pkt_len=ma_net_safe_read(mysql)) == packet_error)
{ {
free_rows(result); free_rows(result);
return(0); return(0);
@@ -881,7 +881,7 @@ int mthd_my_read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
ulong pkt_len,len; ulong pkt_len,len;
uchar *pos,*prev_pos, *end_pos; uchar *pos,*prev_pos, *end_pos;
if ((pkt_len=(uint) net_safe_read(mysql)) == packet_error) if ((pkt_len=(uint) ma_net_safe_read(mysql)) == packet_error)
return -1; return -1;
if (pkt_len <= 8 && mysql->net.read_pos[0] == 254) if (pkt_len <= 8 && mysql->net.read_pos[0] == 254)
@@ -1232,7 +1232,7 @@ MYSQL *mthd_my_real_connect(MYSQL *mysql, const char *host, const char *user,
goto error; goto error;
} }
if (my_net_init(net, pvio)) if (ma_net_init(net, pvio))
goto error; goto error;
ma_pvio_keepalive(net->pvio); ma_pvio_keepalive(net->pvio);
@@ -1250,7 +1250,7 @@ MYSQL *mthd_my_real_connect(MYSQL *mysql, const char *host, const char *user,
goto error; goto error;
} }
*/ */
if ((pkt_length=net_safe_read(mysql)) == packet_error) if ((pkt_length=ma_net_safe_read(mysql)) == packet_error)
{ {
if (mysql->net.last_errno == CR_SERVER_LOST) if (mysql->net.last_errno == CR_SERVER_LOST)
my_set_error(mysql, CR_SERVER_LOST, SQLSTATE_UNKNOWN, my_set_error(mysql, CR_SERVER_LOST, SQLSTATE_UNKNOWN,
@@ -1584,7 +1584,7 @@ my_bool STDCALL mysql_reconnect(MYSQL *mysql)
mysql_close(mysql); mysql_close(mysql);
*mysql=tmp_mysql; *mysql=tmp_mysql;
mysql->net.pvio->mysql= mysql; mysql->net.pvio->mysql= mysql;
net_clear(&mysql->net); ma_net_clear(&mysql->net);
mysql->affected_rows= ~(my_ulonglong) 0; mysql->affected_rows= ~(my_ulonglong) 0;
return(0); return(0);
} }
@@ -1886,7 +1886,7 @@ int mthd_my_read_query_result(MYSQL *mysql)
MYSQL_DATA *fields; MYSQL_DATA *fields;
ulong length; ulong length;
if (!mysql || (length = net_safe_read(mysql)) == packet_error) if (!mysql || (length = ma_net_safe_read(mysql)) == packet_error)
{ {
return(1); return(1);
} }
@@ -1909,7 +1909,7 @@ get_info:
{ {
int error=mysql_handle_local_infile(mysql, (char *)pos); int error=mysql_handle_local_infile(mysql, (char *)pos);
if ((length=net_safe_read(mysql)) == packet_error || error) if ((length=ma_net_safe_read(mysql)) == packet_error || error)
return(-1); return(-1);
goto get_info; /* Get info packet */ goto get_info; /* Get info packet */
} }

View File

@@ -123,7 +123,7 @@ static int stmt_unbuffered_fetch(MYSQL_STMT *stmt, uchar **row)
{ {
ulong pkt_len; ulong pkt_len;
pkt_len= net_safe_read(stmt->mysql); pkt_len= ma_net_safe_read(stmt->mysql);
if (pkt_len == packet_error) if (pkt_len == packet_error)
{ {
@@ -167,7 +167,7 @@ int mthd_stmt_read_all_rows(MYSQL_STMT *stmt)
pprevious= &result->data; pprevious= &result->data;
while ((packet_len = net_safe_read(stmt->mysql)) != packet_error) while ((packet_len = ma_net_safe_read(stmt->mysql)) != packet_error)
{ {
p= stmt->mysql->net.read_pos; p= stmt->mysql->net.read_pos;
if (packet_len > 7 || p[0] != 254) if (packet_len > 7 || p[0] != 254)
@@ -295,7 +295,7 @@ static int stmt_cursor_fetch(MYSQL_STMT *stmt, uchar **row)
void mthd_stmt_flush_unbuffered(MYSQL_STMT *stmt) void mthd_stmt_flush_unbuffered(MYSQL_STMT *stmt)
{ {
ulong packet_len; ulong packet_len;
while ((packet_len = net_safe_read(stmt->mysql)) != packet_error) while ((packet_len = ma_net_safe_read(stmt->mysql)) != packet_error)
if (packet_len < 8 && stmt->mysql->net.read_pos[0] == 254) if (packet_len < 8 && stmt->mysql->net.read_pos[0] == 254)
return; return;
} }
@@ -1165,7 +1165,7 @@ my_bool mthd_stmt_read_prepare_response(MYSQL_STMT *stmt)
ulong packet_length; ulong packet_length;
uchar *p; uchar *p;
if ((packet_length= net_safe_read(stmt->mysql)) == packet_error) if ((packet_length= ma_net_safe_read(stmt->mysql)) == packet_error)
return(1); return(1);
p= (uchar *)stmt->mysql->net.read_pos; p= (uchar *)stmt->mysql->net.read_pos;

View File

@@ -782,8 +782,8 @@ my_bool ma_schannel_verify_certs(SC_CTX *sctx, DWORD dwCertFlags)
DWORD flags; DWORD flags;
MARIADB_PVIO *pvio= sctx->mysql->net.pvio; MARIADB_PVIO *pvio= sctx->mysql->net.pvio;
PCCERT_CONTEXT pServerCert= NULL; PCCERT_CONTEXT pServerCert= NULL;
PCERT_CONTEXT ca_CTX = NULL; PCCERT_CONTEXT ca_CTX = NULL;
PCRL_CONTEXT crl_CTX = NULL; PCCRL_CONTEXT crl_CTX = NULL;
my_bool is_Ok = 0; my_bool is_Ok = 0;
if ((sRet= QueryContextAttributes(&sctx->ctxt, SECPKG_ATTR_REMOTE_CERT_CONTEXT, (PVOID)&pServerCert)) != SEC_E_OK) if ((sRet= QueryContextAttributes(&sctx->ctxt, SECPKG_ATTR_REMOTE_CERT_CONTEXT, (PVOID)&pServerCert)) != SEC_E_OK)

View File

@@ -245,7 +245,7 @@ static int send_client_reply_packet(MCPVIO_EXT *mpvio,
Send mysql->client_flag, max_packet_size - unencrypted otherwise Send mysql->client_flag, max_packet_size - unencrypted otherwise
the server does not know we want to do SSL the server does not know we want to do SSL
*/ */
if (my_net_write(net, (char*)buff, (size_t) (end-buff)) || net_flush(net)) if (ma_net_write(net, (char*)buff, (size_t) (end-buff)) || ma_net_flush(net))
{ {
my_set_error(mysql, CR_SERVER_LOST, SQLSTATE_UNKNOWN, my_set_error(mysql, CR_SERVER_LOST, SQLSTATE_UNKNOWN,
ER(CR_SERVER_LOST_EXTENDED), ER(CR_SERVER_LOST_EXTENDED),
@@ -297,7 +297,7 @@ static int send_client_reply_packet(MCPVIO_EXT *mpvio,
end= ma_send_connect_attr(mysql, end); end= ma_send_connect_attr(mysql, end);
/* Write authentication package */ /* Write authentication package */
if (my_net_write(net, buff, (size_t) (end-buff)) || net_flush(net)) if (ma_net_write(net, buff, (size_t) (end-buff)) || ma_net_flush(net))
{ {
my_set_error(mysql, CR_SERVER_LOST, SQLSTATE_UNKNOWN, my_set_error(mysql, CR_SERVER_LOST, SQLSTATE_UNKNOWN,
ER(CR_SERVER_LOST_EXTENDED), ER(CR_SERVER_LOST_EXTENDED),
@@ -348,7 +348,7 @@ static int client_mpvio_read_packet(struct st_plugin_vio *mpv, uchar **buf)
} }
/* otherwise read the data */ /* otherwise read the data */
pkt_len= net_safe_read(mysql); pkt_len= ma_net_safe_read(mysql);
mpvio->last_read_packet_len= pkt_len; mpvio->last_read_packet_len= pkt_len;
*buf= mysql->net.read_pos; *buf= mysql->net.read_pos;
@@ -401,7 +401,7 @@ static int client_mpvio_write_packet(struct st_plugin_vio *mpv,
if (mpvio->mysql->thd) if (mpvio->mysql->thd)
res= 1; /* no chit-chat in embedded */ res= 1; /* no chit-chat in embedded */
else else
res= my_net_write(net, (char *)pkt, pkt_len) || net_flush(net); res= ma_net_write(net, (char *)pkt, pkt_len) || ma_net_flush(net);
if (res) if (res)
my_set_error(mpvio->mysql, CR_SERVER_LOST, SQLSTATE_UNKNOWN, my_set_error(mpvio->mysql, CR_SERVER_LOST, SQLSTATE_UNKNOWN,
ER(CR_SERVER_LOST_EXTENDED), ER(CR_SERVER_LOST_EXTENDED),
@@ -554,7 +554,7 @@ int run_plugin_auth(MYSQL *mysql, char *data, uint data_len,
/* read the OK packet (or use the cached value in mysql->net.read_pos */ /* read the OK packet (or use the cached value in mysql->net.read_pos */
if (res == CR_OK) if (res == CR_OK)
pkt_length= net_safe_read(mysql); pkt_length= ma_net_safe_read(mysql);
else /* res == CR_OK_HANDSHAKE_COMPLETE */ else /* res == CR_OK_HANDSHAKE_COMPLETE */
pkt_length= mpvio.last_read_packet_len; pkt_length= mpvio.last_read_packet_len;
@@ -583,7 +583,7 @@ int run_plugin_auth(MYSQL *mysql, char *data, uint data_len,
/* new "use different plugin" packet */ /* new "use different plugin" packet */
uint len; uint len;
auth_plugin_name= (char*)mysql->net.read_pos + 1; auth_plugin_name= (char*)mysql->net.read_pos + 1;
len= (uint)strlen(auth_plugin_name); /* safe as my_net_read always appends \0 */ len= (uint)strlen(auth_plugin_name); /* safe as ma_net_read always appends \0 */
mpvio.cached_server_reply.pkt_len= pkt_length - len - 2; mpvio.cached_server_reply.pkt_len= pkt_length - len - 2;
mpvio.cached_server_reply.pkt= mysql->net.read_pos + len + 2; mpvio.cached_server_reply.pkt= mysql->net.read_pos + len + 2;
} }
@@ -608,7 +608,7 @@ int run_plugin_auth(MYSQL *mysql, char *data, uint data_len,
if (res != CR_OK_HANDSHAKE_COMPLETE) if (res != CR_OK_HANDSHAKE_COMPLETE)
{ {
/* Read what server thinks about out new auth message report */ /* Read what server thinks about out new auth message report */
if (net_safe_read(mysql) == packet_error) if (ma_net_safe_read(mysql) == packet_error)
{ {
if (mysql->net.last_errno == CR_SERVER_LOST) if (mysql->net.last_errno == CR_SERVER_LOST)
my_set_error(mysql, CR_SERVER_LOST, SQLSTATE_UNKNOWN, my_set_error(mysql, CR_SERVER_LOST, SQLSTATE_UNKNOWN,