From c45d822706b8e638b65bc8b57b18aaf0555d6e05 Mon Sep 17 00:00:00 2001 From: Joshua T Corbin Date: Thu, 8 Jan 2009 18:52:54 -0500 Subject: [PATCH] More obvious logic in SslServer::setCertificate. --- src/core/sslserver.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/sslserver.cpp b/src/core/sslserver.cpp index 203ec761..570957da 100644 --- a/src/core/sslserver.cpp +++ b/src/core/sslserver.cpp @@ -60,6 +60,8 @@ void SslServer::incomingConnection(int socketDescriptor) { } bool SslServer::setCertificate(const QString &path) { + _certIsValid = false; + QFile certFile(path); certFile.open(QIODevice::ReadOnly); _cert = QSslCertificate(&certFile); @@ -69,11 +71,12 @@ bool SslServer::setCertificate(const QString &path) { _key = QSslKey(&certFile, QSsl::Rsa); certFile.close(); - _certIsValid = !_cert.isNull() && _cert.isValid() && !_key.isNull(); - if(!_certIsValid) { + if(_cert.isNull() || !_cert.isValid() || _key.isNull()) { qWarning() << "SslServer: SSL Certificate is either missing or has a wrong format!\n" << " Quassel Core will still work, but cannot provide SSL for client connections.\n" << " Please see http://quassel-irc.org/faq/cert to learn how to enable SSL support."; + } else { + _certIsValid = true; } return _certIsValid; -- 2.20.1