You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2017/10/02 18:59:18 UTC
[3/3] mesos git commit: Windows: Rebundled Cyrus SASL CRAM MD5
3rdparty library.
Windows: Rebundled Cyrus SASL CRAM MD5 3rdparty library.
This adds a rebundled library for the `sasl2` dependency of Mesos
and patches the bundle with a minimalistic CMake build. We do not
intend to upstream this CMake build as it only builds a small
subset of the library.
Review: https://reviews.apache.org/r/62105/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/1be4ff75
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/1be4ff75
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/1be4ff75
Branch: refs/heads/master
Commit: 1be4ff755d339b362528739cd27af43a01ab886b
Parents: b722466
Author: John Kordich <jo...@microsoft.com>
Authored: Mon Oct 2 10:23:28 2017 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Mon Oct 2 11:56:40 2017 -0700
----------------------------------------------------------------------
3rdparty/CMakeLists.txt | 32 ++++++++
3rdparty/cmake/Versions.cmake | 3 +
3rdparty/cyrus-sasl-2.1.27rc3.patch | 127 +++++++++++++++++++++++++++++++
3 files changed, 162 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/1be4ff75/3rdparty/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt
index 2a183a4..b9204c9 100755
--- a/3rdparty/CMakeLists.txt
+++ b/3rdparty/CMakeLists.txt
@@ -47,6 +47,7 @@ if (WIN32)
set(CURL_URL ${3RDPARTY_DEPENDENCIES}/curl-${CURL_VERSION}.tar.gz)
set(LIBAPR_URL ${3RDPARTY_DEPENDENCIES}/libapr-${LIBAPR_VERSION}.tar.gz)
set(ZLIB_URL ${3RDPARTY_DEPENDENCIES}/zlib-${ZLIB_VERSION}.tar.gz)
+ set(SASL2_URL ${3RDPARTY_DEPENDENCIES}/cyrus-sasl-${SASL2_VERSION}.tar.gz)
# NOTE: The Windows version of Glog is patched and only available in the
# 3rdparty repo, not the local repo.
@@ -186,6 +187,37 @@ ExternalProject_Add(
URL_HASH ${CONCURRENTQUEUE_HASH})
+if (WIN32)
+ # Cyrus SASL: Authentication protocol/mechanism interface (Based on IETF RFC 4422)
+ # https://cyrusimap.org/sasl/
+ ##################################################################################
+ EXTERNAL(sasl2 ${SASL2_VERSION} ${CMAKE_CURRENT_BINARY_DIR})
+ add_library(sasl2 STATIC IMPORTED GLOBAL)
+ add_dependencies(sasl2 ${SASL2_TARGET})
+
+ set_target_properties(
+ sasl2 PROPERTIES
+ IMPORTED_LOCATION_DEBUG ${SASL2_ROOT}-build/Debug/libsasl2${LIBRARY_SUFFIX}
+ IMPORTED_LOCATION_RELEASE ${SASL2_ROOT}-build/Release/libsasl2${LIBRARY_SUFFIX}
+ INTERFACE_INCLUDE_DIRECTORIES ${SASL2_ROOT}-build/include
+ INTERFACE_COMPILE_DEFINITIONS LIBSASL_EXPORTS=1)
+
+ # Patch SASL to include a minimal CMake build system which encompasses
+ # only the parts that Mesos relies on (CRAM MD5).
+ PATCH_CMD(SASL2_PATCH_CMD cyrus-sasl-${SASL2_VERSION}.patch)
+
+ MAKE_INCLUDE_DIR(sasl2)
+
+ ExternalProject_Add(
+ ${SASL2_TARGET}
+ PREFIX ${SASL2_CMAKE_ROOT}
+ PATCH_COMMAND ${SASL2_PATCH_CMD}
+ INSTALL_COMMAND ${CMAKE_NOOP}
+ URL ${SASL2_URL}
+ URL_HASH ${SASL2_HASH})
+endif ()
+
+
# ELFIO: library for reading and generating ELF files.
# http://elfio.sourceforge.net
######################################################
http://git-wip-us.apache.org/repos/asf/mesos/blob/1be4ff75/3rdparty/cmake/Versions.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/cmake/Versions.cmake b/3rdparty/cmake/Versions.cmake
index 0b62ae9..9a6713d 100644
--- a/3rdparty/cmake/Versions.cmake
+++ b/3rdparty/cmake/Versions.cmake
@@ -41,4 +41,7 @@ else ()
# we want.
set(GLOG_VERSION "da816ea70")
set(GLOG_HASH "SHA256=15338EDBE643F3F9A769FBCA34C3AFDF48D8779D800E7F0878A9649A53339F96")
+
+ set(SASL2_VERSION "2.1.27rc3")
+ set(SASL2_HASH "SHA256=A50F29042AD313A3B8F1EDD1DB6F41BC8D610C00B223EA305D903BA6E6E63B2A")
endif ()
http://git-wip-us.apache.org/repos/asf/mesos/blob/1be4ff75/3rdparty/cyrus-sasl-2.1.27rc3.patch
----------------------------------------------------------------------
diff --git a/3rdparty/cyrus-sasl-2.1.27rc3.patch b/3rdparty/cyrus-sasl-2.1.27rc3.patch
new file mode 100644
index 0000000..e363b9e
--- /dev/null
+++ b/3rdparty/cyrus-sasl-2.1.27rc3.patch
@@ -0,0 +1,127 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+new file mode 100644
+index 0000000..ae81f5c
+--- /dev/null
++++ b/CMakeLists.txt
+@@ -0,0 +1,40 @@
++cmake_minimum_required (VERSION 3.8)
++project (libsasl2)
++
++string(APPEND CMAKE_C_FLAGS_RELEASE " /MT")
++string(APPEND CMAKE_C_FLAGS_DEBUG " /MTd")
++
++string(APPEND CMAKE_CXX_FLAGS_RELEASE " /MT")
++string(APPEND CMAKE_CXX_FLAGS_DEBUG " /MTd")
++
++file(COPY
++ include/hmac-md5.h
++ include/md5.h
++ include/md5global.h
++ include/prop.h
++ include/sasl.h
++ include/saslplug.h
++ include/saslutil.h
++ DESTINATION include/sasl)
++
++# Add the minimal set of files required to build CRAM MD5 support.
++add_library(
++ libsasl2 STATIC
++ common/plugin_common.c
++ lib/auxprop.c
++ lib/canonusr.c
++ lib/checkpw.c
++ lib/client.c
++ lib/common.c
++ lib/config.c
++ lib/external.c
++ lib/getsubopt.c
++ lib/md5.c
++ lib/saslutil.c
++ lib/server.c
++ lib/seterror.c
++ lib/windlopen.c
++ plugins/cram.c)
++
++target_compile_definitions(libsasl2 PUBLIC LIBSASL_EXPORTS=1)
++target_include_directories(libsasl2 PUBLIC win32/include include common)
+diff --git a/include/md5global.h b/include/md5global.h
+index 414bac6..c939a22 100644
+--- a/include/md5global.h
++++ b/include/md5global.h
+@@ -18,11 +18,9 @@ typedef unsigned char *POINTER;
+ typedef signed char INT1; /* 8 bits */
+ typedef short INT2; /* 16 bits */
+ typedef int INT4; /* 32 bits */
+-typedef long INT8; /* 64 bits */
+ typedef unsigned char UINT1; /* 8 bits */
+ typedef unsigned short UINT2; /* 16 bits */
+ typedef unsigned int UINT4; /* 32 bits */
+-typedef unsigned long UINT8; /* 64 bits */
+
+ /* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
+ If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
+diff --git a/lib/windlopen.c b/lib/windlopen.c
+index 70ac6b5..758c934 100644
+--- a/lib/windlopen.c
++++ b/lib/windlopen.c
+@@ -49,6 +49,7 @@
+ #include <config.h>
+ #include <sasl.h>
+ #include "saslint.h"
++#include "staticopen.h"
+
+ #define DLL_SUFFIX ".dll"
+ #define DLL_MASK "*" DLL_SUFFIX
+@@ -190,6 +191,18 @@ int _sasl_load_plugins(const add_plugin_list_t *entrypoints,
+ || ! verifyfile_cb->proc)
+ return SASL_BADPARAM;
+
++ for (cur_ep = entrypoints; cur_ep->entryname; cur_ep++)
++ {
++ if (strcmp("sasl_server_plug_init", cur_ep->entryname) == 0)
++ {
++ sasl_server_add_plugin("CRAM-MD5", crammd5_server_plug_init);
++ }
++ else if (strcmp("sasl_client_plug_init", cur_ep->entryname) == 0)
++ {
++ sasl_client_add_plugin("CRAM-MD5", crammd5_client_plug_init);
++ }
++ }
++
+ /* get the path to the plugins */
+ result = ((sasl_getpath_t *)(getpath_cb->proc))(getpath_cb->context,
+ &path);
+diff --git a/win32/include/config.h b/win32/include/config.h
+index 8d8548e..c0f7236 100644
+--- a/win32/include/config.h
++++ b/win32/include/config.h
+@@ -92,18 +92,9 @@ typedef int intptr_t;
+ #define SASL_BERKELEYDB 1
+
+ /* which mechs can we link statically? */
+-#define STATIC_ANONYMOUS 1
+ #define STATIC_CRAMMD5 1
+-#define STATIC_DIGESTMD5 1
+-#define STATIC_SCRAM 1
+-#define STATIC_GSSAPIV2 1
+ /* #undef STATIC_KERBEROS4 */
+-#define STATIC_LOGIN 1
+ /* #undef STATIC_MYSQL */
+-#define STATIC_OTP 1
+-#define STATIC_PLAIN 1
+-#define STATIC_SASLDB 1
+-#define STATIC_SRP 1
+
+ /* ------------------------------------------------------------ */
+
+@@ -117,8 +117,8 @@ typedef int intptr_t;
+ /* Windows calls these functions something else
+ */
+ #define strcasecmp stricmp
+-#define snprintf _snprintf
+-#define strncasecmp strnicmp
++//#define snprintf _snprintf
++#define strncasecmp _strnicmp
+
+ #define MAXHOSTNAMELEN 1024
+