Build fix for CentOS 5

refs #11292
This commit is contained in:
Gunnar Beutner 2016-08-08 15:27:16 +02:00
parent 98a97026f4
commit 231fd8d38b
2 changed files with 18 additions and 5 deletions

View File

@ -193,11 +193,16 @@ void SetTlsProtocolminToSSLContext(const boost::shared_ptr<SSL_CTX>& context, co
flags |= SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3; flags |= SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3;
#ifdef SSL_TXT_TLSV1_1
if (tlsProtocolmin == SSL_TXT_TLSV1_1) if (tlsProtocolmin == SSL_TXT_TLSV1_1)
flags |= SSL_OP_NO_TLSv1; 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; 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.")); BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid TLS protocol version specified."));
SSL_CTX_set_options(context.get(), flags); SSL_CTX_set_options(context.get(), flags);

View File

@ -1184,10 +1184,18 @@ void ApiListener::ValidateTlsProtocolmin(const String& value, const ValidationUt
{ {
ObjectImpl<ApiListener>::ValidateTlsProtocolmin(value, utils); ObjectImpl<ApiListener>::ValidateTlsProtocolmin(value, utils);
if (value != SSL_TXT_TLSV1 && value != SSL_TXT_TLSV1_1 && if (value != SSL_TXT_TLSV1
value != SSL_TXT_TLSV1_2) { #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. " 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 */
));
} }
} }