19
19
20
20
#include "my_test.h"
21
21
#include <ma_pthread.h>
22
+ #ifdef HAVE_OPENSSL
23
+ #include <openssl/opensslv.h>
24
+ #endif
22
25
23
26
#define FNLEN 4096
24
27
@@ -107,6 +110,7 @@ static int test_ssl(MYSQL *mysql)
107
110
int rc;
108
111
MYSQL_RES *res;
109
112
MYSQL_ROW row;
113
+ char *tls_library;
110
114
111
115
rc= mysql_query(mysql, "SELECT @@have_ssl UNION SELECT @@have_openssl");
112
116
check_mysql_rc(rc, mysql);
@@ -124,13 +128,8 @@ static int test_ssl(MYSQL *mysql)
124
128
}
125
129
mysql_free_result(res);
126
130
127
- #ifdef HAVE_GNUTLS
128
- diag("SSL library: GNUTLS");
129
- #elif HAVE_OPENSSL
130
- diag("SSL library: OPENSSL");
131
- #elif HAVE_SCHANNEL
132
- diag("SSL library: SCHANNEL");
133
- #endif
131
+ mariadb_get_infov(NULL, MARIADB_TLS_LIBRARY, &tls_library);
132
+ diag("SSL library: %s", tls_library);
134
133
135
134
sslhost[0]= 0;
136
135
@@ -1132,8 +1131,36 @@ static int test_conc286(MYSQL *unused __attribute__((unused)))
1132
1131
return OK;
1133
1132
}
1134
1133
1134
+ static int test_mdev14027(MYSQL *mysql __attribute__((unused)))
1135
+ {
1136
+ char *tls_library;
1137
+ const char *check_library=
1138
+ #if defined(HAVE_OPENSSL)
1139
+ #if defined(HAVE_LIBRESSL)
1140
+ "LibreSSL";
1141
+ #else
1142
+ "OpenSSL";
1143
+ #endif
1144
+ #elif defined(HAVE_GNUTLS)
1145
+ "GnuTLS";
1146
+ #elif defined(HAVE_SCHANNEL)
1147
+ "Schannel";
1148
+ #else
1149
+ "Off";
1150
+ #endif
1151
+ mariadb_get_infov(NULL, MARIADB_TLS_LIBRARY, &tls_library);
1152
+ diag("TLS/SSL library in use: %s\n", tls_library);
1153
+ if (!strstr(tls_library, check_library))
1154
+ {
1155
+ diag("expected %s, got %s", check_library, tls_library);
1156
+ return FAIL;
1157
+ }
1158
+ return OK;
1159
+ }
1160
+
1135
1161
struct my_tests_st my_tests[] = {
1136
1162
{"test_ssl", test_ssl, TEST_CONNECTION_NEW, 0, NULL, NULL},
1163
+ {"test_mdev14027", test_mdev14027, TEST_CONNECTION_NEW, 0, NULL, NULL},
1137
1164
{"test_conc286", test_conc286, TEST_CONNECTION_NEW, 0, NULL, NULL},
1138
1165
{"test_ssl_timeout", test_ssl_timeout, TEST_CONNECTION_NEW, 0, NULL, NULL},
1139
1166
{"test_openssl_1", test_openssl_1, TEST_CONNECTION_NEW, 0, NULL, NULL},
0 commit comments