diff options
author | unknown <konstantin@oak.local> | 2003-11-28 13:11:44 +0300 |
---|---|---|
committer | unknown <konstantin@oak.local> | 2003-11-28 13:11:44 +0300 |
commit | 506572b69e4e5f226248eaab923c2b77d794ded7 (patch) | |
tree | f8c0751dc8b9a854f23875f0188a056c63632876 /client | |
parent | 94387d4be3a066bcc5a8b9a495dd5b1ef4e75513 (diff) | |
download | mariadb-git-506572b69e4e5f226248eaab923c2b77d794ded7.tar.gz |
Second part of WL #519:
Client option secure-auth deployed on all possible layers:
- mysql client command-line and config file option
- mysql_options option MYSQL_SECURE_AUTH
- mysql_real_connect will automatically take into account that option if
mysql->options.my_cnf_file/my_cnf_group is set
client/client_priv.h:
added OPT_SECURE_AUTH to enum of all my_read_default_options options.
client/mysql.cc:
added support for mysql command-line option --secure-auth
include/errmsg.h:
added return code for option --secure-auth
include/mysql.h:
added MYSQL_SECURE_AUTH to enum of all mysql_options options.
added secure_auth flag to MYSQL handle
libmysql/errmsg.c:
Error messages for option --secure-auth
sql-common/client.c:
added check for secure-auth in mysql_real_connect:
if password is provided, and secure-auth is on, then client will
refuse connecting to pre-4.1.1 server
Diffstat (limited to 'client')
-rw-r--r-- | client/client_priv.h | 2 | ||||
-rw-r--r-- | client/mysql.cc | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/client/client_priv.h b/client/client_priv.h index d655619516d..f6d766b7ef9 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -40,4 +40,4 @@ enum options_client { OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET, OPT_DELETE_MASTER_LOGS, OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION,OPT_MYSQL_PROTOCOL, OPT_SHARED_MEMORY_BASE_NAME, OPT_FRM, OPT_SKIP_OPTIMIZATION, - OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER }; + OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH }; diff --git a/client/mysql.cc b/client/mysql.cc index 059a1ad36f5..9062b58d09b 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -134,7 +134,7 @@ static my_bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0, vertical=0, line_numbers=1, column_names=1,opt_html=0, opt_xml=0,opt_nopager=1, opt_outfile=0, named_cmds= 0, tty_password= 0, opt_nobeep=0, opt_reconnect=1, - default_charset_used= 0; + default_charset_used= 0, opt_secure_auth= 0; static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0; static my_string opt_mysql_unix_port=0; static int connect_flag=CLIENT_INTERACTIVE; @@ -623,6 +623,9 @@ static struct my_option my_long_options[] = {"max_join_size", OPT_MAX_JOIN_SIZE, "", (gptr*) &max_join_size, (gptr*) &max_join_size, 0, GET_ULONG, REQUIRED_ARG, 1000000L, 1, ~0L, 0, 1, 0}, + {"secure-auth", OPT_SECURE_AUTH, "Refuse client connecting to server if it" + " uses old (pre-4.1.1) protocol", (gptr*) &opt_secure_auth, + (gptr*) &opt_secure_auth, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; @@ -2553,6 +2556,8 @@ sql_real_connect(char *host,char *database,char *user,char *password, } if (opt_compress) mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS); + if (opt_secure_auth) + mysql_options(&mysql, MYSQL_SECURE_AUTH, (char *) &opt_secure_auth); if (using_opt_local_infile) mysql_options(&mysql,MYSQL_OPT_LOCAL_INFILE, (char*) &opt_local_infile); #ifdef HAVE_OPENSSL |