1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-08 14:02:17 +03:00

Fixed gnutls support

This commit is contained in:
Georg Richter
2015-08-13 14:01:33 +02:00
parent f2955a4b39
commit 23895fbd4f
17 changed files with 390 additions and 196 deletions

View File

@@ -25,7 +25,7 @@ SET(API_TESTS "async" "basic-t" "fetch" "charset" "logs" "cursor" "errors" "view
"sp" "result" "connection" "misc" "ps_new" "sqlite3" "thread" "dyncol")
# Get finger print from server certificate
IF(WITH_OPENSSL)
IF(WITH_SSL)
#create certificates
IF(EXISTS "${CMAKE_SOURCE_DIR}/unittest/libmariadb/certs/server-cert.pem")

View File

@@ -33,8 +33,8 @@ pthread_mutex_t LOCK_test;
int check_skip_ssl()
{
#ifndef HAVE_OPENSSL
diag("client library built without OpenSSL support -> skip");
#ifndef HAVE_SSL
diag("client library built without SSL support -> skip");
return 1;
#endif
if (skip_ssl)
@@ -92,7 +92,11 @@ static int test_ssl_cipher(MYSQL *unused)
port, socketname, 0), mysql_error(my));
cipher= (char *)mysql_get_ssl_cipher(my);
#ifdef HAVE_OPENSSL
FAIL_IF(strcmp(cipher, "DHE-RSA-AES256-SHA") != 0, "Cipher != DHE-RSA-AES256-SHA");
#elif defined(HAVE_HNUTLS)
FAIL_IF(strcmp(cipher, "AES-256-CBC") != 0, "Cipher != AES-256-CBC");
#endif
mysql_close(my);
return OK;
}
@@ -174,7 +178,11 @@ static int test_multi_ssl_connections(MYSQL *unused)
}
cipher= (char *)mysql_get_ssl_cipher(mysql[i]);
#ifdef HAVE_OPENSSL
FAIL_IF(strcmp(cipher, "DHE-RSA-AES256-SHA") != 0, "Cipher != DHE-RSA-AES256-SHA");
#elif defined(HAVE_HNUTLS)
FAIL_IF(strcmp(cipher, "AES-256-CBC") != 0, "Cipher != AES-256-CBC");
#endif
}
for (i=0; i < 50; i++)
mysql_close(mysql[i]);
@@ -637,7 +645,11 @@ static int test_ssl_fp(MYSQL *unused)
port, socketname, 0), mysql_error(my));
cipher= (char *)mysql_get_ssl_cipher(my);
#ifdef HAVE_OPENSSL
FAIL_IF(strcmp(cipher, "DHE-RSA-AES256-SHA") != 0, "Cipher != DHE-RSA-AES256-SHA");
#elif defined(HAVE_HNUTLS)
FAIL_IF(strcmp(cipher, "AES-256-CBC") != 0, "Cipher != AES-256-CBC");
#endif
mysql_close(my);
return OK;
}
@@ -660,8 +672,11 @@ static int test_ssl_fp_list(MYSQL *unused)
FAIL_IF(!mysql_real_connect(my, hostname, ssluser, sslpw, schema,
port, socketname, 0), mysql_error(my));
cipher= (char *)mysql_get_ssl_cipher(my);
#ifdef HAVE_OPENSSL
FAIL_IF(strcmp(cipher, "DHE-RSA-AES256-SHA") != 0, "Cipher != DHE-RSA-AES256-SHA");
#elif defined(HAVE_HNUTLS)
FAIL_IF(strcmp(cipher, "AES-256-CBC") != 0, "Cipher != AES-256-CBC");
#endif
mysql_close(my);
return OK;
}