From 28503387ead00f82710ffdc1c415c564479825a9 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Fri, 27 Jul 2018 14:34:32 +0200 Subject: [PATCH] DTLS - treat QSslSocket::UnencryptedMode as invalid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unfortunately, this enum is not 'binary', it also has 'UnencryptedMode' and as a result we can end up with server-side method/context. Change-Id: If2da4c1b9f7e9ff916d933c9517c00a632aea324 Reviewed-by: Edward Welbourne Reviewed-by: MÃ¥rten Nordheim --- src/network/ssl/qdtls_openssl.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/network/ssl/qdtls_openssl.cpp b/src/network/ssl/qdtls_openssl.cpp index 90457c3724..2e5a26d596 100644 --- a/src/network/ssl/qdtls_openssl.cpp +++ b/src/network/ssl/qdtls_openssl.cpp @@ -715,6 +715,12 @@ bool DtlsState::initCtxAndConnection(QDtlsBasePrivate *dtlsBase) Q_ASSERT(dtlsBase); Q_ASSERT(QSslSocket::supportsSsl()); + if (dtlsBase->mode == QSslSocket::UnencryptedMode) { + dtlsBase->setDtlsError(QDtlsError::TlsInitializationError, + QDtls::tr("Invalid SslMode, SslServerMode or SslClientMode expected")); + return false; + } + // create a deep copy of our configuration auto configurationCopy = new QSslConfigurationPrivate(dtlsBase->dtlsConfiguration); configurationCopy->ref.store(0); // the QSslConfiguration constructor refs up