[icinga-checkins] icinga.org: icinga2/master: Build fix for CentOS 5

git at icinga.org git at icinga.org
Mon Aug 8 15:27:32 CEST 2016


Module: icinga2
Branch: master
Commit: 231fd8d38b53dc7cb23bc25792ed993deba328a7
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=231fd8d38b53dc7cb23bc25792ed993deba328a7

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Mon Aug  8 15:27:16 2016 +0200

Build fix for CentOS 5

refs #11292

---

 lib/base/tlsutility.cpp    |    9 +++++++--
 lib/remote/apilistener.cpp |   14 +++++++++++---
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/lib/base/tlsutility.cpp b/lib/base/tlsutility.cpp
index 057fc18..fc31d39 100644
--- a/lib/base/tlsutility.cpp
+++ b/lib/base/tlsutility.cpp
@@ -193,11 +193,16 @@ void SetTlsProtocolminToSSLContext(const boost::shared_ptr<SSL_CTX>& context, co
 
 	flags |= SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3;
 
+#ifdef SSL_TXT_TLSV1_1
 	if (tlsProtocolmin == SSL_TXT_TLSV1_1)
 		flags |= SSL_OP_NO_TLSv1;
-	else if (tlsProtocolmin == SSL_TXT_TLSV1_2)
+	else
+#elif defined(SSL_TXT_TLSV1_2)
+	if (tlsProtocolmin == SSL_TXT_TLSV1_2)
 		flags |= SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1;
-	else if (tlsProtocolmin != SSL_TXT_TLSV1)
+	else
+#endif /* SSL_TXT_TLSV1_2 */
+	if (tlsProtocolmin != SSL_TXT_TLSV1)
 		BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid TLS protocol version specified."));
 
 	SSL_CTX_set_options(context.get(), flags);
diff --git a/lib/remote/apilistener.cpp b/lib/remote/apilistener.cpp
index 007cfb9..424c630 100644
--- a/lib/remote/apilistener.cpp
+++ b/lib/remote/apilistener.cpp
@@ -1184,10 +1184,18 @@ void ApiListener::ValidateTlsProtocolmin(const String& value, const ValidationUt
 {
 	ObjectImpl<ApiListener>::ValidateTlsProtocolmin(value, utils);
 
-	if (value != SSL_TXT_TLSV1 && value != SSL_TXT_TLSV1_1 &&
-	    value != SSL_TXT_TLSV1_2) {
+	if (value != SSL_TXT_TLSV1
+#ifdef SSL_TXT_TLSV1_1
+	    && value != SSL_TXT_TLSV1_1 &&
+	    value != SSL_TXT_TLSV1_2
+#endif /* SSL_TXT_TLSV1_1 */
+	    ) {
 		BOOST_THROW_EXCEPTION(ValidationError(this, boost::assign::list_of("tls_protocolmin"), "Invalid TLS version. "
-		    "Must be one of '" SSL_TXT_TLSV1 "', '" SSL_TXT_TLSV1_1 "' or '" SSL_TXT_TLSV1_2 "'"));
+		    "Must be one of '" SSL_TXT_TLSV1 "'"
+#ifdef SSL_TXT_TLSV1_1
+		    ", '" SSL_TXT_TLSV1_1 "' or '" SSL_TXT_TLSV1_2 "'"
+#endif /* SSL_TXT_TLSV1_1 */
+		    ));
 	}
 }
 



More information about the icinga-checkins mailing list