mirror of
https://github.com/boostorg/mysql.git
synced 2026-01-22 17:32:25 +00:00
Errors issued by the server for caching_sha2_password users after a fast auth OK packet has been received (e.g. bad database errors) are now reported correctly Handshake now correctly detects protocol violation errors, like double auth switches close #469 close #468
40 lines
1.1 KiB
C++
40 lines
1.1 KiB
C++
//
|
|
// Copyright (c) 2019-2025 Ruben Perez Hidalgo (rubenperez038 at gmail dot com)
|
|
//
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
//
|
|
|
|
#ifndef BOOST_MYSQL_TEST_UNIT_INCLUDE_TEST_UNIT_SERIALIZE_TO_VECTOR_HPP
|
|
#define BOOST_MYSQL_TEST_UNIT_INCLUDE_TEST_UNIT_SERIALIZE_TO_VECTOR_HPP
|
|
|
|
#include <boost/mysql/error_code.hpp>
|
|
|
|
#include <boost/mysql/impl/internal/protocol/impl/serialization_context.hpp>
|
|
#include <boost/mysql/impl/internal/protocol/serialization.hpp>
|
|
|
|
#include <boost/test/unit_test.hpp>
|
|
|
|
#include <cstdint>
|
|
#include <vector>
|
|
|
|
namespace boost {
|
|
namespace mysql {
|
|
namespace test {
|
|
|
|
template <class Fn>
|
|
std::vector<std::uint8_t> serialize_to_vector(const Fn& serialize_fn)
|
|
{
|
|
std::vector<std::uint8_t> buff;
|
|
detail::serialization_context ctx(buff, static_cast<std::size_t>(-1), detail::disable_framing);
|
|
serialize_fn(ctx);
|
|
BOOST_TEST(ctx.error() == error_code());
|
|
return buff;
|
|
}
|
|
|
|
} // namespace test
|
|
} // namespace mysql
|
|
} // namespace boost
|
|
|
|
#endif
|