see: https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_connection_phase_packets_protocol_auth_switch_request.html
(newAuthPluginName string)
| 80 | |
| 81 | // see: https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_connection_phase_packets_protocol_auth_switch_request.html |
| 82 | func (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 |
| 101 | func (c *Conn) readAuthSwitchRequestResponse() ([]byte, error) { |
no test coverage detected