MySQL  8.0.16
Source Code Documentation
mysql_ssl_rsa_setup.cc File Reference
#include "my_config.h"
#include <mysql_version.h>
#include <stdint.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include "client/logger.h"
#include "client/path.h"
#include "my_alloc.h"
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_default.h"
#include "my_dir.h"
#include "my_getopt.h"
#include "my_inttypes.h"
#include "my_io.h"
#include "my_macros.h"
#include "my_sys.h"
#include "mysql/service_mysql_alloc.h"
#include "print_version.h"
#include "welcome_copyright_notice.h"

Classes

class  RSA_priv
 
class  RSA_pub
 
class  X509_key
 
class  X509v3_ext_writer
 
class  X509_cert
 

Macros

#define MAX_PATH_LEN   (FN_REFLEN - strlen(FN_DIRSEP) - cert_files[SERVER_CERT].length() - 1)
 
#define MAX_SUFFIX_LEN   17
 

Typedefs

typedef string Sql_string_t
 

Enumerations

enum  certs {
  CA_CERT = 0, CA_KEY, CA_REQ, SERVER_CERT,
  SERVER_KEY, SERVER_REQ, CLIENT_CERT, CLIENT_KEY,
  CLIENT_REQ, PRIVATE_KEY, PUBLIC_KEY, OPENSSL_RND
}
 
enum  extfiles { CAV3_EXT = 0, CERTV3_EXT }
 

Functions

static Sql_string_t create_string (const char *ptr)
 The string class will break if constructed with a NULL pointer. More...
 
static int execute_command (const Sql_string_t &command, const Sql_string_t &error_message)
 
static int set_file_pair_permission (const Sql_string_t &priv, const Sql_string_t &pub)
 
static bool file_exists (const Sql_string_t &filename)
 
static int remove_file (const Sql_string_t &filename, bool report_error=true)
 
static void free_resources ()
 
static void usage (void)
 
static bool my_arguments_get_one_option (int optid, const struct my_option *, char *)
 
static bool is_not_alnum_underscore (char c)
 
static bool check_suffix ()
 
int main (int argc, char *argv[])
 

Variables

Sql_string_t cert_files []
 
Sql_string_t ext_files []
 
Log info (cout, "NOTE")
 
Log error (cerr, "ERROR")
 
char ** defaults_argv = 0
 
static char * opt_datadir = 0
 
static char default_data_dir [] = MYSQL_DATADIR
 
static char * opt_suffix = 0
 
static char default_suffix [] = MYSQL_SERVER_VERSION
 
Path dir_string
 
Sql_string_t suffix_string
 
bool opt_verbose
 
static const char * load_default_groups [] = {"mysql_ssl_rsa_setup", "mysqld", 0}
 
static struct my_option my_options []
 

Macro Definition Documentation

◆ MAX_PATH_LEN

#define MAX_PATH_LEN   (FN_REFLEN - strlen(FN_DIRSEP) - cert_files[SERVER_CERT].length() - 1)

◆ MAX_SUFFIX_LEN

#define MAX_SUFFIX_LEN   17

Typedef Documentation

◆ Sql_string_t

typedef string Sql_string_t

Enumeration Type Documentation

◆ certs

enum certs
Enumerator
CA_CERT 
CA_KEY 
CA_REQ 
SERVER_CERT 
SERVER_KEY 
SERVER_REQ 
CLIENT_CERT 
CLIENT_KEY 
CLIENT_REQ 
PRIVATE_KEY 
PUBLIC_KEY 
OPENSSL_RND 

◆ extfiles

enum extfiles
Enumerator
CAV3_EXT 
CERTV3_EXT 

Function Documentation

◆ check_suffix()

static bool check_suffix ( )
static

◆ create_string()

static Sql_string_t create_string ( const char *  ptr)
static

The string class will break if constructed with a NULL pointer.

This wrapper provides a systematic protection when importing char pointers.

◆ execute_command()

static int execute_command ( const Sql_string_t command,
const Sql_string_t error_message 
)
static

◆ file_exists()

static bool file_exists ( const Sql_string_t filename)
static

◆ free_resources()

static void free_resources ( )
static

◆ is_not_alnum_underscore()

static bool is_not_alnum_underscore ( char  c)
inlinestatic

◆ main()

int main ( int  argc,
char *  argv[] 
)

◆ my_arguments_get_one_option()

static bool my_arguments_get_one_option ( int  optid,
const struct my_option ,
char *   
)
static

◆ remove_file()

static int remove_file ( const Sql_string_t filename,
bool  report_error = true 
)
static

◆ set_file_pair_permission()

static int set_file_pair_permission ( const Sql_string_t priv,
const Sql_string_t pub 
)
static

◆ usage()

static void usage ( void  )
static

Variable Documentation

◆ cert_files

Sql_string_t cert_files[]
Initial value:
= {
create_string("ca.pem"), create_string("ca-key.pem"),
create_string("ca-req.pem"), create_string("server-cert.pem"),
create_string("server-key.pem"), create_string("server-req.pem"),
create_string("client-cert.pem"), create_string("client-key.pem"),
create_string("client-req.pem"), create_string("private_key.pem"),
create_string("public_key.pem"), create_string(".rnd")}
static Sql_string_t create_string(const char *ptr)
The string class will break if constructed with a NULL pointer.
Definition: mysql_ssl_rsa_setup.cc:153

◆ default_data_dir

char default_data_dir[] = MYSQL_DATADIR
static

◆ default_suffix

char default_suffix[] = MYSQL_SERVER_VERSION
static

◆ defaults_argv

char** defaults_argv = 0

◆ dir_string

Path dir_string

◆ error

Log error(cerr, "ERROR")

◆ ext_files

Sql_string_t ext_files[]
Initial value:
= {create_string("cav3.ext"),
create_string("certv3.ext")}
static Sql_string_t create_string(const char *ptr)
The string class will break if constructed with a NULL pointer.
Definition: mysql_ssl_rsa_setup.cc:153

◆ info

Log info(cout, "NOTE")

◆ load_default_groups

const char* load_default_groups[] = {"mysql_ssl_rsa_setup", "mysqld", 0}
static

◆ my_options

struct my_option my_options[]
static
Initial value:
= {
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
0, 0, 0, 0, 0},
{"verbose", 'v', "Be more verbose when running program", &opt_verbose, 0, 0,
GET_BOOL, NO_ARG, false, 0, 0, 0, 0, 0},
{"version", 'V', "Print program version and exit", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"datadir", 'd', "Directory to store generated files.", &opt_datadir,
0, 0, 0, 0, 0},
{"suffix", 's', "Suffix to be added in certificate subject line",
(longlong)&default_suffix, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}}
static char default_suffix[]
Definition: mysql_ssl_rsa_setup.cc:115
#define GET_STR_ALLOC
Definition: my_getopt.h:50
#define GET_NO_ARG
Definition: my_getopt.h:41
static char * opt_suffix
Definition: mysql_ssl_rsa_setup.cc:114
bool opt_verbose
Definition: mysql_ssl_rsa_setup.cc:122
long long int longlong
Definition: my_inttypes.h:70
Definition: my_getopt.h:78
Definition: my_getopt.h:78
static char * opt_datadir
Definition: mysql_ssl_rsa_setup.cc:112
static char default_data_dir[]
Definition: mysql_ssl_rsa_setup.cc:113
#define GET_BOOL
Definition: my_getopt.h:42

◆ opt_datadir

char* opt_datadir = 0
static

◆ opt_suffix

char* opt_suffix = 0
static

◆ opt_verbose

bool opt_verbose

◆ suffix_string

Sql_string_t suffix_string