X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fclientauthhandler.cpp;h=469299fd457db8eb7d85962bd5077a525ab03578;hp=44743ae8210e5e9c8a12f7d894354f00bf064008;hb=c0d6dc0dec628f2e143e37ecc95cec45e636f8a5;hpb=b62292bbe3f21887dc5ee4353ca9cf675f9aa3f3 diff --git a/src/client/clientauthhandler.cpp b/src/client/clientauthhandler.cpp index 44743ae8..469299fd 100644 --- a/src/client/clientauthhandler.cpp +++ b/src/client/clientauthhandler.cpp @@ -384,13 +384,11 @@ void ClientAuthHandler::checkAndEnableSsl(bool coreSupportsSsl) // Make sure the warning is shown next time we don't have SSL in the core s.setAccountValue("ShowNoCoreSslWarning", true); - auto* sslSocket = qobject_cast(socket()); - Q_ASSERT(sslSocket); - connect(sslSocket, &QSslSocket::encrypted, this, &ClientAuthHandler::onSslSocketEncrypted); - connect(sslSocket, selectOverload&>(&QSslSocket::sslErrors), this, &ClientAuthHandler::onSslErrors); + connect(socket(), &QSslSocket::encrypted, this, &ClientAuthHandler::onSslSocketEncrypted); + connect(socket(), selectOverload&>(&QSslSocket::sslErrors), this, &ClientAuthHandler::onSslErrors); qDebug() << "Starting encryption..."; - sslSocket->flush(); - sslSocket->startClientEncryption(); + socket()->flush(); + socket()->startClientEncryption(); } else { if (s.accountValue("ShowNoCoreSslWarning", true).toBool()) { @@ -435,9 +433,6 @@ void ClientAuthHandler::onSslSocketEncrypted() void ClientAuthHandler::onSslErrors() { - auto* socket = qobject_cast(sender()); - Q_ASSERT(socket); - CoreAccountSettings s; QByteArray knownDigest = s.accountValue("SslCert").toByteArray(); ClientAuthHandler::DigestVersion knownDigestVersion = static_cast( @@ -446,11 +441,11 @@ void ClientAuthHandler::onSslErrors() QByteArray calculatedDigest; switch (knownDigestVersion) { case ClientAuthHandler::DigestVersion::Md5: - calculatedDigest = socket->peerCertificate().digest(QCryptographicHash::Md5); + calculatedDigest = socket()->peerCertificate().digest(QCryptographicHash::Md5); break; case ClientAuthHandler::DigestVersion::Sha2_512: - calculatedDigest = socket->peerCertificate().digest(QCryptographicHash::Sha512); + calculatedDigest = socket()->peerCertificate().digest(QCryptographicHash::Sha512); break; default: @@ -460,7 +455,7 @@ void ClientAuthHandler::onSslErrors() if (knownDigest != calculatedDigest) { bool accepted = false; bool permanently = false; - emit handleSslErrors(socket, &accepted, &permanently); + emit handleSslErrors(socket(), &accepted, &permanently); if (!accepted) { requestDisconnect(tr("Unencrypted connection canceled")); @@ -468,7 +463,7 @@ void ClientAuthHandler::onSslErrors() } if (permanently) { - s.setAccountValue("SslCert", socket->peerCertificate().digest(QCryptographicHash::Sha512)); + s.setAccountValue("SslCert", socket()->peerCertificate().digest(QCryptographicHash::Sha512)); s.setAccountValue("SslCertDigestVersion", ClientAuthHandler::DigestVersion::Latest); } else { @@ -477,9 +472,9 @@ void ClientAuthHandler::onSslErrors() } } else if (knownDigestVersion != ClientAuthHandler::DigestVersion::Latest) { - s.setAccountValue("SslCert", socket->peerCertificate().digest(QCryptographicHash::Sha512)); + s.setAccountValue("SslCert", socket()->peerCertificate().digest(QCryptographicHash::Sha512)); s.setAccountValue("SslCertDigestVersion", ClientAuthHandler::DigestVersion::Latest); } - socket->ignoreSslErrors(); + socket()->ignoreSslErrors(); }