From 60e28c257a3965bd97b910b27d856c9820b0db2f Mon Sep 17 00:00:00 2001
From: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de>
Date: Fri, 10 Jul 2009 16:26:43 +0200
Subject: [PATCH 1/2] More verbose log warnings if ssl certificate is invalid

Signed-off-by: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de>
---
 src/core/sslserver.cpp |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/src/core/sslserver.cpp b/src/core/sslserver.cpp
index aa5be2c..ede37d0 100644
--- a/src/core/sslserver.cpp
+++ b/src/core/sslserver.cpp
@@ -25,6 +25,7 @@
 #endif
 
 #include <QFile>
+#include <QDateTime>
 
 #include "logger.h"
 #include "quassel.h"
@@ -101,7 +102,17 @@ bool SslServer::setCertificate(const QString &path) {
     return false;
   }
   if(!_cert.isValid()) {
-    quWarning() << "SslServer: Invalid certificate";
+    const QDateTime currentTime = QDateTime::currentDateTime();
+
+    if (currentTime > _cert.expiryDate()) {
+      quWarning() << "SslServer: certificate expired";
+      return false;
+    }
+    if (currentTime < _cert.effectiveDate()) {
+      quWarning() << "SslServer: certificate is not valid yet";
+      return false;
+    }
+    quWarning() << "SslServer: Invalid certificate (unknown reason)";
     return false;
   }
   if(_key.isNull()) {
-- 
1.6.3.3

