7a5573f
Some test items assume the default SSL cipher is DHE-RSA-AES256-SHA, 
7a5573f
which is no longer the case as of openssl 1.0.1.
7a5573f
This patch enhances connect command by an option to specify a cipher 
7a5573f
and tests are adjusted to specify the expected cipher explicitly.
7a5573f
Upstream bug report: http://bugs.mysql.com/bug.php?id=64461
7a5573f
7a5573f
diff -up mysql-5.5.28/client/mysqltest.cc.p18 mysql-5.5.28/client/mysqltest.cc
7a5573f
--- mysql-5.5.28/client/mysqltest.cc.p18	2012-08-29 10:50:46.000000000 +0200
7a5573f
+++ mysql-5.5.28/client/mysqltest.cc	2012-12-06 14:25:46.370001422 +0100
7a5573f
@@ -5458,6 +5458,7 @@ void do_connect(struct st_command *comma
7a5573f
   my_bool con_ssl= 0, con_compress= 0;
7a5573f
   my_bool con_pipe= 0, con_shm= 0, con_cleartext_enable= 0;
7a5573f
   struct st_connection* con_slot;
7a5573f
+  char *con_cipher=NULL;
7a5573f
 
7a5573f
   static DYNAMIC_STRING ds_connection_name;
7a5573f
   static DYNAMIC_STRING ds_host;
7a5573f
@@ -5548,6 +5549,8 @@ void do_connect(struct st_command *comma
7a5573f
       con_shm= 1;
7a5573f
     else if (!strncmp(con_options, "CLEARTEXT", 9))
7a5573f
       con_cleartext_enable= 1;
7a5573f
+    else if (!strncmp(con_options, "CIPHER:", 7))
7a5573f
+      con_cipher = con_options + 7;
7a5573f
     else
7a5573f
       die("Illegal option to connect: %.*s", 
7a5573f
           (int) (end - con_options), con_options);
7a5573f
@@ -5595,8 +5598,11 @@ void do_connect(struct st_command *comma
7a5573f
   if (con_ssl)
7a5573f
   {
7a5573f
 #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
7a5573f
+  /* default cipher */
7a5573f
+    if (con_cipher == NULL && opt_ssl_cipher != NULL)
7a5573f
+      con_cipher = opt_ssl_cipher;
7a5573f
     mysql_ssl_set(&con_slot->mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
7a5573f
-		  opt_ssl_capath, opt_ssl_cipher);
7a5573f
+		  opt_ssl_capath, con_cipher);
7a5573f
 #if MYSQL_VERSION_ID >= 50000
7a5573f
     /* Turn on ssl_verify_server_cert only if host is "localhost" */
7a5573f
     opt_ssl_verify_server_cert= !strcmp(ds_host.str, "localhost");
7a5573f
diff -up mysql-5.5.28/mysql-test/t/openssl_1.test.p18 mysql-5.5.28/mysql-test/t/openssl_1.test
7a5573f
--- mysql-5.5.28/mysql-test/t/openssl_1.test.p18	2012-08-29 10:50:47.000000000 +0200
7a5573f
+++ mysql-5.5.28/mysql-test/t/openssl_1.test	2012-12-06 14:25:46.371001424 +0100
7a5573f
@@ -20,13 +20,13 @@ grant select on test.* to ssl_user4@loca
7a5573f
 grant select on test.* to ssl_user5@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "xxx";
7a5573f
 flush privileges;
7a5573f
 
7a5573f
-connect (con1,localhost,ssl_user1,,,,,SSL);
7a5573f
-connect (con2,localhost,ssl_user2,,,,,SSL);
7a5573f
-connect (con3,localhost,ssl_user3,,,,,SSL);
7a5573f
-connect (con4,localhost,ssl_user4,,,,,SSL);
7a5573f
+connect (con1,localhost,ssl_user1,,,,,SSL CIPHER:DHE-RSA-AES256-SHA);
7a5573f
+connect (con2,localhost,ssl_user2,,,,,SSL CIPHER:DHE-RSA-AES256-SHA);
7a5573f
+connect (con3,localhost,ssl_user3,,,,,SSL CIPHER:DHE-RSA-AES256-SHA);
7a5573f
+connect (con4,localhost,ssl_user4,,,,,SSL CIPHER:DHE-RSA-AES256-SHA);
7a5573f
 --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
7a5573f
 --error ER_ACCESS_DENIED_ERROR
7a5573f
-connect (con5,localhost,ssl_user5,,,,,SSL);
7a5573f
+connect (con5,localhost,ssl_user5,,,,,SSL CIPHER:DHE-RSA-AES256-SHA);
7a5573f
 
7a5573f
 connection con1;
7a5573f
 # Check ssl turned on
7a5573f
@@ -125,7 +125,7 @@ drop table t1;
7a5573f
 # verification of servers certificate by setting both ca certificate
7a5573f
 # and ca path to NULL
7a5573f
 #
7a5573f
---exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SHOW STATUS LIKE 'ssl_Cipher'" 2>&1
7a5573f
+--exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem --ssl-cipher=DHE-RSA-AES256-SHA -e "SHOW STATUS LIKE 'ssl_Cipher'" 2>&1
7a5573f
 --echo End of 5.0 tests
7a5573f
 
7a5573f
 #
7a5573f
@@ -250,7 +250,7 @@ select 'is still running; no cipher requ
7a5573f
 
7a5573f
 GRANT SELECT ON test.* TO bug42158@localhost REQUIRE X509;
7a5573f
 FLUSH PRIVILEGES;
7a5573f
-connect(con1,localhost,bug42158,,,,,SSL);
7a5573f
+connect(con1,localhost,bug42158,,,,,SSL CIPHER:DHE-RSA-AES256-SHA);
7a5573f
 SHOW STATUS LIKE 'Ssl_cipher';
7a5573f
 disconnect con1;
7a5573f
 connection default;
7a5573f
diff -up mysql-5.5.28/mysql-test/t/ssl_8k_key.test.p18 mysql-5.5.28/mysql-test/t/ssl_8k_key.test
7a5573f
--- mysql-5.5.28/mysql-test/t/ssl_8k_key.test.p18	2012-08-29 10:50:47.000000000 +0200
7a5573f
+++ mysql-5.5.28/mysql-test/t/ssl_8k_key.test	2012-12-06 14:25:46.371001424 +0100
7a5573f
@@ -2,7 +2,7 @@
7a5573f
 #
7a5573f
 # Bug#29784 YaSSL assertion failure when reading 8k key.
7a5573f
 #
7a5573f
---exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SHOW STATUS LIKE 'ssl_Cipher'" 2>&1
7a5573f
+--exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem --ssl-cipher=DHE-RSA-AES256-SHA -e "SHOW STATUS LIKE 'ssl_Cipher'" 2>&1
7a5573f
 
7a5573f
 ##  This test file is for testing encrypted communication only, not other
7a5573f
 ##  encryption routines that the SSL library happens to provide!
7a5573f
diff -up mysql-5.5.28/mysql-test/t/ssl_compress.test.p18 mysql-5.5.28/mysql-test/t/ssl_compress.test
7a5573f
--- mysql-5.5.28/mysql-test/t/ssl_compress.test.p18	2012-08-29 10:50:47.000000000 +0200
7a5573f
+++ mysql-5.5.28/mysql-test/t/ssl_compress.test	2012-12-06 14:25:46.371001424 +0100
7a5573f
@@ -7,7 +7,7 @@
7a5573f
 # Save the initial number of concurrent sessions
7a5573f
 --source include/count_sessions.inc
7a5573f
 
7a5573f
-connect (ssl_compress_con,localhost,root,,,,,SSL COMPRESS);
7a5573f
+connect (ssl_compress_con,localhost,root,,,,,SSL COMPRESS CIPHER:DHE-RSA-AES256-SHA);
7a5573f
 
7a5573f
 # Check ssl turned on
7a5573f
 SHOW STATUS LIKE 'Ssl_cipher';
7a5573f
diff -up mysql-5.5.28/mysql-test/t/ssl.test.p18 mysql-5.5.28/mysql-test/t/ssl.test
7a5573f
--- mysql-5.5.28/mysql-test/t/ssl.test.p18	2012-08-29 10:50:47.000000000 +0200
7a5573f
+++ mysql-5.5.28/mysql-test/t/ssl.test	2012-12-06 14:25:46.371001424 +0100
7a5573f
@@ -6,7 +6,7 @@
7a5573f
 # Save the initial number of concurrent sessions
7a5573f
 --source include/count_sessions.inc
7a5573f
 
7a5573f
-connect (ssl_con,localhost,root,,,,,SSL);
7a5573f
+connect (ssl_con,localhost,root,,,,,SSL CIPHER:DHE-RSA-AES256-SHA);
7a5573f
 
7a5573f
 # Check ssl turned on
7a5573f
 SHOW STATUS LIKE 'Ssl_cipher';