MySQL 8.3.0
Source Code Documentation
classic_greeting_forwarder.cc File Reference
#include "classic_greeting_forwarder.h"
#include <cctype>
#include <iostream>
#include <memory>
#include <optional>
#include <random>
#include <sstream>
#include <system_error>
#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/ssl.h>
#include "await_client_or_server.h"
#include "classic_auth.h"
#include "classic_auth_caching_sha2.h"
#include "classic_auth_cleartext.h"
#include "classic_auth_forwarder.h"
#include "classic_auth_native.h"
#include "classic_auth_sha256_password.h"
#include "classic_change_user_forwarder.h"
#include "classic_connect.h"
#include "classic_connection_base.h"
#include "classic_frame.h"
#include "classic_lazy_connect.h"
#include "classic_query_sender.h"
#include "harness_assert.h"
#include "hexify.h"
#include "mysql/harness/logging/logger.h"
#include "mysql/harness/logging/logging.h"
#include "mysql/harness/net_ts/socket.h"
#include "mysql/harness/stdx/expected.h"
#include "mysql/harness/tls_error.h"
#include "mysqld_error.h"
#include "mysqlrouter/classic_protocol_constants.h"
#include "mysqlrouter/classic_protocol_message.h"
#include "mysqlrouter/connection_base.h"
#include "openssl_msg.h"
#include "openssl_version.h"
#include "processor.h"
#include "router_require.h"
#include "sql/server_component/mysql_command_services_imp.h"
#include "tracer.h"

Classes

class  SendProcessor< toServer >
 

Functions

static std::vector< std::pair< std::string, std::string > > client_ssl_connection_attributes (const SSL *ssl)
 router specific connection attributes. More...
 
template<class T >
std::vector< T > vector_splice (std::vector< T > v, const std::vector< T > &other)
 splice two vectors together. More...
 
static std::optional< std::string > scramble_them_all (std::string_view auth_method, std::string_view nonce, std::string_view pwd)
 
static void ssl_msg_cb (int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)
 
static void adjust_supported_capabilities (SslMode source_ssl_mode, SslMode dest_ssl_mode, classic_protocol::capabilities::value_type &caps)
 
static stdx::expected< size_t, std::error_code > send_ssl_connection_error_msg (Channel *dst_channel, ClassicProtocolState *dst_protocol, std::string_view msg)
 
static auto strip_trailing_null (std::string_view s)
 remove trailing \0 in a string_view. More...
 
static bool server_ssl_mode_is_satisfied (SslMode server_ssl_mode, classic_protocol::capabilities::value_type server_capabilities)
 
static stdx::expected< size_t, std::error_code > classic_proto_append_attribute (std::string &attrs_buf, const std::string &key, const std::string &value)
 
static stdx::expected< void, std::error_code > classic_proto_verify_connection_attributes (const std::string &attrs)
 verify connection attributes are sane. More...
 
static stdx::expected< std::string, std::error_code > classic_proto_decode_and_add_connection_attributes (std::string attrs, const std::vector< std::pair< std::string, std::string > > &extra_attributes)
 merge connection attributes. More...
 
static stdx::expected< TlsClientContext *, std::error_code > get_dest_ssl_ctx (MySQLRoutingContext &ctx, const std::string &id)
 
static TlsErrc forward_tls (Channel *src_channel, Channel *dst_channel)
 

Function Documentation

◆ adjust_supported_capabilities()

static void adjust_supported_capabilities ( SslMode  source_ssl_mode,
SslMode  dest_ssl_mode,
classic_protocol::capabilities::value_type caps 
)
static

◆ classic_proto_append_attribute()

static stdx::expected< size_t, std::error_code > classic_proto_append_attribute ( std::string &  attrs_buf,
const std::string &  key,
const std::string &  value 
)
static

◆ classic_proto_decode_and_add_connection_attributes()

static stdx::expected< std::string, std::error_code > classic_proto_decode_and_add_connection_attributes ( std::string  attrs,
const std::vector< std::pair< std::string, std::string > > &  extra_attributes 
)
static

merge connection attributes.

  • verifies the connection attributes
  • appends new attributes.
  • sets attributes back to the client-greeting-msg
Returns
bytes appended on success, std::error_code on error.

◆ classic_proto_verify_connection_attributes()

static stdx::expected< void, std::error_code > classic_proto_verify_connection_attributes ( const std::string &  attrs)
static

verify connection attributes are sane.

connection attributes are a key-value-key-value-...

  • decodes as var-string
  • each key must have a value

◆ client_ssl_connection_attributes()

static std::vector< std::pair< std::string, std::string > > client_ssl_connection_attributes ( const SSL *  ssl)
static

router specific connection attributes.

Parameters
[in]sslpointer to a SSL struct of the client connection. May be nullptr.

◆ forward_tls()

static TlsErrc forward_tls ( Channel src_channel,
Channel dst_channel 
)
static

◆ get_dest_ssl_ctx()

static stdx::expected< TlsClientContext *, std::error_code > get_dest_ssl_ctx ( MySQLRoutingContext ctx,
const std::string &  id 
)
static

◆ scramble_them_all()

static std::optional< std::string > scramble_them_all ( std::string_view  auth_method,
std::string_view  nonce,
std::string_view  pwd 
)
static

◆ send_ssl_connection_error_msg()

static stdx::expected< size_t, std::error_code > send_ssl_connection_error_msg ( Channel dst_channel,
ClassicProtocolState dst_protocol,
std::string_view  msg 
)
static

◆ server_ssl_mode_is_satisfied()

static bool server_ssl_mode_is_satisfied ( SslMode  server_ssl_mode,
classic_protocol::capabilities::value_type  server_capabilities 
)
static

◆ ssl_msg_cb()

static void ssl_msg_cb ( int  write_p,
int  version,
int  content_type,
const void *  buf,
size_t  len,
SSL *  ssl,
void *  arg 
)
static

◆ strip_trailing_null()

static auto strip_trailing_null ( std::string_view  s)
static

remove trailing \0 in a string_view.

returns the original string-view, if there is no trailing NUL-char.

◆ vector_splice()

template<class T >
std::vector< T > vector_splice ( std::vector< T >  v,
const std::vector< T > &  other 
)

splice two vectors together.

appends all elements of other to the vector v.