Fix the QSslSocket::setCiphers(const QString &) overload.
The overload used an evil hack to work around a flaw in the QSslCipher API rather than fixing the API. The hack was broken by the addition of support for newer versions of TLS. This change solves the issue properly by fixing the QSslCipher API then using the fixed version. Task-Number: QTBUG-34688 Change-Id: Ibf677c374f837f705395741e730d40d8f912d7c6 Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
This commit is contained in:
parent
861574ebb6
commit
30d199a76c
@ -77,6 +77,26 @@ QSslCipher::QSslCipher()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructs a QSslCipher object for the cipher determined by \a
|
||||
name. The constructor accepts only supported ciphers (i.e., the
|
||||
\a name must identify a cipher in the list of ciphers returned by
|
||||
QSslSocket::supportedCiphers()).
|
||||
|
||||
You can call isNull() after construction to check if \a name
|
||||
correctly identified a supported cipher.
|
||||
*/
|
||||
QSslCipher::QSslCipher(const QString &name)
|
||||
: d(new QSslCipherPrivate)
|
||||
{
|
||||
foreach (const QSslCipher &cipher, QSslSocket::supportedCiphers()) {
|
||||
if (cipher.name() == name) {
|
||||
*this = cipher;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructs a QSslCipher object for the cipher determined by \a
|
||||
name and \a protocol. The constructor accepts only supported
|
||||
|
@ -57,6 +57,7 @@ class Q_NETWORK_EXPORT QSslCipher
|
||||
{
|
||||
public:
|
||||
QSslCipher();
|
||||
QSslCipher(const QString &name);
|
||||
QSslCipher(const QString &name, QSsl::SslProtocol protocol);
|
||||
QSslCipher(const QSslCipher &other);
|
||||
~QSslCipher();
|
||||
|
@ -1195,12 +1195,9 @@ void QSslSocket::setCiphers(const QString &ciphers)
|
||||
Q_D(QSslSocket);
|
||||
d->configuration.ciphers.clear();
|
||||
foreach (const QString &cipherName, ciphers.split(QLatin1String(":"),QString::SkipEmptyParts)) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
// ### Crude
|
||||
QSslCipher cipher(cipherName, QSsl::SslProtocol(i));
|
||||
if (!cipher.isNull())
|
||||
d->configuration.ciphers << cipher;
|
||||
}
|
||||
QSslCipher cipher(cipherName);
|
||||
if (!cipher.isNull())
|
||||
d->configuration.ciphers << cipher;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user