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.
Fix for LM1.2 by Mikael Hallendal, forward-ported to LM1.3 by Senko Rasic.
--- a/loudmouth/lm-ssl-openssl.c Tue Oct 30 23:27:30 2007 +0100
+++ b/loudmouth/lm-ssl-openssl.c Tue Oct 30 23:36:44 2007 +0100
@@ -321,6 +321,13 @@
gint ssl_ret;
GIOStatus status;
+ if (!ssl->ssl_ctx) {
+ g_set_error (error,
+ LM_ERROR, LM_ERROR_CONNECTION_OPEN,
+ "No SSL Context for OpenSSL");
+ return FALSE;
+ }
+
ssl->ssl = SSL_new(ssl->ssl_ctx);
if (ssl->ssl == NULL) {
g_warning ("SSL_new() == NULL");