diff options
author | Anthony Neal <aneal@zeroc.com> | 2002-05-14 00:23:01 +0000 |
---|---|---|
committer | Anthony Neal <aneal@zeroc.com> | 2002-05-14 00:23:01 +0000 |
commit | 6728a6037d0542da5886976c0498e64db98c0d71 (patch) | |
tree | 3f2d7baf96ee8d13201b22ddcee6aa0976134477 /cpp/src/IceSSL/SslConnectionOpenSSLServer.cpp | |
parent | catch unknown exceptions from entry point (diff) | |
download | ice-6728a6037d0542da5886976c0498e64db98c0d71.tar.bz2 ice-6728a6037d0542da5886976c0498e64db98c0d71.tar.xz ice-6728a6037d0542da5886976c0498e64db98c0d71.zip |
Updated to fix a problem with SSL server shutdown.
Diffstat (limited to 'cpp/src/IceSSL/SslConnectionOpenSSLServer.cpp')
-rw-r--r-- | cpp/src/IceSSL/SslConnectionOpenSSLServer.cpp | 71 |
1 files changed, 30 insertions, 41 deletions
diff --git a/cpp/src/IceSSL/SslConnectionOpenSSLServer.cpp b/cpp/src/IceSSL/SslConnectionOpenSSLServer.cpp index 46d48cf833d..14bb5dc75e3 100644 --- a/cpp/src/IceSSL/SslConnectionOpenSSLServer.cpp +++ b/cpp/src/IceSSL/SslConnectionOpenSSLServer.cpp @@ -52,14 +52,8 @@ IceSSL::OpenSSL::ServerConnection::~ServerConnection() { } -void -IceSSL::OpenSSL::ServerConnection::shutdown() -{
- Connection::shutdown(); -} - int -IceSSL::OpenSSL::ServerConnection::init(int timeout) +IceSSL::OpenSSL::ServerConnection::handshake(int timeout) { assert(_sslConnection != 0); @@ -67,16 +61,15 @@ IceSSL::OpenSSL::ServerConnection::init(int timeout) while (!retCode) { - int i = 0; - _readTimeout = timeout > _handshakeReadTimeout ? timeout : _handshakeReadTimeout; if (_initWantWrite) { - i = writeSelect(timeout); + int i = writeSelect(timeout); if (i == 0) { + cerr << "-" << flush; return 0; } @@ -84,10 +77,11 @@ IceSSL::OpenSSL::ServerConnection::init(int timeout) } else { - i = readSelect(_readTimeout); + int i = readSelect(_readTimeout); if (i == 0) { + cerr << "-" << flush; return 0; } } @@ -102,19 +96,12 @@ IceSSL::OpenSSL::ServerConnection::init(int timeout) if (verifyError != X509_V_OK) { - CertificateVerificationException certVerEx(__FILE__, __LINE__); - - certVerEx._message = "ssl certificate verification error"; - - string errors = sslGetErrors(); + // Flag the connection for shutdown, let the + // usual initialization take care of it. - if (!errors.empty()) - { - certVerEx._message += "\n"; - certVerEx._message += errors; - } + _phase = Shutdown; - throw certVerEx; + return 0; } else { @@ -169,15 +156,17 @@ IceSSL::OpenSSL::ServerConnection::init(int timeout) ex.error = getSocketErrno(); throw ex; } - else - { - SocketException ex(__FILE__, __LINE__); - ex.error = getSocketErrno(); - throw ex; - } + + SocketException ex(__FILE__, __LINE__); + ex.error = getSocketErrno(); + throw ex; } else { + // + // NOTE: Should this be ConnectFailedException like in the Client? + // + ProtocolException protocolEx(__FILE__, __LINE__); // Protocol Error: Unexpected EOF @@ -197,19 +186,21 @@ IceSSL::OpenSSL::ServerConnection::init(int timeout) throw protocolEx; } -
- case SSL_ERROR_ZERO_RETURN:
- {
- ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
+ + case SSL_ERROR_ZERO_RETURN: + { + ConnectionLostException ex(__FILE__, __LINE__); + ex.error = getSocketErrno(); + throw ex; + } } retCode = SSL_is_init_finished(_sslConnection); if (retCode > 0) { + _phase = Connected; + // Init finished, look at the connection information. showConnectionInfo(); } @@ -309,12 +300,10 @@ IceSSL::OpenSSL::ServerConnection::write(Buffer& buf, int timeout) ex.error = getSocketErrno(); throw ex; } - else - { - SocketException ex(__FILE__, __LINE__); - ex.error = getSocketErrno(); - throw ex; - } + + SocketException ex(__FILE__, __LINE__); + ex.error = getSocketErrno(); + throw ex; } else { |