# HG changeset patch # User Mikael Hallendal # Date 1177862476 -7200 # Node ID 23192c7973c0a231b390a5d2c08f6514ec59d8ab # Parent d372a2b61b1d4d82b7f14be9247c83c80bc707be Check to see that the OpenSSL session is setup correctly. Fixes LM-88. If the SSL Context is not setup correctly the call to SSL_new will fail as well causing SSL_set_bio to segfault. Added a check to see that the context is not NULL and that the session is created properly. diff -r d372a2b61b1d -r 23192c7973c0 loudmouth/lm-ssl-openssl.c --- a/loudmouth/lm-ssl-openssl.c Sun Apr 29 14:16:02 2007 +0200 +++ b/loudmouth/lm-ssl-openssl.c Sun Apr 29 18:01:16 2007 +0200 @@ -180,7 +180,21 @@ BIO *sbio; GIOStatus status; + if (!ssl->ctx) { + g_set_error (error, + LM_ERROR, LM_ERROR_CONNECTION_OPEN, + "No SSL Context for OpenSSL"); + return FALSE; + } + ssl->session = SSL_new (ssl->ctx); + if (ssl->session == NULL) { + g_set_error (error, + LM_ERROR, LM_ERROR_CONNECTION_OPEN, + "Failed to create an SSL session through OpenSSL"); + return FALSE; + } + sbio = BIO_new_socket (fd, BIO_NOCLOSE); SSL_set_bio (ssl->session, sbio, sbio);