Hello, I am wrapping an ssl socket using c++ and use a third party library steam implementation. the library I use requires an implementation of a copy constructor. I managed to dup and initialize a simple BIO and then free it as required, but when it comes to SSL struct, thing don't seem to work the same way. BIO code: used in copy constructor: SSLSocketBase& SSLSocketBase::operator=(const SSLSocketBase &sslsock) { if (&sslsock != this) { int fd;
m_bio = BIO_new_socket((fd = dup(BIO_get_fd(sslsock.m_bio, NULL))), 0); BIO_set_fd(m_bio, fd, 0); } return *this; } and the destructor: SSLSocketBase::~SSLSocketBase() { if (m_bio != NULL) { BIO_free(m_bio); m_bio = NULL; } } I am looking for a way to duplicate the SSL struct with all of it's components in order to keep using it without a new handshake. destructor is pretty straight forward, but copy/duplication is trickier. this is what i got so far: SSLSocketSecure& SSLSocketSecure::operator=(const SSLSocketSecure &sslsock) { if (&sslsock != this) { try { static_cast<SSLSocketBase&>(*this) = sslsock; // uses the above operator example SSL_CTX *ctx = SSL_get_SSL_CTX(sslsock.m_ssl); if (!(m_ssl = SSL_new(ctx))) THROW(SocketException, "Error creating SSL context"); SSL_set_bio(m_ssl, m_bio, m_bio); } catch (Exception &e) { std::cerr << e.msg() << std::endl; } } return *this; } I'm lost as to what is missing here. any help would be greatly appreciated. ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]