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 2019/12/18 22:34:35 UTC

[mesos] 06/11: SSL Socket: Windows: Made sure windows.hpp is included before OpenSSL.

This is an automated email from the ASF dual-hosted git repository.

josephwu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 211cf79b60c49a225c2fc82cf0a0148fc5ed5513
Author: Joseph Wu <jo...@apache.org>
AuthorDate: Wed Oct 16 16:14:07 2019 -0700

    SSL Socket: Windows: Made sure windows.hpp is included before OpenSSL.
    
    Depending on the version of OpenSSL and what headers of OpenSSL
    are included, the order of certain Windows headers may be included
    in the "wrong" order.  This results in hundreds of cryptic syntax
    errors from MSVC.
    
    This sweeps through the existing sites with OpenSSL headers and
    makes sure to include the Windows headers above them.
    
    Review: https://reviews.apache.org/r/71663
---
 3rdparty/libprocess/include/process/jwt.hpp            | 6 ++++++
 3rdparty/libprocess/include/process/ssl/gtest.hpp      | 6 ++++++
 3rdparty/libprocess/include/process/ssl/tls_config.hpp | 6 ++++++
 3rdparty/libprocess/src/openssl.cpp                    | 6 ++++++
 3rdparty/libprocess/src/ssl/utilities.cpp              | 6 ++++++
 5 files changed, 30 insertions(+)

diff --git a/3rdparty/libprocess/include/process/jwt.hpp b/3rdparty/libprocess/include/process/jwt.hpp
index 62bf5c2..16fe5a9 100644
--- a/3rdparty/libprocess/include/process/jwt.hpp
+++ b/3rdparty/libprocess/include/process/jwt.hpp
@@ -16,6 +16,12 @@
 #include <ostream>
 #include <string>
 
+#ifdef __WINDOWS__
+// NOTE: This must be included before the OpenSSL headers as it includes
+// `WinSock2.h` and `Windows.h` in the correct order.
+#include <stout/windows.hpp>
+#endif // __WINDOWS__
+
 #include <openssl/rsa.h>
 
 #include <stout/json.hpp>
diff --git a/3rdparty/libprocess/include/process/ssl/gtest.hpp b/3rdparty/libprocess/include/process/ssl/gtest.hpp
index 4a14a8e..ec7f242 100644
--- a/3rdparty/libprocess/include/process/ssl/gtest.hpp
+++ b/3rdparty/libprocess/include/process/ssl/gtest.hpp
@@ -20,6 +20,12 @@
 #ifdef USE_SSL_SOCKET
 #include <string>
 
+#ifdef __WINDOWS__
+// NOTE: This must be included before the OpenSSL headers as it includes
+// `WinSock2.h` and `Windows.h` in the correct order.
+#include <stout/windows.hpp>
+#endif // __WINDOWS__
+
 #include <openssl/rsa.h>
 #include <openssl/bio.h>
 #include <openssl/x509.h>
diff --git a/3rdparty/libprocess/include/process/ssl/tls_config.hpp b/3rdparty/libprocess/include/process/ssl/tls_config.hpp
index 18c51a8..c4281ae 100644
--- a/3rdparty/libprocess/include/process/ssl/tls_config.hpp
+++ b/3rdparty/libprocess/include/process/ssl/tls_config.hpp
@@ -15,6 +15,12 @@
 
 #ifdef USE_SSL_SOCKET
 
+#ifdef __WINDOWS__
+// NOTE: This must be included before the OpenSSL headers as it includes
+// `WinSock2.h` and `Windows.h` in the correct order.
+#include <stout/windows.hpp>
+#endif // __WINDOWS__
+
 #include <openssl/ssl.h>
 
 #include <stout/option.hpp>
diff --git a/3rdparty/libprocess/src/openssl.cpp b/3rdparty/libprocess/src/openssl.cpp
index 7dac99f..ec7d6e8 100644
--- a/3rdparty/libprocess/src/openssl.cpp
+++ b/3rdparty/libprocess/src/openssl.cpp
@@ -20,6 +20,12 @@
 #include <event2/event-config.h>
 #endif // USE_LIBEVENT
 
+#ifdef __WINDOWS__
+// NOTE: This must be included before the OpenSSL headers as it includes
+// `WinSock2.h` and `Windows.h` in the correct order.
+#include <stout/windows.hpp>
+#endif // __WINDOWS__
+
 #include <openssl/err.h>
 #include <openssl/rand.h>
 #include <openssl/ssl.h>
diff --git a/3rdparty/libprocess/src/ssl/utilities.cpp b/3rdparty/libprocess/src/ssl/utilities.cpp
index c4a8ab4..5b53b11 100644
--- a/3rdparty/libprocess/src/ssl/utilities.cpp
+++ b/3rdparty/libprocess/src/ssl/utilities.cpp
@@ -16,6 +16,12 @@
 #include <string>
 #include <vector>
 
+#ifdef __WINDOWS__
+// NOTE: This must be included before the OpenSSL headers as it includes
+// `WinSock2.h` and `Windows.h` in the correct order.
+#include <stout/windows.hpp>
+#endif // __WINDOWS__
+
 #include <openssl/err.h>
 #include <openssl/evp.h>
 #include <openssl/hmac.h>