Skip to content

Commit

Permalink
Merge branch '3.1' into 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
9EOR9 committed May 25, 2020
2 parents 5f7e3ad + cdfeceb commit 734f467
Show file tree
Hide file tree
Showing 54 changed files with 2,040 additions and 1,238 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ unittest/libmariadb/rpl_api
unittest/libmariadb/sp
unittest/libmariadb/sqlite3
unittest/libmariadb/ssl
unittest/libmariadb/ssl.c
unittest/libmariadb/t_aurora
unittest/libmariadb/t_conc173
unittest/libmariadb/thread
Expand Down
11 changes: 7 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,26 @@ before_install:
- export SSLCERT=$PROJ_PATH/tmp
matrix:
allow_failures:
- env: DB=build
- env: SERVER_BRANCH=10.4
- env: SERVER_BRANCH=10.4 TEST_OPTION=--ps-protocol
# - env: DB=build
# - env: SERVER_BRANCH=10.5
# - env: SERVER_BRANCH=10.5 TEST_OPTION=--ps-protocol
include:
- env: DB=build
- env: DB=mysql:5.7
# disable for now - env: DB=mysql:8.0
- env: DB=mariadb:5.5
- env: DB=mariadb:10.0
- env: DB=mariadb:10.1
- env: DB=mariadb:10.2
- env: DB=mariadb:10.3
- env: DB=mariadb:10.4
- env: SERVER_BRANCH=10.2
- env: SERVER_BRANCH=10.2 TEST_OPTION=--ps-protocol
- env: SERVER_BRANCH=10.3
- env: SERVER_BRANCH=10.3 TEST_OPTION=--ps-protocol
- env: SERVER_BRANCH=10.4
- env: SERVER_BRANCH=10.4 TEST_OPTION=--ps-protocol
- env: SERVER_BRANCH=10.5
- env: SERVER_BRANCH=10.5 TEST_OPTION=--ps-protocol

script:
- if [ "$DB" = "build" ] ; then .travis/build/build.sh; fi
Expand Down
113 changes: 46 additions & 67 deletions .travis/gen-ssl.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -35,61 +35,67 @@ main () {
local clientCertFile="${sslDir}/client-cert.pem"
local clientKeyFile="${sslDir}/client-key.pem"
local clientEncryptedKeyFile="${sslDir}/client-key-enc.pem"
local clientCombinedFile="${sslDir}/client-certkey.pem"
local clientKeystoreFile="${sslDir}/client-keystore.jks"
local fullClientKeystoreFile="${sslDir}/fullclient-keystore.jks"
local tmpKeystoreFile=$(mktemp)
local pcks12FullKeystoreFile="${sslDir}/fullclient-keystore.p12"
local clientReqFile=$(mktemp)

log "Generating CA key"
rm -rf demoCA
mkdir demoCA demoCA/newcerts
touch demoCA/index.txt
echo 01 > demoCA/serial
echo 01 > demoCA/crlnumber

log "# Generating CA key"
openssl genrsa -out "${caKeyFile}" 2048

log "Generating CA certificate"
log "# Generating CA certificate"
openssl req \
-sha1 \
-new \
-x509 \
-nodes \
-newkey rsa:2048 -keyout "${caKeyFile}" \
-out "${caCertFile}" \
-days 3650 \
-nodes \
-subj "$(gen_cert_subject ca.example.com)" \
-key "${caKeyFile}" \
-out "${caCertFile}"
-text

log "Generating private key"
openssl genrsa -out "${keyFile}" 2048

log "Generating certificate signing request"
log "# Server certificate signing request and private key"
openssl req \
-new \
-batch \
-sha1 \
-subj "$(gen_cert_subject "$fqdn")" \
-set_serial 01 \
-key "${keyFile}" \
-out "${csrFile}" \
-nodes

log "Generating X509 certificate"
openssl x509 \
-req \
-sha1 \
-set_serial 01 \
-CA "${caCertFile}" \
-CAkey "${caKeyFile}" \
-days 3650 \
-in "${csrFile}" \
-signkey "${keyFile}" \
-out "${certFile}"
-newkey rsa:2048 -keyout "${keyFile}" \
-out "./demoCA/server-req.pem" \
-nodes \
-subj "$(gen_cert_subject "$fqdn")"


log "# Convert the key to yassl compatible format"
openssl rsa -in "${keyFile}" -out "${keyFile}"

log "# Sign the server certificate with CA certificate"
openssl ca -keyfile "${caKeyFile}" -days 3650 -batch \
-cert "${caCertFile}" -policy policy_anything -out "${certFile}" -in "./demoCA/server-req.pem"

log "Generating client certificate"
openssl req \
-batch \
-newkey rsa:2048 \
-days 3600 \
-subj "$(gen_cert_subject "$fqdn")" \
-nodes \
-keyout "${clientKeyFile}" \
-out "${clientReqFile}"
-out demoCA/client-req.pem \
-days 7300 \
-nodes \
-subj /CN=client/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB

openssl rsa \
-in "${clientKeyFile}" \
-out "${clientKeyFile}"

openssl ca -keyfile "${caKeyFile}" \
-days 7300 \
-batch \
-cert "${caCertFile}" \
-policy policy_anything \
-out "${clientCertFile}" \
-in demoCA/client-req.pem

log "Generating password protected client key file"
openssl rsa \
Expand All @@ -98,6 +104,9 @@ main () {
-out "${clientEncryptedKeyFile}" \
-passout pass:qwerty

log "combined"
cat "${clientCertFile}" "${clientKeyFile}" > "${clientCombinedFile}"

log "Generating finger print of server certificate"
openssl x509 \
-noout \
Expand All @@ -111,41 +120,11 @@ main () {
log "copy ca file"
cp "${caCertFile}" "${sslDir}/cacert.pem"

openssl x509 \
-req \
-in "${clientReqFile}" \
-days 3600 \
-CA "${caCertFile}" \
-CAkey "${caKeyFile}" \
-set_serial 01 \
-out "${clientCertFile}"

# Now generate a keystore with the client cert & key
log "Generating client keystore"
openssl pkcs12 \
-export \
-in "${clientCertFile}" \
-inkey "${clientKeyFile}" \
-out "${tmpKeystoreFile}" \
-name "mysqlAlias" \
-passout pass:kspass


# Now generate a full keystore with the client cert & key + trust certificates
log "Generating full client keystore"
openssl pkcs12 \
-export \
-in "${clientCertFile}" \
-inkey "${clientKeyFile}" \
-out "${pcks12FullKeystoreFile}" \
-name "mysqlAlias" \
-passout pass:kspass


# Clean up CSR file:
rm "$csrFile"
rm "$clientReqFile"
rm "$tmpKeystoreFile"
# rm -rf demoCA

log "Generated key file and certificate in: ${sslDir}"
ls -l "${sslDir}"
Expand Down
9 changes: 4 additions & 5 deletions .travis/server-replace-submodule.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
# get latest server
git clone -b ${SERVER_BRANCH} https://github.com/mariadb/server ../workdir-server

# copy C/C into libmariadb in server
ls -l ../workdir-server/libmariadb
cp -r . ../workdir-server/libmariadb

cd ../workdir-server
# don't pull in submodules. We want the latest C/C as libmariadb
git config cmake.update-submodules no
# build latest server with latest C/C as libmariadb
# skip to build some storage engines to speed up the build
cmake -DPLUGIN_MROONGA=NO -DPLUGIN_ROCKSDB=NO -DPLUGIN_SPIDER=NO -DPLUGIN_TOKUDB=NO
cd libmariadb
git checkout ${TRAVIS_COMMIT}
cd ..
git add libmariadb
make -j9

cd mysql-test/
Expand Down
20 changes: 15 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
INCLUDE(CheckFunctionExists)
IF(COMMAND CMAKE_POLICY)
SET(NEW_POLICIES CMP0003 CMP0022 CMP0023 CMP0077)
SET(NEW_POLICIES CMP0003 CMP0022 CMP0023 CMP0077 CMP0069)
FOREACH(TYPE OLD NEW)
FOREACH(P ${${TYPE}_POLICIES})
IF(POLICY ${P})
Expand Down Expand Up @@ -36,7 +36,7 @@ SET(CC_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})

SET(CPACK_PACKAGE_VERSION_MAJOR 3)
SET(CPACK_PACKAGE_VERSION_MINOR 1)
SET(CPACK_PACKAGE_VERSION_PATCH 6)
SET(CPACK_PACKAGE_VERSION_PATCH 9)
SET(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
MATH(EXPR MARIADB_PACKAGE_VERSION_ID "${CPACK_PACKAGE_VERSION_MAJOR} * 10000 +
${CPACK_PACKAGE_VERSION_MINOR} * 100 +
Expand Down Expand Up @@ -107,6 +107,7 @@ IF(NOT IS_SUBPROJECT)
IF(MSVC)
# Speedup system tests
INCLUDE(${CC_SOURCE_DIR}/cmake/WindowsCache.cmake)
ADD_DEFINITIONS(-DWIN32_LEAN_AND_MEAN)
IF (MSVC)
SET(CONFIG_TYPES "DEBUG" "RELEASE" "RELWITHDEBINFO")
FOREACH(BUILD_TYPE ${CONFIG_TYPES})
Expand Down Expand Up @@ -330,7 +331,8 @@ IF(NOT WITH_SSL STREQUAL "OFF")
IF(WITH_SSL STREQUAL "SCHANNEL")
ADD_DEFINITIONS(-DHAVE_SCHANNEL -DHAVE_TLS)
SET(SSL_SOURCES "${CC_SOURCE_DIR}/libmariadb/secure/schannel.c"
"${CC_SOURCE_DIR}/libmariadb/secure/ma_schannel.c")
"${CC_SOURCE_DIR}/libmariadb/secure/ma_schannel.c"
"${CC_SOURCE_DIR}/libmariadb/secure/schannel_certs.c")
INCLUDE_DIRECTORIES("${CC_SOURCE_DIR}/plugins/pvio/")
SET(SSL_LIBRARIES secur32)
SET(TLS_LIBRARY_VERSION "Schannel ${CMAKE_SYSTEM_VERSION}")
Expand Down Expand Up @@ -432,10 +434,18 @@ SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CC_SOURCE_DIR}/README")
INCLUDE(cmake/ConnectorName.cmake)
IF(NOT PACKAGE_STATUS_SUFFIX)
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "mariadb-connector-c-${CPACK_PACKAGE_VERSION}-src")
SET(CPACK_PACKAGE_FILE_NAME "mariadb-connector-c-${CPACK_PACKAGE_VERSION}-${system_name}-${CMAKE_SYSTEM_PROCESSOR}")
IF(PACKAGE_PLATFORM_SUFFIX)
SET(CPACK_PACKAGE_FILE_NAME "mariadb-connector-c-${CPACK_PACKAGE_VERSION}-${PACKAGE_PLATFORM_SUFFIX}")
ELSE()
SET(CPACK_PACKAGE_FILE_NAME "mariadb-connector-c-${CPACK_PACKAGE_VERSION}-${system_name}-${CMAKE_SYSTEM_PROCESSOR}")
ENDIF()
ELSE()
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "mariadb-connector-c-${CPACK_PACKAGE_VERSION}-${PACKAGE_STATUS_SUFFIX}-src")
SET(CPACK_PACKAGE_FILE_NAME "mariadb-connector-c-${CPACK_PACKAGE_VERSION}-${PACKAGE_STATUS_SUFFIX}-${system_name}-${CMAKE_SYSTEM_PROCESSOR}")
IF(PACKAGE_PLATFORM_SUFFIX)
SET(CPACK_PACKAGE_FILE_NAME "mariadb-connector-c-${CPACK_PACKAGE_VERSION}-${PACKAGE_STATUS_SUFFIX}-${PACKAGE_PLATFORM_SUFFIX}")
ELSE()
SET(CPACK_PACKAGE_FILE_NAME "mariadb-connector-c-${CPACK_PACKAGE_VERSION}-${PACKAGE_STATUS_SUFFIX}-${system_name}-${CMAKE_SYSTEM_PROCESSOR}")
ENDIF()
ENDIF()
# Build source packages
IF(GIT_BUILD_SRCPKG)
Expand Down
24 changes: 9 additions & 15 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,22 @@ branches:
- master
environment:
matrix:
- DB: '10.2.18'
- DB: '5.5.67'
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
CMAKE_PARAM: 'Visual Studio 15 2017 Win64'
- DB: '10.2.18'
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
CMAKE_PARAM: 'Visual Studio 14 2015 Win64'
- DB: '10.2.18'
- DB: '10.1.44'
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
CMAKE_PARAM: 'Visual Studio 15 2017'
- DB: '10.2.18'
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
CMAKE_PARAM: 'Visual Studio 14 2015'
- DB: '10.3.11'
CMAKE_PARAM: 'Visual Studio 15 2017 Win64'
- DB: '10.2.31'
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
CMAKE_PARAM: 'Visual Studio 15 2017 Win64'
- DB: '10.1.37'
- DB: '10.3.22'
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
CMAKE_PARAM: 'Visual Studio 15 2017 Win64'
- DB: '10.0.37'
- DB: '10.4.12'
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
CMAKE_PARAM: 'Visual Studio 15 2017 Win64'
- DB: '5.5.62'
- DB: '10.5.2'
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
CMAKE_PARAM: 'Visual Studio 15 2017 Win64'

Expand All @@ -38,8 +32,8 @@ before_build:
- cmd: set MYSQL_TEST_PASSWD=
- cmd: set MYSQL_TEST_PORT=3306
- cmd: set MYSQL_TEST_DB=testc
- cmd: set FILE=http://mariadb.mirrors.ovh.net/MariaDB/mariadb-%DB%/winx64-packages/mariadb-%DB%-winx64.msi
- ps: Start-FileDownload $Env:FILE -FileName server.msi
- cmd: set archive=http://mariadb.mirrors.ovh.net/MariaDB/mariadb-%DB%/winx64-packages/mariadb-%DB%-winx64.msi
- cmd: curl -fsS -o server.msi %archive%
- cmd: msiexec /i server.msi INSTALLDIR=c:\projects\server SERVICENAME=mariadb ALLOWREMOTEROOTACCESS=true /qn
- cmd: "\"c:\\projects\\server\\bin\\mysql.exe\" -e \"create database testc\" --user=root"
- cmd: cmake -G "%CMAKE_PARAM%" -DCMAKE_BUILD_TYPE=RelWithDebInfo
Expand Down
2 changes: 2 additions & 0 deletions cmake/CheckFunctions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ CHECK_FUNCTION_EXISTS (getpwuid HAVE_GETPWUID)
IF(HAVE_FILE_UCONTEXT_H)
CHECK_FUNCTION_EXISTS (makecontext HAVE_UCONTEXT_H)
ENDIF()

CHECK_FUNCTION_EXISTS (cuserid HAVE_CUSERID)
23 changes: 15 additions & 8 deletions cmake/install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#
#
# The following va+riables are used and can be overwritten
#
#
# INSTALL_LAYOUT installation layout (DEFAULT = standard for tar.gz and zip packages
# RPM packages
#
Expand All @@ -29,7 +29,7 @@ ENDIF()
SET(INSTALL_LAYOUT ${INSTALL_LAYOUT} CACHE
STRING "Installation layout. Currently supported options are DEFAULT (tar.gz and zip), RPM and DEB")

# On Windows we only provide zip and .msi. Latter one uses a different packager.
# On Windows we only provide zip and .msi. Latter one uses a different packager.
IF(UNIX)
IF(INSTALL_LAYOUT MATCHES "RPM")
SET(libmariadb_prefix "/usr")
Expand Down Expand Up @@ -92,15 +92,14 @@ SET(LIBMARIADB_STATIC_RPM "mariadbclient")
#
SET(INSTALL_BINDIR_DEB "bin")
SET(INSTALL_LIBDIR_DEB "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
SET(INSTALL_PCDIR_DEB "lib/pkgconfig")
IF(PLUGINDIR_DEB)
SET(INSTALL_PLUGINDIR_DEB "${INSTALL_LIBDIR_DEB}/${PLUGINDIR_DEB}/plugin")
ELSE()
SET(INSTALL_PLUGINDIR_DEB "${INSTALL_LIBDIR_DEB}/mariadb/plugin")
ENDIF()
SET(INSTALL_PCDIR_DEB "lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig")
SET(INSTALL_PLUGINDIR_DEB "${INSTALL_LIBDIR_DEB}/libmariadb${CPACK_PACKAGE_VERSION_MAJOR}/plugin")
SET(INSTALL_INCLUDEDIR_DEB "include/mariadb")
SET(LIBMARIADB_STATIC_DEB "mariadb")

IF(INSTALL_LAYOUT MATCHES "DEB")
SET(INSTALL_PLUGINDIR_CLIENT ${INSTALL_PLUGINDIR_DEB})
ENDIF()


#
Expand All @@ -118,6 +117,11 @@ IF(INSTALL_PLUGINDIR)
SET(INSTALL_PLUGINDIR_${INSTALL_LAYOUT} ${INSTALL_PLUGINDIR})
ENDIF()

# Extra INSTALL_PLUGINDIR_CLIENT that overrides any INSTALL_PLUGINDIR override
IF(INSTALL_PLUGINDIR_CLIENT)
SET(INSTALL_PLUGINDIR_${INSTALL_LAYOUT} ${INSTALL_PLUGINDIR_CLIENT})
ENDIF()

IF(INSTALL_INCLUDEDIR)
SET(INSTALL_INCLUDEDIR_${INSTALL_LAYOUT} ${INSTALL_INCLUDEDIR})
ENDIF()
Expand All @@ -139,7 +143,10 @@ ENDIF()
FOREACH(dir "BIN" "LIB" "PC" "INCLUDE" "DOCS" "PLUGIN")
SET(INSTALL_${dir}DIR ${INSTALL_${dir}DIR_${INSTALL_LAYOUT}})
MARK_AS_ADVANCED(INSTALL_${dir}DIR)
MESSAGE1(INSTALL_${dir}DIR "MariaDB Connector C: INSTALL_${dir}DIR=${INSTALL_${dir}DIR}")
ENDFOREACH()

SET(LIBMARIADB_STATIC_NAME ${LIBMARIADB_STATIC_${INSTALL_LAYOUT}})
MARK_AS_ADVANCED(LIBMARIADB_STATIC_NAME)

MESSAGE1(LIBMARIADB_STATIC_NAME "MariaDB Connector C: LIBMARIADB_STATIC_NAME ${LIBMARIADB_STATIC_NAME}")
Loading

0 comments on commit 734f467

Please sign in to comment.