diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/client_priv.h | 1 | ||||
-rw-r--r-- | client/mysql.cc | 4 | ||||
-rw-r--r-- | client/mysql_upgrade.c | 21 | ||||
-rw-r--r-- | client/mysqladmin.cc | 4 | ||||
-rw-r--r-- | client/mysqlcheck.c | 4 | ||||
-rw-r--r-- | client/mysqldump.c | 20 | ||||
-rw-r--r-- | client/mysqlimport.c | 4 | ||||
-rw-r--r-- | client/mysqlshow.c | 4 | ||||
-rw-r--r-- | client/mysqlslap.c | 4 | ||||
-rw-r--r-- | client/mysqltest.cc | 4 |
10 files changed, 60 insertions, 10 deletions
diff --git a/client/client_priv.h b/client/client_priv.h index 70a9d129433..e2afbad89a5 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -91,6 +91,7 @@ enum options_client OPT_REWRITE_DB, OPT_REPORT_PROGRESS, OPT_SKIP_ANNOTATE_ROWS_EVENTS, + OPT_SSL_CRL, OPT_SSL_CRLPATH, OPT_MAX_CLIENT_OPTION /* should be always the last */ }; diff --git a/client/mysql.cc b/client/mysql.cc index 1c81ec22372..a4cba59d235 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -4410,8 +4410,12 @@ sql_real_connect(char *host,char *database,char *user,char *password, mysql_options(&mysql,MYSQL_OPT_LOCAL_INFILE, (char*) &opt_local_infile); #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) if (opt_use_ssl) + { mysql_ssl_set(&mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, opt_ssl_capath, opt_ssl_cipher); + mysql_options(&mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl); + mysql_options(&mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); + } mysql_options(&mysql,MYSQL_OPT_SSL_VERIFY_SERVER_CERT, (char*)&opt_ssl_verify_server_cert); #endif diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 7aaad96e985..feaf23b15ba 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -806,14 +806,32 @@ static void print_line(char* line) static int run_sql_fix_privilege_tables(void) { int found_real_errors= 0; + const char **query_ptr; + DYNAMIC_STRING ds_script; DYNAMIC_STRING ds_result; DBUG_ENTER("run_sql_fix_privilege_tables"); + if (init_dynamic_string(&ds_script, "", 65536, 1024)) + die("Out of memory"); + if (init_dynamic_string(&ds_result, "", 512, 512)) die("Out of memory"); verbose("Phase 3/3: Running 'mysql_fix_privilege_tables'..."); - run_query(mysql_fix_privilege_tables, + /* + Individual queries can not be executed independently by invoking + a forked mysql client, because the script uses session variables + and prepared statements. + */ + for ( query_ptr= &mysql_fix_privilege_tables[0]; + *query_ptr != NULL; + query_ptr++ + ) + { + dynstr_append(&ds_script, *query_ptr); + } + + run_query(ds_script.str, &ds_result, /* Collect result */ TRUE); @@ -841,6 +859,7 @@ static int run_sql_fix_privilege_tables(void) } dynstr_free(&ds_result); + dynstr_free(&ds_script); DBUG_RETURN(found_real_errors); } diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index 61045518a17..daa1115514e 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -345,8 +345,12 @@ int main(int argc,char *argv[]) } #ifdef HAVE_OPENSSL if (opt_use_ssl) + { mysql_ssl_set(&mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, opt_ssl_capath, opt_ssl_cipher); + mysql_options(&mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl); + mysql_options(&mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); + } mysql_options(&mysql,MYSQL_OPT_SSL_VERIFY_SERVER_CERT, (char*)&opt_ssl_verify_server_cert); #endif diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 635b7e0d93f..e96f855719e 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -932,8 +932,12 @@ static int dbConnect(char *host, char *user, char *passwd) mysql_options(&mysql_connection, MYSQL_OPT_COMPRESS, NullS); #ifdef HAVE_OPENSSL if (opt_use_ssl) + { mysql_ssl_set(&mysql_connection, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, opt_ssl_capath, opt_ssl_cipher); + mysql_options(&mysql_connection, MYSQL_OPT_SSL_CRL, opt_ssl_crl); + mysql_options(&mysql_connection, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); + } #endif if (opt_protocol) mysql_options(&mysql_connection,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); diff --git a/client/mysqldump.c b/client/mysqldump.c index 13cc1d3c5f7..b810973f9c2 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -233,8 +233,8 @@ static struct my_option my_long_options[] = &opt_slave_apply, &opt_slave_apply, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"character-sets-dir", OPT_CHARSETS_DIR, - "Directory for character set files.", (char**) &charsets_dir, - (char**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + "Directory for character set files.", &charsets_dir, + &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"comments", 'i', "Write additional information.", &opt_comments, &opt_comments, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, @@ -271,8 +271,8 @@ static struct my_option my_long_options[] = {"debug", '#', "This is a non-debug version. Catch this and exit.", 0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0}, #else - {"debug", '#', "Output debug log.", (char**) &default_dbug_option, - (char**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"debug", '#', "Output debug log.", &default_dbug_option, + &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", &debug_check_flag, &debug_check_flag, 0, @@ -872,7 +872,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), &err_ptr, &err_len); if (err_len) { - strmake(buff, err_ptr, min(sizeof(buff) - 1, err_len)); + strmake(buff, err_ptr, MY_MIN(sizeof(buff) - 1, err_len)); fprintf(stderr, "Invalid mode to --compatible: %s\n", buff); exit(1); } @@ -1528,8 +1528,12 @@ static int connect_to_db(char *host, char *user,char *passwd) mysql_options(&mysql_connection,MYSQL_OPT_COMPRESS,NullS); #ifdef HAVE_OPENSSL if (opt_use_ssl) + { mysql_ssl_set(&mysql_connection, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, opt_ssl_capath, opt_ssl_cipher); + mysql_options(&mysql_connection, MYSQL_OPT_SSL_CRL, opt_ssl_crl); + mysql_options(&mysql_connection, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); + } mysql_options(&mysql_connection,MYSQL_OPT_SSL_VERIFY_SERVER_CERT, (char*)&opt_ssl_verify_server_cert); #endif @@ -4794,11 +4798,9 @@ static int add_slave_statements(void) static int do_show_slave_status(MYSQL *mysql_con) { - MYSQL_RES *slave= 0; + MYSQL_RES *UNINIT_VAR(slave); const char *comment_prefix= (opt_slave_data == MYSQL_OPT_SLAVE_DATA_COMMENTED_SQL) ? "-- " : ""; - LINT_INIT(slave); - if (mysql_query_with_error_report(mysql_con, &slave, "SHOW SLAVE STATUS")) { if (!ignore_errors) @@ -4991,7 +4993,7 @@ static ulong find_set(TYPELIB *lib, const char *x, uint length, for (; pos != end && *pos != ','; pos++) ; var_len= (uint) (pos - start); - strmake(buff, start, min(sizeof(buff) - 1, var_len)); + strmake(buff, start, MY_MIN(sizeof(buff) - 1, var_len)); find= find_type(buff, lib, FIND_TYPE_BASIC); if (!find) { diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 77d0cd0a7d3..15be9341ca3 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -433,8 +433,12 @@ static MYSQL *db_connect(char *host, char *database, (char*) &opt_local_file); #ifdef HAVE_OPENSSL if (opt_use_ssl) + { mysql_ssl_set(mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, opt_ssl_capath, opt_ssl_cipher); + mysql_options(mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl); + mysql_options(mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); + } mysql_options(mysql,MYSQL_OPT_SSL_VERIFY_SERVER_CERT, (char*)&opt_ssl_verify_server_cert); #endif diff --git a/client/mysqlshow.c b/client/mysqlshow.c index 323c4282ff4..5abeed107c2 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -118,8 +118,12 @@ int main(int argc, char **argv) mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS); #ifdef HAVE_OPENSSL if (opt_use_ssl) + { mysql_ssl_set(&mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, opt_ssl_capath, opt_ssl_cipher); + mysql_options(&mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl); + mysql_options(&mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); + } mysql_options(&mysql,MYSQL_OPT_SSL_VERIFY_SERVER_CERT, (char*)&opt_ssl_verify_server_cert); #endif diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 8e70a2609c3..afafe1de647 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -299,8 +299,12 @@ void set_mysql_connect_options(MYSQL *mysql) mysql_options(mysql,MYSQL_OPT_COMPRESS,NullS); #ifdef HAVE_OPENSSL if (opt_use_ssl) + { mysql_ssl_set(mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, opt_ssl_capath, opt_ssl_cipher); + mysql_options(mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl); + mysql_options(mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); + } #endif if (opt_protocol) mysql_options(mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); diff --git a/client/mysqltest.cc b/client/mysqltest.cc index bf597ab57a5..1fb898bd129 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -5970,6 +5970,8 @@ void do_connect(struct st_command *command) #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) mysql_ssl_set(con_slot->mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, opt_ssl_capath, opt_ssl_cipher); + mysql_options(con_slot->mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl); + mysql_options(con_slot->mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); #if MYSQL_VERSION_ID >= 50000 /* Turn on ssl_verify_server_cert only if host is "localhost" */ opt_ssl_verify_server_cert= !strcmp(ds_host.str, "localhost"); @@ -9015,6 +9017,8 @@ int main(int argc, char **argv) { mysql_ssl_set(con->mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, opt_ssl_capath, opt_ssl_cipher); + mysql_options(con->mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl); + mysql_options(con->mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); #if MYSQL_VERSION_ID >= 50000 /* Turn on ssl_verify_server_cert only if host is "localhost" */ opt_ssl_verify_server_cert= opt_host && !strcmp(opt_host, "localhost"); |