MCPcopy Create free account
hub / github.com/Tencent/phxsql / server_mpvio_write_packet

Function server_mpvio_write_packet

phx_percona/percona/sql/sql_acl.cc:11029–11055  ·  view source on GitHub ↗

vio->write_packet() callback method for server authentication plugins This function is called by a server authentication plugin, when it wants to send data to the client. It transparently wraps the data into a handshake packet, and handles plugin negotiation with the client. If necessary, it escapes the plugin data, if it starts with a mysql protocol packet byte. */

Source from the content-addressed store, hash-verified

11027 it escapes the plugin data, if it starts with a mysql protocol packet byte.
11028*/
11029static int server_mpvio_write_packet(MYSQL_PLUGIN_VIO *param,
11030 const uchar *packet, int packet_len)
11031{
11032 MPVIO_EXT *mpvio= (MPVIO_EXT *) param;
11033 int res;
11034
11035 DBUG_ENTER("server_mpvio_write_packet");
11036 /*
11037 Reset cached_client_reply if not an old client doing mysql_change_user,
11038 as this is where the password from COM_CHANGE_USER is stored.
11039 */
11040 if (!((!(mpvio->client_capabilities & CLIENT_PLUGIN_AUTH)) &&
11041 mpvio->status == MPVIO_EXT::RESTART &&
11042 mpvio->cached_client_reply.plugin ==
11043 ((st_mysql_auth *) (plugin_decl(mpvio->plugin)->info))->client_auth_plugin
11044 ))
11045 mpvio->cached_client_reply.pkt= 0;
11046 /* for the 1st packet we wrap plugin data into the handshake packet */
11047 if (mpvio->packets_written == 0)
11048 res= send_server_handshake_packet(mpvio, (char*) packet, packet_len);
11049 else if (mpvio->status == MPVIO_EXT::RESTART)
11050 res= send_plugin_request_packet(mpvio, packet, packet_len);
11051 else
11052 res= wrap_plguin_data_into_proper_command(mpvio->net, packet, packet_len);
11053 mpvio->packets_written++;
11054 DBUG_RETURN(res);
11055}
11056
11057/**
11058 vio->read_packet() callback method for server authentication plugins

Callers

nothing calls this directly

Tested by

no test coverage detected