(ctx context.Context, logger *zap.Logger, clientConn net.Conn, nativePassMocks reqResp, initialHandshakeMock *models.Mock, mockDb integrations.MockMemDb, decodeCtx *wire.DecodeContext)
| 456 | } |
| 457 | |
| 458 | func simulateNativePassword(ctx context.Context, logger *zap.Logger, clientConn net.Conn, nativePassMocks reqResp, initialHandshakeMock *models.Mock, mockDb integrations.MockMemDb, decodeCtx *wire.DecodeContext) error { |
| 459 | |
| 460 | logger.Debug("final response for native password", zap.Any("response", nativePassMocks.resp[0].Header.Type)) |
| 461 | |
| 462 | // Send the final response (OK/Err) to the client |
| 463 | buf, err := wire.EncodeToBinary(ctx, logger, &nativePassMocks.resp[0].PacketBundle, clientConn, decodeCtx) |
| 464 | if err != nil { |
| 465 | utils.LogError(logger, err, "failed to encode final response packet for native password") |
| 466 | return err |
| 467 | } |
| 468 | |
| 469 | _, err = clientConn.Write(buf) |
| 470 | if err != nil { |
| 471 | if ctx.Err() != nil { |
| 472 | return ctx.Err() |
| 473 | } |
| 474 | utils.LogError(logger, err, "failed to write final response for native password to the client") |
| 475 | return err |
| 476 | } |
| 477 | |
| 478 | //update the config mock (since it can be reused in case of more connections compared to record mode) |
| 479 | ok := updateMock(ctx, logger, initialHandshakeMock, mockDb) |
| 480 | if !ok { |
| 481 | utils.LogError(logger, nil, "failed to update the mock unfiltered mock during native password") |
| 482 | } |
| 483 | |
| 484 | logger.Debug("native password completed successfully") |
| 485 | |
| 486 | return nil |
| 487 | } |
| 488 | |
| 489 | func simulateCacheSha2Password(ctx context.Context, logger *zap.Logger, clientConn net.Conn, cacheSha2PassMock reqResp, initialHandshakeMock *models.Mock, mockDb integrations.MockMemDb, decodeCtx *wire.DecodeContext) error { |
| 490 | resp := cacheSha2PassMock.resp |
no test coverage detected