Skip to content

Commit

Permalink
Merge pull request #2328 from esohns/ssl_cleanups
Browse files Browse the repository at this point in the history
minor SSL code cleanups
  • Loading branch information
jwillemsen authored Feb 10, 2025
2 parents cda98b4 + 11453f6 commit 4d9cfe6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions ACE/ace/SSL/SSL_Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ ACE_SSL_Context::set_mode (int mode)
SSL_METHOD *method = 0;
#endif

/* these openssl macros negotiate highest available SSL/TLS version */
switch (mode)
{
case ACE_SSL_Context::SSLv23_client:
Expand Down
1 change: 1 addition & 0 deletions ACE/ace/SSL/SSL_Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class ACE_SSL_Export ACE_SSL_Context

enum {
INVALID_METHOD = -1,
/* these negotiate highest available SSL/TLS version */
SSLv23_client,
SSLv23_server,
SSLv23
Expand Down
3 changes: 1 addition & 2 deletions ACE/ace/SSL/SSL_SOCK_Stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ ACE_SSL_SOCK_Stream::recvv (iovec *io_vec,
ACE_NEW_RETURN (io_vec->iov_base,
char[inlen],
-1);
io_vec->iov_len = this->recv (io_vec->iov_base,
inlen);
io_vec->iov_len = static_cast<u_long> (this->recv (io_vec->iov_base, inlen));
return io_vec->iov_len;
}
else
Expand Down
12 changes: 6 additions & 6 deletions ACE/ace/SSL/SSL_SOCK_Stream.inl
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,11 @@ ACE_SSL_SOCK_Stream::close ()
switch (::SSL_get_error (this->ssl_, status))
{
case SSL_ERROR_NONE:
case SSL_ERROR_SYSCALL: // Ignore this error condition.

// Reset the SSL object to allow another connection to be made
// using this ACE_SSL_SOCK_Stream instance. This prevents the
// previous SSL session state from being associated with the new
// SSL session/connection.
(void) ::SSL_clear (this->ssl_);
::SSL_clear (this->ssl_);
this->set_handle (ACE_INVALID_HANDLE);
return this->stream_.close ();

Expand All @@ -335,13 +333,15 @@ ACE_SSL_SOCK_Stream::close ()
errno = EWOULDBLOCK;
break;

case SSL_ERROR_SSL:
case SSL_ERROR_SYSCALL:
default:
ACE_SSL_Context::report_error ();

this->set_handle (ACE_INVALID_HANDLE);
ACE_Errno_Guard error (errno); // Save/restore errno
(void) this->stream_.close ();

return -1;
this->stream_.close ();
break;
}

return -1;
Expand Down

0 comments on commit 4d9cfe6

Please sign in to comment.