Skip to content

Commit 450c1e6

Browse files
author
Tor Didriksen
committed
Bug #30921806 ENABLE CUSTOM KERBEROS FOR STANDALONE LINUX BUILDS
WL#13759 MySQL 8.0: Support linking with 3rd party OpenLDAP and Cyrus SASL added support for custom LDAP and SASL libraries for standalone linux builds. This patch adds support for custom KERBEROS as well. Pushbuild will now build LDAP/SASL/KERBEROS/SSL as one "package" and invoke cmake with -DWITH_LDAP=</path/to/ldap> -DWITH_SASL=</path/to/sasl> -DWITH_KERBEROS=<path/to/kerberos> -DWITH_SSL=<path/to/ssl> These builds depend on each other, so that the SASL build will use the KERBEROS and SSL builds, the LDAP build will use the SASL and SSL builds. The result is a set of headers and shared libraries which consistently use OpenSSL 1.1.1 We also need to support building *without* KERBEROS, i.e. LDAP/SASL/SSL where libsasl2.so does not depend on libkrb5 and the SASL kerberos plugins are missing. Change-Id: I4078c67cd41ce15842bbf139babe386d6d0e9e2d (cherry picked from commit 9c3f7e6d28fdf4cb29e3b0eedc8ecbf5671434a2)
1 parent 53d4254 commit 450c1e6

15 files changed

+331
-119
lines changed

CMakeLists.txt

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ IF(NOT DEFINED WITH_INTERNAL)
571571
ENDIF()
572572

573573
# On windows we need a non-standard package for SASL.
574-
IF(WITH_INTERNAL AND NOT WIN32)
574+
IF(WITH_INTERNAL AND (NOT WIN32 OR WITH_SASL))
575575
SET(WITH_AUTHENTICATION_LDAP_DEFAULT ON)
576576
ELSE()
577577
SET(WITH_AUTHENTICATION_LDAP_DEFAULT OFF)
@@ -1241,12 +1241,29 @@ IF(LINUX)
12411241
SET(KNOWN_CUSTOM_LIBRARIES "" CACHE INTERNAL "" FORCE)
12421242
ENDIF()
12431243

1244+
# If all custom packages are in the same directory:
1245+
IF(WITH_CUSTOM_LIBRARIES)
1246+
FILE(GLOB WITH_SSL "${WITH_CUSTOM_LIBRARIES}/openssl*")
1247+
FILE(GLOB WITH_KERBEROS "${WITH_CUSTOM_LIBRARIES}/krb5*")
1248+
FILE(GLOB WITH_SASL "${WITH_CUSTOM_LIBRARIES}/cyrus-sasl*")
1249+
FILE(GLOB WITH_LDAP "${WITH_CUSTOM_LIBRARIES}/openldap*")
1250+
FOREACH(WITH_OPT WITH_SSL WITH_KERBEROS WITH_SASL WITH_LDAP)
1251+
IF(IS_DIRECTORY ${${WITH_OPT}})
1252+
SET(${WITH_OPT} ${${WITH_OPT}} CACHE INTERNAL "" FORCE)
1253+
MESSAGE(STATUS "${WITH_OPT} ${${WITH_SSL}}")
1254+
ELSE()
1255+
MESSAGE(WARNING "${WITH_OPT} not found") # This should be FATAL_ERROR
1256+
ENDIF()
1257+
ENDFOREACH()
1258+
ENDIF()
1259+
12441260
# Add system/custom openssl.
12451261
MYSQL_CHECK_SSL()
12461262
MYSQL_CHECK_SSL_DLLS()
12471263

1248-
# Add Kerberos library (custom DLLS not yet supported)
1264+
# Add Kerberos library
12491265
MYSQL_CHECK_KERBEROS()
1266+
MYSQL_CHECK_KERBEROS_DLLS()
12501267

12511268
# Add SASL library
12521269
MYSQL_CHECK_SASL()
@@ -1279,12 +1296,13 @@ ENDIF()
12791296

12801297
IF(WITH_AUTHENTICATION_LDAP)
12811298
IF(LINUX AND KNOWN_CUSTOM_LIBRARIES)
1282-
# LDAP / SASL / SSL must all be "system" or "custom", not a mix.
1299+
# LDAP / SASL / KERBEROS / SSL must all be "system" or "custom", not a mix.
12831300
IF(WITH_LDAP STREQUAL "system" OR
12841301
WITH_SASL STREQUAL "system" OR
1302+
# WITH_KERBEROS STREQUAL "system" OR # enable this later
12851303
WITH_SSL STREQUAL "system")
12861304
MESSAGE(WARNING "-DWITH_AUTHENTICATION_LDAP=ON")
1287-
MESSAGE(FATAL_ERROR "Inconsistent options for LDAP/SASL/SSL")
1305+
MESSAGE(FATAL_ERROR "Inconsistent options for LDAP/SASL/KERBEROS/SSL")
12881306
ENDIF()
12891307
ELSEIF(WIN32)
12901308
# system LDAP, but SASL needs to be explicitly added
@@ -1297,12 +1315,14 @@ IF(WITH_AUTHENTICATION_LDAP)
12971315
ELSEIF(SOLARIS)
12981316
# 11.3 has system LDAP and SASL, but there is no scram plugin.
12991317
ELSE()
1300-
# We must have "system" LDAP and SASL (SSL is always required)
1318+
# We must have "system" LDAP, KERBEROS and SASL (SSL is always required)
13011319
SET(LDAP_WARN_GIVEN)
13021320
SET(SASL_WARN_GIVEN)
1321+
SET(KERBEROS_WARN_GIVEN)
13031322
WARN_MISSING_SYSTEM_LDAP(LDAP_WARN_GIVEN)
13041323
WARN_MISSING_SYSTEM_SASL(SASL_WARN_GIVEN)
1305-
IF(LDAP_WARN_GIVEN OR SASL_WARN_GIVEN)
1324+
WARN_MISSING_SYSTEM_KERBEROS(KERBEROS_WARN_GIVEN)
1325+
IF(LDAP_WARN_GIVEN OR SASL_WARN_GIVEN OR KERBEROS_WARN_GIVEN)
13061326
# SUSE linux: may or may not have SCRAM, do not break the build.
13071327
IF(LINUX_SUSE)
13081328
MESSAGE(WARNING

cmake/install_macros.cmake

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,8 @@ FUNCTION(SET_PATH_TO_SSL target target_out_dir)
388388
ENDFUNCTION()
389389

390390

391-
# For standalone Linux build and -DWITH_LDAP -DWITH_SASL -DWITH_SSL
392-
# set to custom path.
391+
# For standalone Linux build and -DWITH_LDAP -DWITH_SASL -DWITH_SSL and
392+
# -DWITH_KERBEROS set to custom path.
393393
#
394394
# Move the custom shared library and symlinks to library_output_directory.
395395
# The subdir argument is typically empty, but set to "sasl2" for SASL plugins,
@@ -427,11 +427,11 @@ FUNCTION(COPY_CUSTOM_SHARED_LIBRARY library_full_filename subdir
427427
FIND_OBJECT_DEPENDENCIES(${library_full_filename} library_dependencies)
428428

429429
MESSAGE(STATUS "CUSTOM library ${library_full_filename}")
430-
MESSAGE(STATUS "CUSTOM version ${library_version}")
431-
MESSAGE(STATUS "CUSTOM directory ${library_directory}")
432-
MESSAGE(STATUS "CUSTOM name ${library_name}")
433-
MESSAGE(STATUS "CUSTOM name_we ${library_name_we}")
434-
MESSAGE(STATUS "CUSTOM soname ${library_soname}")
430+
# MESSAGE(STATUS "CUSTOM version ${library_version}")
431+
# MESSAGE(STATUS "CUSTOM directory ${library_directory}")
432+
# MESSAGE(STATUS "CUSTOM name ${library_name}")
433+
# MESSAGE(STATUS "CUSTOM name_we ${library_name_we}")
434+
# MESSAGE(STATUS "CUSTOM soname ${library_soname}")
435435

436436
SET(COPIED_LIBRARY_NAME
437437
"${CMAKE_BINARY_DIR}/library_output_directory/${subdir}/${library_name}")
@@ -471,7 +471,7 @@ FUNCTION(COPY_CUSTOM_SHARED_LIBRARY library_full_filename subdir
471471

472472
ADD_DEPENDENCIES(copy_linux_custom_dlls ${COPY_TARGET_NAME})
473473

474-
MESSAGE(STATUS "INSTALL ${library_name} to ${INSTALL_PRIV_LIBDIR}")
474+
MESSAGE(STATUS "INSTALL ${library_name} to ${INSTALL_PRIV_LIBDIR}/${subdir}")
475475

476476
# Cannot use INSTALL_PRIVATE_LIBRARY because these are not targets.
477477
INSTALL(FILES

0 commit comments

Comments
 (0)