MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / writeAuthSwitchRequest

Method writeAuthSwitchRequest

IceFireDB-SQLite/pkg/mysql/server/resp.go:82–98  ·  view source on GitHub ↗

see: https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_connection_phase_packets_protocol_auth_switch_request.html

(newAuthPluginName string)

Source from the content-addressed store, hash-verified

80
81// see: https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_connection_phase_packets_protocol_auth_switch_request.html
82func (c *Conn) writeAuthSwitchRequest(newAuthPluginName string) error {
83 data := make([]byte, 4)
84 data = append(data, EOF_HEADER)
85 data = append(data, []byte(newAuthPluginName)...)
86 data = append(data, 0x00)
87 rnd, err := RandomBuf(20)
88 if err != nil {
89 return err
90 }
91 // new auth data
92 c.salt = rnd
93 data = append(data, c.salt...)
94 // the online doc states it's a string.EOF, however, the actual MySQL server add a \NUL to the end, without it, the
95 // official MySQL client will fail.
96 data = append(data, 0x00)
97 return c.WritePacket(data)
98}
99
100// see: https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_connection_phase_packets_protocol_auth_switch_response.html
101func (c *Conn) readAuthSwitchRequestResponse() ([]byte, error) {

Callers 1

handleAuthMatchMethod · 0.95

Calls 2

WritePacketMethod · 0.95
RandomBufFunction · 0.50

Tested by

no test coverage detected