mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 21:15:55 +03:00
parent
6110a99afc
commit
bd71fdc388
4 changed files with 38 additions and 8 deletions
|
@ -188,7 +188,7 @@ void SslButton::updateAccountState(AccountState *accountState)
|
|||
if (account->url().scheme() == QLatin1String("https")) {
|
||||
QPixmap pm(Theme::hidpiFileName(":/client/resources/lock-https.png"));
|
||||
setIcon(QIcon(pm));
|
||||
QSslCipher cipher = account->sslConfiguration().sessionCipher();
|
||||
QSslCipher cipher = account->_sessionCipher;
|
||||
setToolTip(tr("This connection is encrypted using %1 bit %2.\n").arg(cipher.usedBits()).arg(cipher.name()));
|
||||
setMenu(_menu);
|
||||
} else {
|
||||
|
@ -208,19 +208,19 @@ void SslButton::slotUpdateMenu() {
|
|||
AccountPtr account = _accountState->account();
|
||||
|
||||
if (account->url().scheme() == QLatin1String("https")) {
|
||||
QString sslVersion = account->sslConfiguration().sessionCipher().protocolString()
|
||||
+ ", " + account->sslConfiguration().sessionCipher().authenticationMethod()
|
||||
+ ", " + account->sslConfiguration().sessionCipher().keyExchangeMethod()
|
||||
+ ", " + account->sslConfiguration().sessionCipher().encryptionMethod();
|
||||
QString sslVersion = account->_sessionCipher.protocolString()
|
||||
+ ", " + account->_sessionCipher.authenticationMethod()
|
||||
+ ", " + account->_sessionCipher.keyExchangeMethod()
|
||||
+ ", " + account->_sessionCipher.encryptionMethod();
|
||||
_menu->addAction(sslVersion)->setEnabled(false);
|
||||
|
||||
#if QT_VERSION > QT_VERSION_CHECK(5, 2, 0)
|
||||
if (account->sslConfiguration().sessionTicket().isEmpty()) {
|
||||
if (account->_sessionTicket.isEmpty()) {
|
||||
_menu->addAction(tr("No support for SSL session tickets/identifiers"))->setEnabled(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
QList<QSslCertificate> chain = account->sslConfiguration().peerCertificateChain();
|
||||
QList<QSslCertificate> chain = account->_peerCertificateChain;
|
||||
|
||||
if (chain.isEmpty()) {
|
||||
qWarning() << "empty certificate chain";
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <QSslSocket>
|
||||
#include <QSslCertificate>
|
||||
#include <QSslConfiguration>
|
||||
#include <QSslCipher>
|
||||
#include <QSslError>
|
||||
#include <QSharedPointer>
|
||||
#include "utility.h"
|
||||
|
@ -111,6 +112,12 @@ public:
|
|||
QSslConfiguration getOrCreateSslConfig();
|
||||
QSslConfiguration sslConfiguration() const { return _sslConfiguration; }
|
||||
void setSslConfiguration(const QSslConfiguration &config);
|
||||
// Because of bugs in Qt, we use this to store info needed for the SSL Button
|
||||
QSslCipher _sessionCipher;
|
||||
QByteArray _sessionTicket;
|
||||
QList<QSslCertificate> _peerCertificateChain;
|
||||
|
||||
|
||||
/** The certificates of the account */
|
||||
QList<QSslCertificate> approvedCerts() const { return _approvedCerts; }
|
||||
void setApprovedCerts(const QList<QSslCertificate> certs);
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <QNetworkReply>
|
||||
#include <QNetworkRequest>
|
||||
#include <QSslConfiguration>
|
||||
#include <QSslCipher>
|
||||
#include <QBuffer>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QStringList>
|
||||
|
@ -362,6 +363,7 @@ void CheckServerJob::start()
|
|||
setReply(getRequest(path()));
|
||||
setupConnections(reply());
|
||||
connect(reply(), SIGNAL(metaDataChanged()), this, SLOT(metaDataChangedSlot()));
|
||||
connect(reply(), SIGNAL(encrypted()), this, SLOT(encryptedSlot()));
|
||||
AbstractNetworkJob::start();
|
||||
}
|
||||
|
||||
|
@ -391,10 +393,28 @@ bool CheckServerJob::installed(const QVariantMap &info)
|
|||
return info.value(QLatin1String("installed")).toBool();
|
||||
}
|
||||
|
||||
static void mergeSslConfigurationForSslButton(const QSslConfiguration &config, AccountPtr account)
|
||||
{
|
||||
if (config.peerCertificateChain().length() > 0) {
|
||||
account->_peerCertificateChain = config.peerCertificateChain();
|
||||
}
|
||||
if (!config.sessionCipher().isNull()) {
|
||||
account->_sessionCipher = config.sessionCipher();
|
||||
}
|
||||
if (config.sessionTicket().length() > 0) {
|
||||
account->_sessionTicket = config.sessionTicket();
|
||||
}
|
||||
}
|
||||
|
||||
void CheckServerJob::encryptedSlot()
|
||||
{
|
||||
mergeSslConfigurationForSslButton(reply()->sslConfiguration(), account());
|
||||
}
|
||||
|
||||
void CheckServerJob::metaDataChangedSlot()
|
||||
{
|
||||
// We used to have this in finished(), but because of a bug in Qt this did not always have the cipher etc.
|
||||
account()->setSslConfiguration(reply()->sslConfiguration());
|
||||
mergeSslConfigurationForSslButton(reply()->sslConfiguration(), account());
|
||||
}
|
||||
|
||||
|
||||
|
@ -408,6 +428,8 @@ bool CheckServerJob::finished()
|
|||
}
|
||||
#endif
|
||||
|
||||
mergeSslConfigurationForSslButton(reply()->sslConfiguration(), account());
|
||||
|
||||
// The serverInstalls to /owncloud. Let's try that if the file wasn't found
|
||||
// at the original location
|
||||
if ((reply()->error() == QNetworkReply::ContentNotFoundError) && (!_subdirFallback)) {
|
||||
|
|
|
@ -167,6 +167,7 @@ private slots:
|
|||
virtual bool finished() Q_DECL_OVERRIDE;
|
||||
virtual void slotTimeout() Q_DECL_OVERRIDE;
|
||||
virtual void metaDataChangedSlot();
|
||||
virtual void encryptedSlot();
|
||||
|
||||
private:
|
||||
bool _subdirFallback;
|
||||
|
|
Loading…
Reference in a new issue