diff options
-rw-r--r-- | client/mysql.cc | 5 | ||||
-rw-r--r-- | include/mysql.h | 1 | ||||
-rw-r--r-- | libmysql/libmysql.def | 1 | ||||
-rw-r--r-- | libmysqld/libmysqld.def | 1 | ||||
-rw-r--r-- | sql-common/client.c | 21 |
5 files changed, 26 insertions, 3 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index 8589bdb05ed..5b53570bf34 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -3235,10 +3235,9 @@ com_status(String *buffer __attribute__((unused)), mysql_free_result(result); } #ifdef HAVE_OPENSSL - if (mysql.net.vio && mysql.net.vio->ssl_arg && - SSL_get_cipher((SSL*) mysql.net.vio->ssl_arg)) + if ((status= mysql_get_ssl_cipher(&mysql))) tee_fprintf(stdout, "SSL:\t\t\tCipher in use is %s\n", - SSL_get_cipher((SSL*) mysql.net.vio->ssl_arg)); + status); else #endif /* HAVE_OPENSSL */ tee_puts("SSL:\t\t\tNot in use", stdout); diff --git a/include/mysql.h b/include/mysql.h index 925a4525378..6217ce631b5 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -409,6 +409,7 @@ MYSQL * STDCALL mysql_init(MYSQL *mysql); my_bool STDCALL mysql_ssl_set(MYSQL *mysql, const char *key, const char *cert, const char *ca, const char *capath, const char *cipher); +const char * STDCALL mysql_get_ssl_cipher(MYSQL *mysql); my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, const char *passwd, const char *db); MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host, diff --git a/libmysql/libmysql.def b/libmysql/libmysql.def index a469c67c466..cf45e20a697 100644 --- a/libmysql/libmysql.def +++ b/libmysql/libmysql.def @@ -65,6 +65,7 @@ EXPORTS mysql_get_proto_info mysql_get_server_info mysql_get_client_version + mysql_get_ssl_cipher mysql_info mysql_init mysql_insert_id diff --git a/libmysqld/libmysqld.def b/libmysqld/libmysqld.def index 93456901a7d..3895588e02c 100644 --- a/libmysqld/libmysqld.def +++ b/libmysqld/libmysqld.def @@ -58,6 +58,7 @@ EXPORTS mysql_get_host_info mysql_get_proto_info mysql_get_server_info + mysql_get_ssl_cipher mysql_info mysql_init mysql_insert_id diff --git a/sql-common/client.c b/sql-common/client.c index 84df31b7440..72745d72b12 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1535,6 +1535,27 @@ mysql_ssl_free(MYSQL *mysql __attribute__((unused))) mysql->connector_fd = 0; DBUG_VOID_RETURN; } + + +/* + Return the SSL cipher (if any) used for current + connection to the server. + + SYNOPSYS + mysql_get_ssl_cipher() + mysql pointer to the mysql connection + +*/ + +const char * STDCALL +mysql_get_ssl_cipher(MYSQL *mysql) +{ + DBUG_ENTER("mysql_get_ssl_cipher"); + if (mysql->net.vio && mysql->net.vio->ssl_arg) + DBUG_RETURN(SSL_get_cipher_name((SSL*)mysql->net.vio->ssl_arg)); + DBUG_RETURN(NULL); +} + #endif /* HAVE_OPENSSL */ |