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.
--- 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);