Giter Site home page Giter Site logo

Comments (2)

ycaibb avatar ycaibb commented on July 22, 2024

The situation is similar to the below code on the lock ptmSSLMutex, which is not released when sslContext == NULL, (hSocket < 0) && ((hSocket = medusaConnect(pParams)) < 0), (ssl = SSL_new(sslContext)) == NULL, SSL_connect(ssl) <= 0...

medusa/src/medusa-net.c

Lines 343 to 396 in bdaa2dd

pthread_mutex_lock(&ptmSSLMutex);
SSL_load_error_strings();
SSLeay_add_ssl_algorithms();
/* OpenSSL 1.1.0 introduced TLS_client_method() and deprecated all version specific functions. */
sslContext = SSL_CTX_new(TLS_client_method());
if (sslContext == NULL)
{
err = ERR_get_error();
writeError(ERR_ERROR, "SSL: Error allocating context: %s", ERR_error_string(err, NULL));
return -1;
}
// set the compatbility mode
SSL_CTX_set_options(sslContext, SSL_OP_ALL);
// we set the default verifiers and dont care for the results
SSL_CTX_set_default_verify_paths(sslContext);
SSL_CTX_set_verify(sslContext, SSL_VERIFY_NONE, NULL);
if ((hSocket < 0) && ((hSocket = medusaConnect(pParams)) < 0))
return -1;
if ((ssl = SSL_new(sslContext)) == NULL)
{
err = ERR_get_error();
writeError(ERR_ERROR, "Error preparing an SSL context: %s", ERR_error_string(err, NULL));
return -1;
}
SSL_set_fd(ssl, hSocket);
if (SSL_connect(ssl) <= 0)
{
err = ERR_get_error();
writeError(ERR_ERROR, "Could not create an SSL session: %s", ERR_error_string(err, NULL));
return -1;
}
writeError(ERR_DEBUG, "SSL negotiated cipher: %s", SSL_get_cipher(ssl));
s = malloc(sizeof(struct SSLSOCKETINFO));
memset(s, 0, sizeof(struct SSLSOCKETINFO));
s->id = hSocket;
s->nUseSSL = 1;
s->ssl = ssl;
s->sslContext = sslContext;
HASH_ADD_INT( psSSLSocketInfo, id, s );
pthread_mutex_unlock(&ptmSSLMutex);

from medusa.

ycaibb avatar ycaibb commented on July 22, 2024

Hi, developers @jmk-foofus

Any comments would be highly appreciated. Thank you.

Best Regards,

from medusa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.