mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 23:28:14 +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")) {
|
if (account->url().scheme() == QLatin1String("https")) {
|
||||||
QPixmap pm(Theme::hidpiFileName(":/client/resources/lock-https.png"));
|
QPixmap pm(Theme::hidpiFileName(":/client/resources/lock-https.png"));
|
||||||
setIcon(QIcon(pm));
|
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()));
|
setToolTip(tr("This connection is encrypted using %1 bit %2.\n").arg(cipher.usedBits()).arg(cipher.name()));
|
||||||
setMenu(_menu);
|
setMenu(_menu);
|
||||||
} else {
|
} else {
|
||||||
|
@ -208,19 +208,19 @@ void SslButton::slotUpdateMenu() {
|
||||||
AccountPtr account = _accountState->account();
|
AccountPtr account = _accountState->account();
|
||||||
|
|
||||||
if (account->url().scheme() == QLatin1String("https")) {
|
if (account->url().scheme() == QLatin1String("https")) {
|
||||||
QString sslVersion = account->sslConfiguration().sessionCipher().protocolString()
|
QString sslVersion = account->_sessionCipher.protocolString()
|
||||||
+ ", " + account->sslConfiguration().sessionCipher().authenticationMethod()
|
+ ", " + account->_sessionCipher.authenticationMethod()
|
||||||
+ ", " + account->sslConfiguration().sessionCipher().keyExchangeMethod()
|
+ ", " + account->_sessionCipher.keyExchangeMethod()
|
||||||
+ ", " + account->sslConfiguration().sessionCipher().encryptionMethod();
|
+ ", " + account->_sessionCipher.encryptionMethod();
|
||||||
_menu->addAction(sslVersion)->setEnabled(false);
|
_menu->addAction(sslVersion)->setEnabled(false);
|
||||||
|
|
||||||
#if QT_VERSION > QT_VERSION_CHECK(5, 2, 0)
|
#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);
|
_menu->addAction(tr("No support for SSL session tickets/identifiers"))->setEnabled(false);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QList<QSslCertificate> chain = account->sslConfiguration().peerCertificateChain();
|
QList<QSslCertificate> chain = account->_peerCertificateChain;
|
||||||
|
|
||||||
if (chain.isEmpty()) {
|
if (chain.isEmpty()) {
|
||||||
qWarning() << "empty certificate chain";
|
qWarning() << "empty certificate chain";
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <QSslSocket>
|
#include <QSslSocket>
|
||||||
#include <QSslCertificate>
|
#include <QSslCertificate>
|
||||||
#include <QSslConfiguration>
|
#include <QSslConfiguration>
|
||||||
|
#include <QSslCipher>
|
||||||
#include <QSslError>
|
#include <QSslError>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
#include "utility.h"
|
#include "utility.h"
|
||||||
|
@ -111,6 +112,12 @@ public:
|
||||||
QSslConfiguration getOrCreateSslConfig();
|
QSslConfiguration getOrCreateSslConfig();
|
||||||
QSslConfiguration sslConfiguration() const { return _sslConfiguration; }
|
QSslConfiguration sslConfiguration() const { return _sslConfiguration; }
|
||||||
void setSslConfiguration(const QSslConfiguration &config);
|
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 */
|
/** The certificates of the account */
|
||||||
QList<QSslCertificate> approvedCerts() const { return _approvedCerts; }
|
QList<QSslCertificate> approvedCerts() const { return _approvedCerts; }
|
||||||
void setApprovedCerts(const QList<QSslCertificate> certs);
|
void setApprovedCerts(const QList<QSslCertificate> certs);
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
#include <QSslConfiguration>
|
#include <QSslConfiguration>
|
||||||
|
#include <QSslCipher>
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
#include <QXmlStreamReader>
|
#include <QXmlStreamReader>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
@ -362,6 +363,7 @@ void CheckServerJob::start()
|
||||||
setReply(getRequest(path()));
|
setReply(getRequest(path()));
|
||||||
setupConnections(reply());
|
setupConnections(reply());
|
||||||
connect(reply(), SIGNAL(metaDataChanged()), this, SLOT(metaDataChangedSlot()));
|
connect(reply(), SIGNAL(metaDataChanged()), this, SLOT(metaDataChangedSlot()));
|
||||||
|
connect(reply(), SIGNAL(encrypted()), this, SLOT(encryptedSlot()));
|
||||||
AbstractNetworkJob::start();
|
AbstractNetworkJob::start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,10 +393,28 @@ bool CheckServerJob::installed(const QVariantMap &info)
|
||||||
return info.value(QLatin1String("installed")).toBool();
|
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()
|
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());
|
account()->setSslConfiguration(reply()->sslConfiguration());
|
||||||
|
mergeSslConfigurationForSslButton(reply()->sslConfiguration(), account());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -408,6 +428,8 @@ bool CheckServerJob::finished()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
mergeSslConfigurationForSslButton(reply()->sslConfiguration(), account());
|
||||||
|
|
||||||
// The serverInstalls to /owncloud. Let's try that if the file wasn't found
|
// The serverInstalls to /owncloud. Let's try that if the file wasn't found
|
||||||
// at the original location
|
// at the original location
|
||||||
if ((reply()->error() == QNetworkReply::ContentNotFoundError) && (!_subdirFallback)) {
|
if ((reply()->error() == QNetworkReply::ContentNotFoundError) && (!_subdirFallback)) {
|
||||||
|
|
|
@ -167,6 +167,7 @@ private slots:
|
||||||
virtual bool finished() Q_DECL_OVERRIDE;
|
virtual bool finished() Q_DECL_OVERRIDE;
|
||||||
virtual void slotTimeout() Q_DECL_OVERRIDE;
|
virtual void slotTimeout() Q_DECL_OVERRIDE;
|
||||||
virtual void metaDataChangedSlot();
|
virtual void metaDataChangedSlot();
|
||||||
|
virtual void encryptedSlot();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _subdirFallback;
|
bool _subdirFallback;
|
||||||
|
|
Loading…
Reference in a new issue