mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Add new function mysql_get_ssl_cipher to libmysl and use it from client to avoid dependency on SSL libs from mysql client.
include/mysql.h: Add new function mysql_get_ssl_cipher sql-common/client.c: Add new function mysql_get_ssl_cipher, will return the cipher used for the current connection to the server.
This commit is contained in:
@@ -3212,10 +3212,9 @@ com_status(String *buffer __attribute__((unused)),
|
|||||||
mysql_free_result(result);
|
mysql_free_result(result);
|
||||||
}
|
}
|
||||||
#ifdef HAVE_OPENSSL
|
#ifdef HAVE_OPENSSL
|
||||||
if (mysql.net.vio && mysql.net.vio->ssl_arg &&
|
if (mysql_get_ssl_cipher(&mysql))
|
||||||
SSL_get_cipher((SSL*) mysql.net.vio->ssl_arg))
|
|
||||||
tee_fprintf(stdout, "SSL:\t\t\tCipher in use is %s\n",
|
tee_fprintf(stdout, "SSL:\t\t\tCipher in use is %s\n",
|
||||||
SSL_get_cipher((SSL*) mysql.net.vio->ssl_arg));
|
mysql_get_ssl_cipher(&mysql));
|
||||||
else
|
else
|
||||||
#endif /* HAVE_OPENSSL */
|
#endif /* HAVE_OPENSSL */
|
||||||
tee_puts("SSL:\t\t\tNot in use", stdout);
|
tee_puts("SSL:\t\t\tNot in use", stdout);
|
||||||
|
@@ -409,6 +409,7 @@ MYSQL * STDCALL mysql_init(MYSQL *mysql);
|
|||||||
my_bool STDCALL mysql_ssl_set(MYSQL *mysql, const char *key,
|
my_bool STDCALL mysql_ssl_set(MYSQL *mysql, const char *key,
|
||||||
const char *cert, const char *ca,
|
const char *cert, const char *ca,
|
||||||
const char *capath, const char *cipher);
|
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,
|
my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
|
||||||
const char *passwd, const char *db);
|
const char *passwd, const char *db);
|
||||||
MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
|
MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
|
||||||
|
@@ -1535,6 +1535,27 @@ mysql_ssl_free(MYSQL *mysql __attribute__((unused)))
|
|||||||
mysql->connector_fd = 0;
|
mysql->connector_fd = 0;
|
||||||
DBUG_VOID_RETURN;
|
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)
|
||||||
|
SSL_get_cipher_name((SSL*)mysql->net.vio->ssl_arg);
|
||||||
|
DBUG_RETURN(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* HAVE_OPENSSL */
|
#endif /* HAVE_OPENSSL */
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user