summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/SslConfig.cpp96
-rw-r--r--cpp/src/Ice/SslConfigErrorReporter.cpp9
-rw-r--r--cpp/src/Ice/SslConfigErrorReporter.h15
-rw-r--r--cpp/src/Ice/SslConnectionOpenSSL.cpp250
-rw-r--r--cpp/src/Ice/SslConnectionOpenSSL.h5
-rw-r--r--cpp/src/Ice/SslConnectionOpenSSLClient.cpp5
-rw-r--r--cpp/src/Ice/SslConnectionOpenSSLServer.cpp3
-rw-r--r--cpp/src/Ice/SslContextOpenSSL.cpp3
-rw-r--r--cpp/src/Ice/ice.dsp58
9 files changed, 260 insertions, 184 deletions
diff --git a/cpp/src/Ice/SslConfig.cpp b/cpp/src/Ice/SslConfig.cpp
index 6f076a774ab..2c979f9b287 100644
--- a/cpp/src/Ice/SslConfig.cpp
+++ b/cpp/src/Ice/SslConfig.cpp
@@ -74,7 +74,7 @@ IceSSL::Parser::process()
ConfigParseException configEx(__FILE__, __LINE__);
ostringstream s;
- s << "While parsing " << _configFile << flush;
+ s << "While parsing " << _configFile << ": " << endl;
s << "Xerces-c Init Exception: " << DOMString(toCatch.getMessage());
configEx._message = s.str();
@@ -84,7 +84,7 @@ IceSSL::Parser::process()
int errorCount = 0;
- ErrorReporter* errReporter = new ErrorReporter(_traceLevels, _logger);
+ ErrorReporterPtr errReporter = new ErrorReporter(_traceLevels, _logger);
assert(errReporter != 0);
// Create our parser, then attach an error handler to the parser.
@@ -96,7 +96,7 @@ IceSSL::Parser::process()
parser.setDoSchema(false);
parser.setCreateEntityReferenceNodes(false);
parser.setToCreateXMLDeclTypeNode(true);
- parser.setErrorHandler(errReporter);
+ parser.setErrorHandler(errReporter.get());
try
{
@@ -137,16 +137,11 @@ IceSSL::Parser::process()
}
}
catch (const XMLException& e)
- {
- if (errReporter != 0)
- {
- delete errReporter;
- }
-
+ {
ConfigParseException configEx(__FILE__, __LINE__);
ostringstream s;
- s << "While parsing " << _configFile << flush;
+ s << "While parsing " << _configFile << ": " << endl;
s << "Xerces-c Parsing Error: " << DOMString(e.getMessage());
configEx._message = s.str();
@@ -155,15 +150,10 @@ IceSSL::Parser::process()
}
catch (const DOM_DOMException& e)
{
- if (errReporter != 0)
- {
- delete errReporter;
- }
-
ConfigParseException configEx(__FILE__, __LINE__);
ostringstream s;
- s << "While parsing " << _configFile << flush;
+ s << "While parsing " << _configFile << ": " << endl;
s << "Xerces-c DOM Parsing Error, DOMException code: " << e.code;
s << ", message: " << e.msg;
@@ -173,11 +163,6 @@ IceSSL::Parser::process()
}
catch (...)
{
- if (errReporter != 0)
- {
- delete errReporter;
- }
-
ConfigParseException configEx(__FILE__, __LINE__);
configEx._message = "While parsing " + _configFile + "\n" + "An unknown error occured during parsing.";
@@ -185,11 +170,6 @@ IceSSL::Parser::process()
throw configEx;
}
- if (errReporter != 0)
- {
- delete errReporter;
- }
-
if (errorCount)
{
ConfigParseException configEx(__FILE__, __LINE__);
@@ -210,15 +190,31 @@ IceSSL::Parser::loadClientConfig(GeneralConfig& general, CertificateAuthority& c
bool retCode = false;
string clientSectionString("SSLConfig:client");
DOM_Node clientSection = find(clientSectionString);
-
- // If we actually have a client section.
- if (clientSection != 0)
+
+ try
{
- getGeneral(clientSection, general);
- getCertAuth(clientSection, certAuth);
- getBaseCerts(clientSection, baseCerts);
- retCode = true;
+ // If we actually have a client section.
+ if (clientSection != 0)
+ {
+ getGeneral(clientSection, general);
+ getCertAuth(clientSection, certAuth);
+ getBaseCerts(clientSection, baseCerts);
+ retCode = true;
+ }
}
+ catch (const DOM_DOMException& e)
+ {
+ ConfigParseException configEx(__FILE__, __LINE__);
+
+ ostringstream s;
+ s << "While loading Client configuration: " << endl;
+ s << "Xerces-c DOM Parsing Error, DOMException code: " << e.code;
+ s << ", message: " << e.msg;
+
+ configEx._message = s.str();
+
+ throw configEx;
+ }
return retCode;
}
@@ -233,15 +229,31 @@ IceSSL::Parser::loadServerConfig(GeneralConfig& general,
string serverSectionString("SSLConfig:server");
DOM_Node serverSection = find(serverSectionString);
- // If we actually have a client section.
- if (serverSection != 0)
- {
- getGeneral(serverSection, general);
- getCertAuth(serverSection, certAuth);
- getBaseCerts(serverSection, baseCerts);
- getTempCerts(serverSection, tempCerts);
- retCode = true;
- }
+ try
+ {
+ // If we actually have a client section.
+ if (serverSection != 0)
+ {
+ getGeneral(serverSection, general);
+ getCertAuth(serverSection, certAuth);
+ getBaseCerts(serverSection, baseCerts);
+ getTempCerts(serverSection, tempCerts);
+ retCode = true;
+ }
+ }
+ catch (const DOM_DOMException& e)
+ {
+ ConfigParseException configEx(__FILE__, __LINE__);
+
+ ostringstream s;
+ s << "While loading Server configuration " << endl;
+ s << "Xerces-c DOM Parsing Error, DOMException code: " << e.code;
+ s << ", message: " << e.msg;
+
+ configEx._message = s.str();
+
+ throw configEx;
+ }
return retCode;
}
diff --git a/cpp/src/Ice/SslConfigErrorReporter.cpp b/cpp/src/Ice/SslConfigErrorReporter.cpp
index da605e7d8e7..9a73f92a360 100644
--- a/cpp/src/Ice/SslConfigErrorReporter.cpp
+++ b/cpp/src/Ice/SslConfigErrorReporter.cpp
@@ -21,6 +21,9 @@
using namespace std;
+void ::IceInternal::incRef(::IceSSL::ErrorReporter* p) { p->__incRef(); }
+void ::IceInternal::decRef(::IceSSL::ErrorReporter* p) { p->__decRef(); }
+
void
IceSSL::ErrorReporter::warning(const SAXParseException& toCatch)
{
@@ -28,7 +31,7 @@ IceSSL::ErrorReporter::warning(const SAXParseException& toCatch)
{
ostringstream s;
- s << "SSL configuration file parse warning.\n" << flush;
+ s << "SSL configuration file parse warning." << endl;
s << "Xerces-c Init Exception: Warning at file \"" << flush;
s << DOMString(toCatch.getSystemId()) << flush;
s << "\", line " << toCatch.getLineNumber() << flush;
@@ -48,7 +51,7 @@ IceSSL::ErrorReporter::error(const SAXParseException& toCatch)
{
ostringstream s;
- s << "SSL configuration file parse error.\n" << flush;
+ s << "SSL configuration file parse error." << endl;
s << "Xerces-c Init Exception: Error at file \"" << flush;
s << DOMString(toCatch.getSystemId()) << flush;
s << "\", line " << toCatch.getLineNumber() << flush;
@@ -68,7 +71,7 @@ IceSSL::ErrorReporter::fatalError(const SAXParseException& toCatch)
{
ostringstream s;
- s << "SSL configuration file parse error.\n" << flush;
+ s << "SSL configuration file parse error." << endl;
s << "Xerces-c Init Exception: Fatal error at file \"" << flush;
s << DOMString(toCatch.getSystemId()) << flush;
s << "\", line " << toCatch.getLineNumber() << flush;
diff --git a/cpp/src/Ice/SslConfigErrorReporter.h b/cpp/src/Ice/SslConfigErrorReporter.h
index 2f4836d4d8c..6066e77a3ef 100644
--- a/cpp/src/Ice/SslConfigErrorReporter.h
+++ b/cpp/src/Ice/SslConfigErrorReporter.h
@@ -11,7 +11,8 @@
#ifndef ICE_SSL_CONFIG_ERROR_REPORTER_H
#define ICE_SSL_CONFIG_ERROR_REPORTER_H
-#include <iostream>
+#include <iostream>
+#include <IceUtil/Shared.h>
#include <util/XercesDefs.hpp>
#include <dom/DOMString.hpp>
#include <sax/ErrorHandler.hpp>
@@ -21,7 +22,7 @@
namespace IceSSL
{
-class ErrorReporter : public ErrorHandler
+class ErrorReporter : public ErrorHandler, public IceUtil::Shared
{
public:
@@ -51,9 +52,19 @@ private:
IceInternal::TraceLevelsPtr _traceLevels;
Ice::LoggerPtr _logger;
};
+
+typedef IceInternal::Handle<ErrorReporter> ErrorReporterPtr;
std::ostream& operator << (std::ostream& target, const DOMString& s);
}
+namespace IceInternal
+{
+
+void incRef(::IceSSL::ErrorReporter*);
+void decRef(::IceSSL::ErrorReporter*);
+
+}
+
#endif
diff --git a/cpp/src/Ice/SslConnectionOpenSSL.cpp b/cpp/src/Ice/SslConnectionOpenSSL.cpp
index 26ec74d9c7c..ac65eeb1c23 100644
--- a/cpp/src/Ice/SslConnectionOpenSSL.cpp
+++ b/cpp/src/Ice/SslConnectionOpenSSL.cpp
@@ -20,7 +20,7 @@
#include <openssl/err.h>
#include <string>
#include <sstream>
-#include <Ice/Network.h>
+#include <Ice/Network.h>
#include <Ice/OpenSSL.h>
#include <Ice/SecurityException.h>
#include <Ice/SslFactory.h>
@@ -158,6 +158,12 @@ IceSSL::OpenSSL::Connection::getConnection(SSL* sslPtr)
return ConnectionPtr(connection);
}
+//
+// Note: Do not throw exceptions from verifyCertificate - it would rip through the OpenSSL system,
+// interfering with the usual handling and alert system of the handshake. Exceptions should
+// be caught here (if they can be generated), logged and then a fail return code (0) should
+// returned.
+//
int
IceSSL::OpenSSL::Connection::verifyCertificate(int preVerifyOkay, X509_STORE_CTX* x509StoreContext)
{
@@ -207,6 +213,8 @@ IceSSL::OpenSSL::Connection::verifyCertificate(int preVerifyOkay, X509_STORE_CTX
int
IceSSL::OpenSSL::Connection::connect()
{
+ assert(_sslConnection != 0);
+
int result = SSL_connect(_sslConnection);
setLastError(result);
@@ -217,16 +225,20 @@ IceSSL::OpenSSL::Connection::connect()
int
IceSSL::OpenSSL::Connection::accept()
{
+ assert(_sslConnection != 0);
+
int result = SSL_accept(_sslConnection);
setLastError(result);
return result;
}
-
+
+// NOTE: Currently not used, maybe later.
int
IceSSL::OpenSSL::Connection::renegotiate()
{
+ assert(_sslConnection != 0);
return SSL_renegotiate(_sslConnection);
}
@@ -277,18 +289,22 @@ IceSSL::OpenSSL::Connection::initialize(int timeout)
int
IceSSL::OpenSSL::Connection::pending()
{
+ assert(_sslConnection != 0);
return SSL_pending(_sslConnection);
}
int
IceSSL::OpenSSL::Connection::getLastError() const
{
+ assert(_sslConnection != 0);
return SSL_get_error(_sslConnection, _lastError);
}
int
IceSSL::OpenSSL::Connection::sslRead(char* buffer, int bufferSize)
{
+ assert(_sslConnection != 0);
+
int bytesRead = SSL_read(_sslConnection, buffer, bufferSize);
setLastError(bytesRead);
@@ -299,6 +315,8 @@ IceSSL::OpenSSL::Connection::sslRead(char* buffer, int bufferSize)
int
IceSSL::OpenSSL::Connection::sslWrite(char* buffer, int bufferSize)
{
+ assert(_sslConnection != 0);
+
int bytesWritten = SSL_write(_sslConnection, buffer, bufferSize);
setLastError(bytesWritten);
@@ -314,7 +332,8 @@ IceSSL::OpenSSL::Connection::sslWrite(char* buffer, int bufferSize)
// of our defined methods. The SSL_write() will end up only writing protocol handshake
// packets, not application packets. This looks wierd, but it is essentially what
// the demo programs are doing, so I feel okay copying them. The only reason that I
-// have defined the buffer[] array is so that I have a valid buffer pointer.
+// have defined the buffer[] array is so that I have a valid buffer pointer.
+/*
void
IceSSL::OpenSSL::Connection::protocolWrite()
{
@@ -326,7 +345,8 @@ IceSSL::OpenSSL::Connection::protocolWrite()
// not the write(Buffer&,int) method. If things start acting
// strangely, check this!
sslWrite(buffer,0);
-}
+}
+*/
int
IceSSL::OpenSSL::Connection::readInBuffer(Buffer& buf)
@@ -367,98 +387,80 @@ IceSSL::OpenSSL::Connection::readInBuffer(Buffer& buf)
}
return bytesRead;
+}
+
+int
+IceSSL::OpenSSL::Connection::select(int timeout, bool write)
+{
+ int ret;
+
+ assert(_sslConnection != 0);
+ SOCKET fd = SSL_get_fd(_sslConnection);
+
+ fd_set rwFdSet;
+ struct timeval tv;
+
+ if (timeout >= 0)
+ {
+ tv.tv_sec = timeout / 1000;
+ tv.tv_usec = (timeout - tv.tv_sec * 1000) * 1000;
+ }
+
+ do
+ {
+ FD_ZERO(&rwFdSet);
+ FD_SET(fd, &rwFdSet);
+
+ if (timeout >= 0)
+ {
+ if (write)
+ {
+ ret = ::select(fd + 1, 0, &rwFdSet, 0, &tv);
+ }
+ else
+ {
+ ret = ::select(fd + 1, &rwFdSet, 0, 0, &tv);
+ }
+ }
+ else
+ {
+ if (write)
+ {
+ ret = ::select(fd + 1, 0, &rwFdSet, 0, 0);
+ }
+ else
+ {
+ ret = ::select(fd + 1, &rwFdSet, 0, 0, 0);
+ }
+ }
+ }
+ while (ret == SOCKET_ERROR && interrupted());
+
+ if (ret == SOCKET_ERROR)
+ {
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+
+ if (ret == 0)
+ {
+ throw TimeoutException(__FILE__, __LINE__);
+ }
+
+ return FD_ISSET(fd, &rwFdSet);
}
int
IceSSL::OpenSSL::Connection::readSelect(int timeout)
{
- int ret;
- SOCKET fd = SSL_get_fd(_sslConnection);
- fd_set rFdSet;
-
- struct timeval tv;
-
- if (timeout >= 0)
- {
- tv.tv_sec = timeout / 1000;
- tv.tv_usec = (timeout - tv.tv_sec * 1000) * 1000;
- }
-
- do
- {
- FD_ZERO(&rFdSet);
- FD_SET(fd, &rFdSet);
-
- if (timeout >= 0)
- {
- ret = ::select(fd + 1, &rFdSet, 0, 0, &tv);
- }
- else
- {
- ret = ::select(fd + 1, &rFdSet, 0, 0, 0);
- }
- }
- while (ret == SOCKET_ERROR && interrupted());
-
- if (ret == SOCKET_ERROR)
- {
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
-
- if (ret == 0)
- {
- throw TimeoutException(__FILE__, __LINE__);
- }
-
- return FD_ISSET(fd, &rFdSet);
+ return select(timeout, false);
}
int
IceSSL::OpenSSL::Connection::writeSelect(int timeout)
-{
- int ret;
- SOCKET fd = SSL_get_fd(_sslConnection);
- fd_set wFdSet;
-
- struct timeval tv;
-
- if (timeout >= 0)
- {
- tv.tv_sec = timeout / 1000;
- tv.tv_usec = (timeout - tv.tv_sec * 1000) * 1000;
- }
-
- do
- {
- FD_ZERO(&wFdSet);
- FD_SET(fd, &wFdSet);
-
- if (timeout >= 0)
- {
- ret = ::select(fd + 1, 0, &wFdSet, 0, &tv);
- }
- else
- {
- ret = ::select(fd + 1, 0, &wFdSet, 0, 0);
- }
- }
- while (ret == SOCKET_ERROR && interrupted());
-
- if (ret == SOCKET_ERROR)
- {
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
-
- if (ret == 0)
- {
- throw TimeoutException(__FILE__, __LINE__);
- }
-
- return FD_ISSET(fd, &wFdSet);
+{
+ return select(timeout, true);
}
int
@@ -480,7 +482,6 @@ IceSSL::OpenSSL::Connection::readSSL(Buffer& buf, int timeout)
if (initReturn == -1)
{
// Handshake underway, timeout immediately, easy way to deal with this.
- // _logger->trace(_traceLevels->securityCat, "Throwing TimeoutException, Line 566");
throw TimeoutException(__FILE__, __LINE__);
}
@@ -542,12 +543,14 @@ IceSSL::OpenSSL::Connection::readSSL(Buffer& buf, int timeout)
case SSL_ERROR_WANT_WRITE:
{
+ // TODO: This can most likely be removed.
+
// If we get this error here, it HAS to be because the protocol wants
// to do something handshake related. As such, We're going to call
// write with an empty buffer. I've seen this done in the demo
// programs, so this should be valid. No actual application data
// will be sent, just protocol packets.
- protocolWrite();
+ // protocolWrite();
continue;
}
@@ -631,50 +634,7 @@ IceSSL::OpenSSL::Connection::readSSL(Buffer& buf, int timeout)
return totalBytesRead;
}
-
-string
-IceSSL::OpenSSL::Connection::sslGetErrors()
-{
- string errorMessage;
- char buf[200];
- char bigBuffer[1024];
- const char* file = 0;
- const char* data = 0;
- int line = 0;
- int flags = 0;
- unsigned errorCode = 0;
- int errorNum = 1;
-
- unsigned long es = CRYPTO_thread_id();
-
- while ((errorCode = ERR_get_error_line_data(&file, &line, &data, &flags)) != 0)
- {
- sprintf(bigBuffer,"%6d - Thread ID: %lu\n", errorNum, es);
- errorMessage += bigBuffer;
-
- sprintf(bigBuffer,"%6d - Error: %u\n", errorNum, errorCode);
- errorMessage += bigBuffer;
-
- // Request an error from the OpenSSL library
- ERR_error_string_n(errorCode, buf, sizeof(buf));
- sprintf(bigBuffer,"%6d - Message: %s\n", errorNum, buf);
- errorMessage += bigBuffer;
-
- sprintf(bigBuffer,"%6d - Location: %s, %d\n", errorNum, file, line);
- errorMessage += bigBuffer;
-
- if (flags & ERR_TXT_STRING)
- {
- sprintf(bigBuffer,"%6d - Data: %s\n", errorNum, data);
- errorMessage += bigBuffer;
- }
-
- errorNum++;
- }
-
- return errorMessage;
-}
-
+
void
IceSSL::OpenSSL::Connection::addConnection(SSL* sslPtr, Connection* connection)
{
@@ -694,7 +654,10 @@ IceSSL::OpenSSL::Connection::removeConnection(SSL* sslPtr)
void
IceSSL::OpenSSL::Connection::showCertificateChain(BIO* bio)
-{
+{
+ assert(_sslConnection != 0);
+ assert(bio != 0);
+
STACK_OF(X509)* sk;
// Big nasty buffer
@@ -724,6 +687,9 @@ IceSSL::OpenSSL::Connection::showCertificateChain(BIO* bio)
void
IceSSL::OpenSSL::Connection::showPeerCertificate(BIO* bio, const char* connType)
{
+ assert(_sslConnection != 0);
+ assert(bio != 0);
+
X509* peerCert = 0;
char buffer[4096];
@@ -754,6 +720,9 @@ IceSSL::OpenSSL::Connection::showPeerCertificate(BIO* bio, const char* connType)
void
IceSSL::OpenSSL::Connection::showSharedCiphers(BIO* bio)
{
+ assert(_sslConnection != 0);
+ assert(bio != 0);
+
char buffer[4096];
char* strpointer = 0;
@@ -794,6 +763,9 @@ IceSSL::OpenSSL::Connection::showSharedCiphers(BIO* bio)
void
IceSSL::OpenSSL::Connection::showSessionInfo(BIO* bio)
{
+ assert(_sslConnection != 0);
+ assert(bio != 0);
+
if (_sslConnection->hit)
{
BIO_printf(bio, "Reused session-id\n");
@@ -805,6 +777,9 @@ IceSSL::OpenSSL::Connection::showSessionInfo(BIO* bio)
void
IceSSL::OpenSSL::Connection::showSelectedCipherInfo(BIO* bio)
{
+ assert(_sslConnection != 0);
+ assert(bio != 0);
+
const char* str;
SSL_CIPHER* cipher;
@@ -821,6 +796,9 @@ IceSSL::OpenSSL::Connection::showSelectedCipherInfo(BIO* bio)
void
IceSSL::OpenSSL::Connection::showHandshakeStats(BIO* bio)
{
+ assert(_sslConnection != 0);
+ assert(bio != 0);
+
BIO_printf(bio, "---\nSSL handshake has read %ld bytes and written %ld bytes\n",
BIO_number_read(SSL_get_rbio(_sslConnection)),
BIO_number_written(SSL_get_wbio(_sslConnection)));
@@ -829,6 +807,10 @@ IceSSL::OpenSSL::Connection::showHandshakeStats(BIO* bio)
void
IceSSL::OpenSSL::Connection::showClientCAList(BIO* bio, const char* connType)
{
+ assert(_sslConnection != 0);
+ assert(bio != 0);
+ assert(connType != 0);
+
char buffer[4096];
STACK_OF(X509_NAME)* sk = SSL_get_client_CA_list(_sslConnection);
diff --git a/cpp/src/Ice/SslConnectionOpenSSL.h b/cpp/src/Ice/SslConnectionOpenSSL.h
index d82fa73789f..4e60d2c386c 100644
--- a/cpp/src/Ice/SslConnectionOpenSSL.h
+++ b/cpp/src/Ice/SslConnectionOpenSSL.h
@@ -149,17 +149,18 @@ protected:
int sslRead(char*, int);
int sslWrite(char*, int);
- void protocolWrite();
+// void protocolWrite();
int readInBuffer(IceInternal::Buffer&);
+ int select(int, bool);
int readSelect(int);
int writeSelect(int);
int readSSL(IceInternal::Buffer&, int);
// Retrieves errors from the OpenSSL library.
- std::string sslGetErrors();
+// std::string sslGetErrors();
static void addConnection(SSL*, Connection*);
static void removeConnection(SSL*);
diff --git a/cpp/src/Ice/SslConnectionOpenSSLClient.cpp b/cpp/src/Ice/SslConnectionOpenSSLClient.cpp
index f564d8ffd69..eb2b70af6cf 100644
--- a/cpp/src/Ice/SslConnectionOpenSSLClient.cpp
+++ b/cpp/src/Ice/SslConnectionOpenSSLClient.cpp
@@ -10,6 +10,7 @@
#include <string>
#include <sstream>
+#include <Ice/SslOpenSSLUtils.h>
#include <Ice/Network.h>
#include <Ice/OpenSSL.h>
#include <Ice/SecurityException.h>
@@ -52,6 +53,8 @@ IceSSL::OpenSSL::ClientConnection::ClientConnection(
const IceSSL::SystemInternalPtr& system) :
Connection(traceLevels, logger, certificateVerifier, connection, system)
{
+ assert(_sslConnection != 0);
+
// Set the Connect Connection state for this connection.
SSL_set_connect_state(_sslConnection);
}
@@ -69,6 +72,8 @@ IceSSL::OpenSSL::ClientConnection::shutdown()
int
IceSSL::OpenSSL::ClientConnection::init(int timeout)
{
+ assert(_sslConnection != 0);
+
int retCode = SSL_is_init_finished(_sslConnection);
while (!retCode)
diff --git a/cpp/src/Ice/SslConnectionOpenSSLServer.cpp b/cpp/src/Ice/SslConnectionOpenSSLServer.cpp
index 07f16c809a1..1dcea25d049 100644
--- a/cpp/src/Ice/SslConnectionOpenSSLServer.cpp
+++ b/cpp/src/Ice/SslConnectionOpenSSLServer.cpp
@@ -9,7 +9,8 @@
// **********************************************************************
#include <string>
-#include <sstream>
+#include <sstream>
+#include <Ice/SslOpenSSLUtils.h>
#include <Ice/Network.h>
#include <Ice/OpenSSL.h>
#include <Ice/SecurityException.h>
diff --git a/cpp/src/Ice/SslContextOpenSSL.cpp b/cpp/src/Ice/SslContextOpenSSL.cpp
index 76f78a2490e..6366c10a5b2 100644
--- a/cpp/src/Ice/SslContextOpenSSL.cpp
+++ b/cpp/src/Ice/SslContextOpenSSL.cpp
@@ -24,6 +24,9 @@
using IceSSL::ConnectionPtr;
+void ::IceInternal::incRef(::IceSSL::OpenSSL::Context* p) { p->__incRef(); }
+void ::IceInternal::decRef(::IceSSL::OpenSSL::Context* p) { p->__decRef(); }
+
IceSSL::OpenSSL::Context::~Context()
{
if (_sslContext != 0)
diff --git a/cpp/src/Ice/ice.dsp b/cpp/src/Ice/ice.dsp
index 5a4764fae8f..f1082b469a6 100644
--- a/cpp/src/Ice/ice.dsp
+++ b/cpp/src/Ice/ice.dsp
@@ -2156,6 +2156,23 @@ SOURCE=..\..\slice\Ice\SslExtension.ice
!IF "$(CFG)" == "Ice - Win32 Release"
+USERDEP__SSLEX="../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=..\..\slice\Ice\SslExtension.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\lib \
+ ..\..\bin\slice2cpp.exe --dll-export ICE_API --include-dir Ice -I../../slice ../../slice/Ice/SslExtension.ice \
+ move SslExtension.h ..\..\include\Ice \
+
+
+"..\..\include\Ice\SslExtension.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"SslExtension.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
!ELSEIF "$(CFG)" == "Ice - Win32 Debug"
USERDEP__SSLEX="../../bin/slice2cpp.exe"
@@ -2184,6 +2201,18 @@ SOURCE=..\..\slice\Ice\SslExtensionF.ice
!IF "$(CFG)" == "Ice - Win32 Release"
+USERDEP__SSLEXT="../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=..\..\slice\Ice\SslExtensionF.ice
+
+"..\..\include\Ice\SslExtensionF.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ set PATH=%PATH%;..\..\lib
+ ..\..\bin\slice2cpp.exe --dll-export ICE_API --include-dir Ice -I../../slice ../../slice/Ice/SslExtensionF.ice
+ move SslExtensionF.h ..\..\include\Ice
+ del SslExtensionF.cpp
+
+# End Custom Build
+
!ELSEIF "$(CFG)" == "Ice - Win32 Debug"
USERDEP__SSLEXT="../../bin/slice2cpp.exe"
@@ -2207,6 +2236,23 @@ SOURCE=..\..\slice\Ice\SslSystem.ice
!IF "$(CFG)" == "Ice - Win32 Release"
+USERDEP__SSLSY="../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=..\..\slice\Ice\SslSystem.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\lib \
+ ..\..\bin\slice2cpp.exe --dll-export ICE_API --include-dir Ice -I../../slice ../../slice/Ice/SslSystem.ice \
+ move SslSystem.h ..\..\include\Ice \
+
+
+"..\..\include\Ice\SslSystem.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"SslSystem.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
!ELSEIF "$(CFG)" == "Ice - Win32 Debug"
USERDEP__SSLSY="../../bin/slice2cpp.exe"
@@ -2235,6 +2281,18 @@ SOURCE=..\..\slice\Ice\SslSystemF.ice
!IF "$(CFG)" == "Ice - Win32 Release"
+USERDEP__SSLSYS="../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=..\..\slice\Ice\SslSystemF.ice
+
+"..\..\include\Ice\SslSystemF.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ set PATH=%PATH%;..\..\lib
+ ..\..\bin\slice2cpp.exe --dll-export ICE_API --include-dir Ice -I../../slice ../../slice/Ice/SslSystemF.ice
+ move SslSystemF.h ..\..\include\Ice
+ del SslSystemF.cpp
+
+# End Custom Build
+
!ELSEIF "$(CFG)" == "Ice - Win32 Debug"
USERDEP__SSLSYS="../../bin/slice2cpp.exe"