diff options
author | Sergei Golubchik <serg@mariadb.org> | 2015-06-11 20:20:35 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2015-06-11 20:20:35 +0200 |
commit | 810cf362eae28d4a096e0acea7efa67dd32aa05b (patch) | |
tree | 4f7b2f858e8a57022e790bcac6d88b5e3451ee0f /sql-common | |
parent | a99efc00a68fe2406343e63b67fc4ea58bed345a (diff) | |
parent | d199a0ffb0aac86881ea2db7dd78bc07b438dc67 (diff) | |
download | mariadb-git-810cf362eae28d4a096e0acea7efa67dd32aa05b.tar.gz |
Merge branch '5.5' into 10.0
Diffstat (limited to 'sql-common')
-rw-r--r-- | sql-common/client.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/sql-common/client.c b/sql-common/client.c index c180986cbe9..acfdd8531e2 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1848,6 +1848,7 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) , mysql_options(mysql, MYSQL_OPT_SSL_CAPATH, capath) | mysql_options(mysql, MYSQL_OPT_SSL_CIPHER, cipher) ? 1 : 0); + mysql->options.use_ssl= TRUE; #endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */ DBUG_RETURN(result); } @@ -2652,16 +2653,10 @@ static int send_client_reply_packet(MCPVIO_EXT *mpvio, mysql->client_flag|= CLIENT_MULTI_RESULTS; #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) - if (mysql->options.ssl_key || mysql->options.ssl_cert || - mysql->options.ssl_ca || mysql->options.ssl_capath || - mysql->options.ssl_cipher || - (mysql->options.extension && - (mysql->options.extension->ssl_crl || - mysql->options.extension->ssl_crlpath))) - mysql->options.use_ssl= 1; if (mysql->options.use_ssl) mysql->client_flag|= CLIENT_SSL; #endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY*/ + if (mpvio->db) mysql->client_flag|= CLIENT_CONNECT_WITH_DB; @@ -2690,6 +2685,23 @@ static int send_client_reply_packet(MCPVIO_EXT *mpvio, end= buff+5; } #ifdef HAVE_OPENSSL + + /* + If client uses ssl and client also has to verify the server + certificate, a ssl connection is required. + If the server does not support ssl, we abort the connection. + */ + if (mysql->options.use_ssl && + (mysql->client_flag & CLIENT_SSL_VERIFY_SERVER_CERT) && + !(mysql->server_capabilities & CLIENT_SSL)) + { + set_mysql_extended_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate, + ER(CR_SSL_CONNECTION_ERROR), + "SSL is required, but the server does not " + "support it"); + goto error; + } + if (mysql->client_flag & CLIENT_SSL) { /* Do the SSL layering. */ |