(t *testing.T)
| 121 | } |
| 122 | |
| 123 | func TestAuthFastCachingSHA256PasswordEmpty(t *testing.T) { |
| 124 | conn, mc := newRWMockConn(1) |
| 125 | mc.cfg.User = "root" |
| 126 | mc.cfg.Passwd = "" |
| 127 | |
| 128 | authData := []byte{90, 105, 74, 126, 30, 48, 37, 56, 3, 23, 115, 127, 69, |
| 129 | 22, 41, 84, 32, 123, 43, 118} |
| 130 | plugin := "caching_sha2_password" |
| 131 | |
| 132 | // Send Client Authentication Packet |
| 133 | authResp, err := mc.auth(authData, plugin) |
| 134 | if err != nil { |
| 135 | t.Fatal(err) |
| 136 | } |
| 137 | err = mc.writeHandshakeResponsePacket(authResp, plugin) |
| 138 | if err != nil { |
| 139 | t.Fatal(err) |
| 140 | } |
| 141 | |
| 142 | // check written auth response |
| 143 | authRespStart := 4 + 4 + 4 + 1 + 23 + len(mc.cfg.User) + 1 |
| 144 | authRespEnd := authRespStart + 1 + len(authResp) |
| 145 | writtenAuthRespLen := conn.written[authRespStart] |
| 146 | writtenAuthResp := conn.written[authRespStart+1 : authRespEnd] |
| 147 | if writtenAuthRespLen != 0 { |
| 148 | t.Fatalf("unexpected written auth response (%d bytes): %v", |
| 149 | writtenAuthRespLen, writtenAuthResp) |
| 150 | } |
| 151 | conn.written = nil |
| 152 | |
| 153 | // auth response |
| 154 | conn.data = []byte{ |
| 155 | 7, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, // OK |
| 156 | } |
| 157 | conn.maxReads = 1 |
| 158 | |
| 159 | // Handle response to auth packet |
| 160 | if err := mc.handleAuthResult(authData, plugin); err != nil { |
| 161 | t.Errorf("got error: %v", err) |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | func TestAuthFastCachingSHA256PasswordFullRSA(t *testing.T) { |
| 166 | conn, mc := newRWMockConn(1) |
nothing calls this directly
no test coverage detected