From: Christos Tsantilas Date: Fri, 23 May 2014 15:29:40 +0000 (+0300) Subject: Fixes to allow compile with older openSSL versions X-Git-Tag: SQUID_3_5_0_1~89^2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4cabb5e5f8231891bffb54b50b2be9775949def1;p=thirdparty%2Fsquid.git Fixes to allow compile with older openSSL versions --- diff --git a/src/ssl/PeerConnector.cc b/src/ssl/PeerConnector.cc index 62dcad1f3e..72c3262ec2 100644 --- a/src/ssl/PeerConnector.cc +++ b/src/ssl/PeerConnector.cc @@ -145,8 +145,10 @@ Ssl::PeerConnector::initializeSsl() const Ssl::Bio::sslFeatures &features = clnBio->getFeatures(); if (features.sslVersion != -1) { SSL_set_ssl_method(ssl, Ssl::method(features.toSquidSSLVersion())); +#ifdef TLSEXT_NAMETYPE_host_name if (!features.serverName.empty()) SSL_set_tlsext_host_name(ssl, features.serverName.c_str()); +#endif if (!features.clientRequestedCiphers.empty()) SSL_set_cipher_list(ssl, features.clientRequestedCiphers.c_str()); #ifdef SSL_OP_NO_COMPRESSION /* XXX: OpenSSL 0.9.8k lacks SSL_OP_NO_COMPRESSION */ diff --git a/src/ssl/bio.cc b/src/ssl/bio.cc index 58c58a7cd3..75cee5a5c1 100644 --- a/src/ssl/bio.cc +++ b/src/ssl/bio.cc @@ -349,7 +349,9 @@ adjustSSL(SSL *ssl, Ssl::Bio::sslFeatures &features, bool force) for (std::list::iterator it = features.extensions.begin(); it != features.extensions.end(); ++it) { static int supportedExtensions[] = { +#ifdef TLSEXT_TYPE_server_name TLSEXT_TYPE_server_name, +#endif #ifdef TLSEXT_TYPE_opaque_prf_input TLSEXT_TYPE_opaque_prf_input, #endif @@ -413,7 +415,7 @@ adjustSSL(SSL *ssl, Ssl::Bio::sslFeatures &features, bool force) size_t mainHelloSize = features.helloMessage.contentSize() - 5; const char *mainHello = features.helloMessage.content() + 5; - assert(ssl->init_buf->max > mainHelloSize); + assert((size_t)ssl->init_buf->max > mainHelloSize); memcpy(ssl->init_buf->data, mainHello, mainHelloSize); debugs(83, 5, "Hello Data init and adjustd sizes :" << ssl->init_num << " = "<< mainHelloSize); ssl->init_num = mainHelloSize; @@ -652,9 +654,11 @@ Ssl::Bio::sslFeatures::get(const SSL *ssl) sslVersion = SSL_version(ssl); debugs(83, 7, "SSL version: " << SSL_get_version(ssl) << " (" << sslVersion << ")"); +#if defined(TLSEXT_NAMETYPE_host_name) if(const char *server = SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name)) serverName = server; debugs(83, 7, "SNI server name: " << serverName); +#endif if (ssl->session->compress_meth) compressMethod = ssl->session->compress_meth;