Commit c06972bf authored by unknown's avatar unknown
Browse files

Bug #1039: tmpdir and datadir not available via @@ system variable syntax

Bug #19606: ssl variables are not displayed in show variables
Bug #19616: log_queries_not_using_indexes  is not listed in show variables

  Make basedir, datadir, tmpdir, log_queries_not_using_indexes, ssl_ca,
  ssl_capath, ssl_cert, ssl_cipher, and ssl_key all available both from
  SHOW VARIABLES and as @@variables.

  As a side-effect of this change, log_queries_not_using_indexes can
  be changed at runtime (but only globally, not per-connection).


include/sslopt-longopts.h:
  Put options in alphabetical order
include/sslopt-vars.h:
  Allow define of SSL_VARS_NOT_STATIC to prevent variables from not being
  made static.
mysql-test/r/variables.result:
  Add new results
mysql-test/t/variables.test:
  Add new regression tests
sql/mysql_priv.h:
  Add extern for opt_log_queries_not_using_indexes
sql/mysqld.cc:
  Handle opt_log_queries_not_using_indexes as extern, and define
  SSL_VARS_NO_STATIC so they can be accessed outside of mysqld.cc
sql/set_var.cc:
  Handle basedir, datadir, tmpdir, log_queries_not_using_indexes, and
  various ssl settings so that they are accessible as server variables
  and listed in SHOW VARIABLES.
sql/set_var.h:
  Add new sys_var_constr_str_ptr class, for when we have a system variable
  that is only set via the command-line that is a pointer to a string.
parent 47302570
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -20,12 +20,6 @@
   "Enable SSL for connection (automatically enabled with other flags). Disable with --skip-ssl.",
 (gptr*) &opt_use_ssl, (gptr*) &opt_use_ssl, 0, GET_BOOL, NO_ARG, 0, 0, 0,
   0, 0, 0},
  {"ssl-key", OPT_SSL_KEY, "X509 key in PEM format (implies --ssl).",
   (gptr*) &opt_ssl_key, (gptr*) &opt_ssl_key, 0, GET_STR, REQUIRED_ARG,
   0, 0, 0, 0, 0, 0},
  {"ssl-cert", OPT_SSL_CERT, "X509 cert in PEM format (implies --ssl).",
   (gptr*) &opt_ssl_cert, (gptr*) &opt_ssl_cert, 0, GET_STR, REQUIRED_ARG,
   0, 0, 0, 0, 0, 0},
  {"ssl-ca", OPT_SSL_CA,
   "CA file in PEM format (check OpenSSL docs, implies --ssl).",
   (gptr*) &opt_ssl_ca, (gptr*) &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG,
@@ -34,8 +28,14 @@
   "CA directory (check OpenSSL docs, implies --ssl).",
   (gptr*) &opt_ssl_capath, (gptr*) &opt_ssl_capath, 0, GET_STR, REQUIRED_ARG,
   0, 0, 0, 0, 0, 0},
  {"ssl-cert", OPT_SSL_CERT, "X509 cert in PEM format (implies --ssl).",
   (gptr*) &opt_ssl_cert, (gptr*) &opt_ssl_cert, 0, GET_STR, REQUIRED_ARG,
   0, 0, 0, 0, 0, 0},
  {"ssl-cipher", OPT_SSL_CIPHER, "SSL cipher to use (implies --ssl).",
   (gptr*) &opt_ssl_cipher, (gptr*) &opt_ssl_cipher, 0, GET_STR, REQUIRED_ARG,
   0, 0, 0, 0, 0, 0},
  {"ssl-key", OPT_SSL_KEY, "X509 key in PEM format (implies --ssl).",
   (gptr*) &opt_ssl_key, (gptr*) &opt_ssl_key, 0, GET_STR, REQUIRED_ARG,
   0, 0, 0, 0, 0, 0},

#endif /* HAVE_OPENSSL */
+11 −6
Original line number Diff line number Diff line
@@ -15,10 +15,15 @@
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

#ifdef HAVE_OPENSSL
static my_bool opt_use_ssl  = 0;
static char *opt_ssl_key    = 0;
static char *opt_ssl_cert   = 0;
static char *opt_ssl_ca     = 0;
static char *opt_ssl_capath = 0;
static char *opt_ssl_cipher = 0;
#ifdef SSL_VARS_NOT_STATIC
#define SSL_STATIC
#else
#define SSL_STATIC static
#endif
SSL_STATIC my_bool opt_use_ssl  = 0;
SSL_STATIC char *opt_ssl_ca     = 0;
SSL_STATIC char *opt_ssl_capath = 0;
SSL_STATIC char *opt_ssl_cert   = 0;
SSL_STATIC char *opt_ssl_cipher = 0;
SSL_STATIC char *opt_ssl_key    = 0;
#endif
+28 −0
Original line number Diff line number Diff line
@@ -612,4 +612,32 @@ select @@version, @@version_comment, @@version_compile_machine,
@@version_compile_os;
@@version	@@version_comment	@@version_compile_machine	@@version_compile_os
#	#	#	#
select @@basedir, @@datadir, @@tmpdir;
@@basedir	@@datadir	@@tmpdir
#	#	#
show variables like 'basedir';
Variable_name	Value
basedir	#
show variables like 'datadir';
Variable_name	Value
datadir	#
show variables like 'tmpdir';
Variable_name	Value
tmpdir	#
select @@ssl_ca, @@ssl_capath, @@ssl_cert, @@ssl_cipher, @@ssl_key;
@@ssl_ca	@@ssl_capath	@@ssl_cert	@@ssl_cipher	@@ssl_key
#	#	#	#	#
show variables like 'ssl%';
Variable_name	Value
ssl_ca	#
ssl_capath	#
ssl_cert	#
ssl_cipher	#
ssl_key	#
select @@log_queries_not_using_indexes;
@@log_queries_not_using_indexes
0
show variables like 'log_queries_not_using_indexes';
Variable_name	Value
log_queries_not_using_indexes	OFF
End of 5.0 tests
+30 −0
Original line number Diff line number Diff line
@@ -508,4 +508,34 @@ select @@system_time_zone;
select @@version, @@version_comment, @@version_compile_machine,
       @@version_compile_os;

#
# Bug #1039: make tmpdir and datadir available as @@variables (also included
# basedir)
#
# Don't actually output, since it depends on the system
--replace_column 1 # 2 # 3 #
select @@basedir, @@datadir, @@tmpdir;
--replace_column 2 #
show variables like 'basedir';
--replace_column 2 #
show variables like 'datadir';
--replace_column 2 #
show variables like 'tmpdir';

#
# Bug #19606: make ssl settings available via SHOW VARIABLES and @@variables
# 
# Don't actually output, since it depends on the system
--replace_column 1 # 2 # 3 # 4 # 5 #
select @@ssl_ca, @@ssl_capath, @@ssl_cert, @@ssl_cipher, @@ssl_key;
--replace_column 2 #
show variables like 'ssl%';

#
# Bug #19616: make log_queries_not_using_indexes available in SHOW VARIABLES
# and as @@log_queries_not_using_indexes
#
select @@log_queries_not_using_indexes;
show variables like 'log_queries_not_using_indexes';

--echo End of 5.0 tests
+1 −0
Original line number Diff line number Diff line
@@ -1185,6 +1185,7 @@ extern my_bool locked_in_memory;
extern bool opt_using_transactions, mysqld_embedded;
extern bool using_update_log, opt_large_files, server_id_supplied;
extern bool opt_log, opt_update_log, opt_bin_log, opt_slow_log, opt_error_log;
extern my_bool opt_log_queries_not_using_indexes;
extern bool opt_disable_networking, opt_skip_show_db;
extern my_bool opt_character_set_client_handshake;
extern bool volatile abort_loop, shutdown_in_progress, grant_option;
Loading