diff --git a/src/mirall/csyncthread.cpp b/src/mirall/csyncthread.cpp index 4edd9fc7ff..61f0dec8d2 100644 --- a/src/mirall/csyncthread.cpp +++ b/src/mirall/csyncthread.cpp @@ -18,6 +18,7 @@ #include "mirall/theme.h" #include "mirall/logger.h" #include "mirall/utility.h" +#include "mirall/owncloudinfo.h" #ifdef Q_OS_WIN #include @@ -446,11 +447,10 @@ int CSyncThread::getauth(const char *prompt, int pos = 0; - // IF we had a cert ack'ed by the user, it was added to the Qt default - // CA Cert list. So we get the list of certs to check against from - // Qt. - QList certs = QSslSocket::defaultCaCertificates(); + // This is the set of certificates which QNAM accepted, so we should accept + // them as well + QList certs = ownCloudInfo::instance()->certificateChain(); while (!certOk && (pos = regexp.indexIn(qPrompt, 1+pos)) != -1) { QString neon_fingerprint = regexp.cap(1); diff --git a/src/mirall/owncloudinfo.cpp b/src/mirall/owncloudinfo.cpp index d863043ca8..ade98a38aa 100644 --- a/src/mirall/owncloudinfo.cpp +++ b/src/mirall/owncloudinfo.cpp @@ -263,6 +263,11 @@ QString ownCloudInfo::configHandle(QNetworkReply *reply) return configHandle; } +QList ownCloudInfo::certificateChain() const +{ + return _certificateChain; +} + QUrl ownCloudInfo::redirectUrl(const QUrl& possibleRedirectUrl, const QUrl& oldRedirectUrl) const { QUrl redirectUrl; @@ -285,6 +290,9 @@ QUrl ownCloudInfo::redirectUrl(const QUrl& possibleRedirectUrl, void ownCloudInfo::slotReplyFinished() { QNetworkReply *reply = qobject_cast(sender()); + if (reply->header(QNetworkRequest::LocationHeader).toUrl().scheme() == QLatin1String("https")) + _certificateChain = reply->sslConfiguration().peerCertificateChain(); + if( ! reply ) { qDebug() << "ownCloudInfo: Reply empty!"; diff --git a/src/mirall/owncloudinfo.h b/src/mirall/owncloudinfo.h index ada18104f9..28ba1fb5f4 100644 --- a/src/mirall/owncloudinfo.h +++ b/src/mirall/owncloudinfo.h @@ -83,6 +83,12 @@ public: */ QString configHandle(QNetworkReply *reply = 0); + /** + * Certificate chain of the connection est. with ownCloud. + * Empty if the connection is HTTP-based + */ + QList certificateChain() const; + signals: // result signal with url- and version string. void ownCloudInfoFound( const QString&, const QString&, const QString&, const QString& ); @@ -129,6 +135,7 @@ private: QUrl _urlRedirectedTo; QHash _directories; QHash _configHandleMap; + QList _certificateChain; bool _certsUntrusted; int _authAttempts; };