Browse Source

try to detect if ssl will not work before accepting ssl connections

ps 9 years ago
parent
commit
a34bd2ac7b
2 changed files with 4 additions and 0 deletions
  1. 3 0
      src/Socket.cpp
  2. 1 0
      src/Socket.h

+ 3 - 0
src/Socket.cpp

@@ -169,6 +169,9 @@ void Socket::prepareSSL(bool server)
 
   if(1!=SSL_set_fd(ssl,fd))
     throw Exception(_("Error setting FD"),__FILE__,__LINE__);
+
+  if(0==RAND_status())
+    throw Exception(_("PRNG has not enough data. Are you missing /dev/[u]random?"),__FILE__,__LINE__);
 }
 
 /**

+ 1 - 0
src/Socket.h

@@ -40,6 +40,7 @@
 #include <errno.h>
 #ifdef HAVE_SSL
 #include <openssl/ssl.h>
+#include <openssl/rand.h>
 #endif //HAVE_SSL
 
 //this is a bit of a hack