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