MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / client_mpvio_write_packet

Function client_mpvio_write_packet

sql-common/client.c:2852–2880  ·  view source on GitHub ↗

vio->write_packet() callback method for client authentication plugins This function is called by a client authentication plugin, when it wants to send data to the server. It transparently wraps the data into a change user or authentication handshake packet, if neccessary. */

Source from the content-addressed store, hash-verified

2850 handshake packet, if neccessary.
2851*/
2852static int client_mpvio_write_packet(struct st_plugin_vio *mpv,
2853 const uchar *pkt, int pkt_len)
2854{
2855 int res;
2856 MCPVIO_EXT *mpvio= (MCPVIO_EXT*)mpv;
2857
2858 if (mpvio->packets_written == 0)
2859 {
2860 if (mpvio->mysql_change_user)
2861 res= send_change_user_packet(mpvio, pkt, pkt_len);
2862 else
2863 res= send_client_reply_packet(mpvio, pkt, pkt_len);
2864 }
2865 else
2866 {
2867 NET *net= &mpvio->mysql->net;
2868 if (mpvio->mysql->thd)
2869 res= 1; /* no chit-chat in embedded */
2870 else
2871 res= my_net_write(net, pkt, pkt_len) || net_flush(net);
2872 if (res)
2873 set_mysql_extended_error(mpvio->mysql, CR_SERVER_LOST, unknown_sqlstate,
2874 ER(CR_SERVER_LOST_EXTENDED),
2875 "sending authentication information",
2876 errno);
2877 }
2878 mpvio->packets_written++;
2879 return res;
2880}
2881
2882/**
2883 fills MYSQL_PLUGIN_VIO_INFO structure with the information about the

Callers 1

client_mpvio_read_packetFunction · 0.85

Calls 3

send_change_user_packetFunction · 0.85
send_client_reply_packetFunction · 0.85
set_mysql_extended_errorFunction · 0.85

Tested by

no test coverage detected