activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r944034 - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp
Date Thu, 13 May 2010 22:24:36 GMT
Author: tabish
Date: Thu May 13 22:24:36 2010
New Revision: 944034

URL: http://svn.apache.org/viewvc?rev=944034&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQCPP-140

Make sure all the OpenSSL Api calls are ifdef'd out when not supported.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp?rev=944034&r1=944033&r2=944034&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp
Thu May 13 22:24:36 2010
@@ -136,6 +136,7 @@ void OpenSSLSocket::connect( const std::
 
     try{
 
+#ifdef HAVE_OPENSSL
         SSLSocket::connect( host, port, timeout );
         if( isConnected() ) {
 
@@ -177,6 +178,9 @@ void OpenSSLSocket::connect( const std::
                     throw OpenSSLSocketException( __FILE__, __LINE__ );
             }
         }
+#else
+        throw SocketException( __FILE__, __LINE__, "Not Supported" );
+#endif
     }
     DECAF_CATCH_RETHROW( IOException )
     DECAF_CATCH_RETHROW( IllegalArgumentException )
@@ -358,6 +362,7 @@ int OpenSSLSocket::read( unsigned char* 
                 __FILE__, __LINE__, "length parameter out of Bounds: %d.", length );
         }
 
+#ifdef HAVE_OPENSSL
         // Read data from the socket.
         int result = SSL_read( this->data->ssl, buffer + offset, length );
 
@@ -372,6 +377,9 @@ int OpenSSLSocket::read( unsigned char* 
             default:
                 throw OpenSSLSocketException( __FILE__, __LINE__ );
         }
+#else
+        throw SocketException( __FILE__, __LINE__, "Not Supported" );
+#endif
     }
     DECAF_CATCH_RETHROW( IOException )
     DECAF_CATCH_RETHROW( NullPointerException )
@@ -415,6 +423,7 @@ void OpenSSLSocket::write( const unsigne
                 __FILE__, __LINE__, "length parameter out of Bounds: %d.", length );
         }
 
+#ifdef HAVE_OPENSSL
         int remaining = length;
 
         while( remaining > 0 && !isClosed() ) {
@@ -434,6 +443,9 @@ void OpenSSLSocket::write( const unsigne
                     throw OpenSSLSocketException( __FILE__, __LINE__ );
             }
         }
+#else
+        throw SocketException( __FILE__, __LINE__, "Not Supported" );
+#endif
     }
     DECAF_CATCH_RETHROW( IOException )
     DECAF_CATCH_RETHROW( NullPointerException )
@@ -446,9 +458,13 @@ int OpenSSLSocket::available() {
 
     try{
 
+#ifdef HAVE_OPENSSL
         if( !isClosed() ) {
             return SSL_pending( this->data->ssl );
         }
+#else
+        throw SocketException( __FILE__, __LINE__, "Not Supported" );
+#endif
 
         return -1;
     }
@@ -459,6 +475,7 @@ int OpenSSLSocket::available() {
 ////////////////////////////////////////////////////////////////////////////////
 void OpenSSLSocket::verifyServerCert( const std::string& serverName ) {
 
+#ifdef HAVE_OPENSSL
     X509* cert = SSL_get_peer_certificate( this->data->ssl );
 
     if( cert == NULL ) {
@@ -537,4 +554,5 @@ void OpenSSLSocket::verifyServerCert( co
     // We got here so no match to serverName in the Certificate
     throw OpenSSLSocketException(
         __FILE__, __LINE__, "Server Certificate Name doesn't match the URI Host Name value."
);
+#endif
 }



Mime
View raw message