24#ifndef SSLOPT_VARS_INCLUDED
25#define SSLOPT_VARS_INCLUDED
33#error This header is supposed to be used only in the client
44 "VERIFY_CA",
"VERIFY_IDENTITY",
NullS};
76 "WARNING: no verification of server certificate will be done. "
77 "Use --ssl-mode=VERIFY_CA or VERIFY_IDENTITY.\n");
103 char buff[4096], *bufptr = &buff[0];
107 fprintf(stderr,
"Error: Can't open the ssl session data file.\n");
110 long file_length =
sizeof(buff) - 1;
111 if (0 == fseek(fi, 0, SEEK_END)) {
112 file_length = ftell(fi);
114 file_length = std::min(file_length, 65536L);
116 file_length =
sizeof(buff) - 1;
117 fseek(fi, 0, SEEK_SET);
119 if (file_length > (
long)(
sizeof(buff) - 1)) {
120 bufptr = (
char *)
malloc(file_length + 1);
122 bufptr[file_length] = 0;
125 file_length =
sizeof(buff) - 1;
128 read = fread(bufptr, 1, file_length, fi);
130 fprintf(stderr,
"Error: Can't read the ssl session data file.\n");
132 if (bufptr != &buff[0])
free(bufptr);
135 assert(
read <= (
size_t)file_length);
141 if (bufptr != &buff[0])
free(bufptr);
152 "--ssl-session-data specified but the session was not reused.");
158#define SSL_SET_OPTIONS(mysql) set_client_ssl_options(mysql)
#define CR_SSL_FIPS_MODE_ERR
Definition: errmsg.h:126
static bool report_error(THD *thd, int error_code, Sql_condition::enum_severity_level level, Args... args)
Definition: error_handler.cc:291
#define malloc(A)
Definition: lexyy.cc:914
#define free(A)
Definition: lexyy.cc:915
Some integer typedefs for easier portability.
This file defines the client API to MySQL and also the ABI of the dynamically linked libmysqlclient.
unsigned int STDCALL mysql_errno(MYSQL *mysql)
Definition: client.cc:9174
@ MYSQL_OPT_SSL_CIPHER
Definition: mysql.h:194
@ MYSQL_OPT_TLS_SNI_SERVERNAME
Definition: mysql.h:217
@ MYSQL_OPT_SSL_CA
Definition: mysql.h:192
@ MYSQL_OPT_TLS_VERSION
Definition: mysql.h:205
@ MYSQL_OPT_SSL_KEY
Definition: mysql.h:190
@ MYSQL_OPT_SSL_FIPS_MODE
Definition: mysql.h:210
@ MYSQL_OPT_SSL_CRLPATH
Definition: mysql.h:196
@ MYSQL_OPT_SSL_CERT
Definition: mysql.h:191
@ MYSQL_OPT_SSL_SESSION_DATA
Definition: mysql.h:216
@ MYSQL_OPT_SSL_MODE
Definition: mysql.h:206
@ MYSQL_OPT_SSL_CAPATH
Definition: mysql.h:193
@ MYSQL_OPT_SSL_CRL
Definition: mysql.h:195
@ MYSQL_OPT_TLS_CIPHERSUITES
Definition: mysql.h:211
bool STDCALL mysql_get_ssl_session_reused(MYSQL *mysql)
Check if the current ssl session is reused.
Definition: client.cc:3622
int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option, const void *arg)
Definition: client.cc:8534
@ SSL_MODE_PREFERRED
Definition: mysql.h:274
@ SSL_MODE_VERIFY_CA
Definition: mysql.h:276
@ SSL_FIPS_MODE_OFF
Definition: mysql.h:281
const std::string FILE("FILE")
Definition: instrumented_condition_variable.h:32
stdx::expected< size_t, std::error_code > read(SyncReadStream &stream, const MutableBufferSequence &buffers)
Definition: buffer.h:835
#define NullS
Definition of the null string (a null pointer of type char *), used in some of our string handling co...
Definition: nulls.h:33
static char * opt_ssl_session_data
Definition: sslopt-vars.h:64
static int set_client_ssl_options(MYSQL *mysql)
Definition: sslopt-vars.h:68
static bool opt_ssl_session_data_continue_on_failed_reuse
Definition: sslopt-vars.h:65
static char * opt_ssl_cipher
Definition: sslopt-vars.h:56
const char * ssl_mode_names_lib[]
Definition: sslopt-vars.h:43
static char * opt_ssl_ca
Definition: sslopt-vars.h:53
static char * opt_tls_version
Definition: sslopt-vars.h:61
const char * SSL_SET_OPTIONS_ERROR
Definition: sslopt-vars.h:160
static char * opt_ssl_capath
Definition: sslopt-vars.h:54
static char * opt_ssl_crlpath
Definition: sslopt-vars.h:60
TYPELIB ssl_fips_mode_typelib
Definition: sslopt-vars.h:49
static char * opt_tls_ciphersuites
Definition: sslopt-vars.h:57
const char * ssl_fips_mode_names_lib[]
Definition: sslopt-vars.h:48
static char * opt_tls_sni_servername
Definition: sslopt-vars.h:66
static ulong opt_ssl_fips_mode
Definition: sslopt-vars.h:62
static uint opt_ssl_mode
Definition: sslopt-vars.h:52
static bool ssl_mode_set_explicitly
Definition: sslopt-vars.h:63
static char * opt_ssl_cert
Definition: sslopt-vars.h:55
TYPELIB ssl_mode_typelib
Definition: sslopt-vars.h:45
static char * opt_ssl_crl
Definition: sslopt-vars.h:59
static char * opt_ssl_key
Definition: sslopt-vars.h:58
static bool ssl_client_check_post_connect_ssl_setup(MYSQL *mysql, std::function< void(const char *)> report_error)
Definition: sslopt-vars.h:147
#define array_elements(A)
Definition: validate_password_imp.cc:48