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

ssl unit test fixes

* don't abuse CONFIGURE_FILE
  no need to generate ssl.c during the build
* don't skip tests when the input data is missing
  if the certificate is not found it is not OK
* run-time CERT_PATH is not the same as build-time CERT_PATH
  load server-cert.sha1 at run-time
* test an invalid fingerprint - it has to fail
* do not delete certificates at the end of the test
* test SSL_VERIFY_SERVER_CERT with a system CA
This commit is contained in:
Sergei Golubchik
2020-01-22 16:20:50 +01:00
committed by Georg Richter
parent 8e9c311610
commit 84dc415fce
3 changed files with 31 additions and 61 deletions

View File

@@ -38,21 +38,11 @@ SET(MANUAL_TESTS "t_aurora" "t_conc173" "rpl_api")
# Get finger print from server certificate
IF(WITH_SSL)
IF(CERT_PATH)
IF(EXISTS ${CERT_PATH}/server-cert.sha1)
FILE(READ ${CERT_PATH}/server-cert.sha1 CERT_FINGER_PRINT)
STRING(REPLACE "\n" "" CERT_FINGER_PRINT "${CERT_FINGER_PRINT}")
ADD_DEFINITIONS(-DTEST_SSL_SHA1)
ENDIF()
IF(EXISTS ${CERT_PATH}/client-key-enc.pem)
ADD_DEFINITIONS(-DTEST_SSL_PASSPHRASE)
ENDIF()
SET(API_TESTS ${API_TESTS} "ssl")
IF(WIN32)
STRING(REPLACE "\\" "\\\\" CERT_PATH ${CERT_PATH})
ENDIF()
CONFIGURE_FILE(${CC_SOURCE_DIR}/unittest/libmariadb/ssl.c.in
${CC_BINARY_DIR}/unittest/libmariadb/ssl.c)
ADD_EXECUTABLE(ssl ${CC_BINARY_DIR}/unittest/libmariadb/ssl.c)
ADD_DEFINITIONS(-DCERT_PATH="${CERT_PATH}")
ENDIF()
ENDIF()