2016-09-29 21:19:54 +02:00
|
|
|
#include "./syncthingconnectionsettings.h"
|
|
|
|
|
|
|
|
namespace Data {
|
|
|
|
|
|
|
|
bool SyncthingConnectionSettings::loadHttpsCert()
|
|
|
|
{
|
2016-10-02 21:59:28 +02:00
|
|
|
expectedSslErrors.clear();
|
2018-03-29 00:36:42 +02:00
|
|
|
if (httpsCertPath.isEmpty()) {
|
|
|
|
return true;
|
2016-09-29 21:19:54 +02:00
|
|
|
}
|
2018-03-29 00:36:42 +02:00
|
|
|
const auto certs(QSslCertificate::fromPath(httpsCertPath));
|
|
|
|
if (certs.isEmpty()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
const auto &cert(certs.front());
|
|
|
|
// clang-format off
|
|
|
|
expectedSslErrors = {
|
|
|
|
QSslError(QSslError::UnableToGetLocalIssuerCertificate, cert),
|
|
|
|
QSslError(QSslError::UnableToVerifyFirstCertificate, cert),
|
|
|
|
QSslError(QSslError::SelfSignedCertificate, cert),
|
|
|
|
QSslError(QSslError::HostNameMismatch, cert)
|
|
|
|
};
|
|
|
|
// clang-format on
|
2016-09-29 21:19:54 +02:00
|
|
|
return true;
|
|
|
|
}
|
2017-09-17 21:48:15 +02:00
|
|
|
} // namespace Data
|