Skip to content

Commit

Permalink
Ignore SSL errors only if the ignoreselfsigned flag is set and the li…
Browse files Browse the repository at this point in the history
…st of errors only

contains errors concerning self signed certificates.
  • Loading branch information
ejvr committed Feb 19, 2017
1 parent cc49169 commit ea08f26
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/mqtt/qmqtt_ssl_socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,17 @@ QAbstractSocket::SocketError QMQTT::SslSocket::error() const

void QMQTT::SslSocket::sslErrors(const QList<QSslError> &errors)
{
Q_UNUSED(errors);

if (_ignoreSelfSigned)
if (!_ignoreSelfSigned)
return;
for (QSslError error: errors)
{
// allow self-signed certificates
_socket->ignoreSslErrors();
if (error.error() != QSslError::SelfSignedCertificate ||
error.error() != QSslError::SelfSignedCertificateInChain)
{
return;
}
}
_socket->ignoreSslErrors();
}

#endif // QT_NO_SSL

0 comments on commit ea08f26

Please sign in to comment.