From a34bd2ac7ba6d9f8345296d6a88572ae82c56b95 Mon Sep 17 00:00:00 2001 From: ps Date: Mon, 3 Oct 2011 20:31:47 +0000 Subject: [PATCH] try to detect if ssl will not work before accepting ssl connections --- src/Socket.cpp | 3 +++ src/Socket.h | 1 + 2 files changed, 4 insertions(+) diff --git a/src/Socket.cpp b/src/Socket.cpp index 288732d..73888e3 100644 --- a/src/Socket.cpp +++ b/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__); } /** diff --git a/src/Socket.h b/src/Socket.h index 1313c93..453fb86 100644 --- a/src/Socket.h +++ b/src/Socket.h @@ -40,6 +40,7 @@ #include #ifdef HAVE_SSL #include +#include #endif //HAVE_SSL //this is a bit of a hack