You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-07 02:42:49 +03:00
Merge commit 'b0411b731f5d61df38fe3f783437df13526774f2' into 3.1
This commit is contained in:
@@ -16,6 +16,11 @@
|
||||
or write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St., Fifth Floor, Boston, MA 02110, USA
|
||||
*************************************************************************************/
|
||||
#if defined(WIN32) && defined(HEAP_CHECK)
|
||||
#define _CRTDBG_MAP_ALLOC
|
||||
#include <stdlib.h>
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
|
||||
#include "my_test.h"
|
||||
#include <ma_pthread.h>
|
||||
@@ -34,6 +39,7 @@ const char *ssluser= "ssluser";
|
||||
const char *sslpw= "sslpw";
|
||||
char sslhost[128];
|
||||
char sslcert[FNLEN];
|
||||
char sslcombined[FNLEN];
|
||||
char sslkey[FNLEN];
|
||||
char sslkey_enc[FNLEN];
|
||||
char sslca[FNLEN];
|
||||
@@ -63,6 +69,7 @@ int check_skip_ssl()
|
||||
}
|
||||
}
|
||||
snprintf(sslcert, FNLEN - 1, "%s/%s", ssldir, "client-cert.pem");
|
||||
snprintf(sslcombined, FNLEN - 1, "%s/%s", ssldir, "client-certkey.pem");
|
||||
snprintf(sslkey, FNLEN - 1, "%s/%s", ssldir, "client-key.pem");
|
||||
snprintf(sslkey_enc, FNLEN - 1, "%s/%s", ssldir, "client-key-enc.pem");
|
||||
snprintf(sslca, FNLEN - 1, "%s/%s", ssldir, "cacert.pem");
|
||||
@@ -1287,6 +1294,33 @@ static int test_mdev14101(MYSQL *my __attribute__((unused)))
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int test_conc386(MYSQL *mysql)
|
||||
{
|
||||
#ifdef WIN32
|
||||
if (_access(sslcombined, 0) == -1)
|
||||
#else
|
||||
if (access(sslcombined, R_OK) != 0)
|
||||
#endif
|
||||
{
|
||||
diag("combined cert/key file not found");
|
||||
return SKIP;
|
||||
}
|
||||
|
||||
mysql= mysql_init(NULL);
|
||||
mysql_ssl_set(mysql,
|
||||
sslcombined,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
FAIL_IF(!mysql_real_connect(mysql, hostname, username, password, schema,
|
||||
port, socketname, 0), mysql_error(mysql));
|
||||
FAIL_IF(check_cipher(mysql) != 0, "Invalid cipher");
|
||||
mysql_close(mysql);
|
||||
unlink(sslcombined);
|
||||
return OK;
|
||||
}
|
||||
|
||||
struct my_tests_st my_tests[] = {
|
||||
{"test_ssl", test_ssl, TEST_CONNECTION_NEW, 0, NULL, NULL},
|
||||
{"test_mdev14101", test_mdev14101, TEST_CONNECTION_NEW, 0, NULL, NULL},
|
||||
@@ -1323,6 +1357,8 @@ struct my_tests_st my_tests[] = {
|
||||
#else
|
||||
{"test_schannel_cipher", test_schannel_cipher, TEST_CONNECTION_NEW, 0, NULL, NULL},
|
||||
#endif
|
||||
|
||||
{"test_conc386", test_conc386, TEST_CONNECTION_NEW, 0, NULL, NULL},
|
||||
{"drop_ssl_user", drop_ssl_user, TEST_CONNECTION_NEW, 0, NULL, NULL},
|
||||
{NULL, NULL, 0, 0, NULL, NULL}
|
||||
};
|
||||
@@ -1330,6 +1366,15 @@ struct my_tests_st my_tests[] = {
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
#if defined(WIN32) && defined(HEAP_CHECK)
|
||||
_CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
|
||||
_CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT );
|
||||
_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );
|
||||
_CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDOUT );
|
||||
_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
|
||||
_CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDOUT );
|
||||
#endif
|
||||
|
||||
get_envvars();
|
||||
|
||||
if (argc > 1)
|
||||
@@ -1337,6 +1382,9 @@ int main(int argc, char **argv)
|
||||
run_tests(my_tests);
|
||||
|
||||
mysql_server_end();
|
||||
#if defined(WIN32) && defined(HEAP_CHECK)
|
||||
_CrtDumpMemoryLeaks();
|
||||
#endif
|
||||
return(exit_status());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user