refactor: new Setting::tlsTrustedServersDb() method to return trusted server fingerprint db
This commit is contained in:
@ -1146,7 +1146,7 @@ void MainWindow::setHostName()
|
||||
QString MainWindow::trustedFingerprintDb()
|
||||
{
|
||||
const bool isClient = m_coreProcess.mode() == CoreMode::Client;
|
||||
const auto trustFile = isClient ? kTlsFingerprintTrustedServersFilename : kTlsFingerprintTrustedClientsFilename;
|
||||
const auto trustFile = isClient ? Settings::tlsTrustedServersDb() : kTlsFingerprintTrustedClientsFilename;
|
||||
return QStringLiteral("%1/%2").arg(Settings::tlsDir(), trustFile);
|
||||
}
|
||||
|
||||
|
||||
@ -171,6 +171,11 @@ const QString Settings::tlsLocalDb()
|
||||
return QStringLiteral("%1/%2").arg(instance()->tlsDir(), kTlsFingerprintLocalFilename);
|
||||
}
|
||||
|
||||
const QString Settings::tlsTrustedServersDb()
|
||||
{
|
||||
return QStringLiteral("%1/%2").arg(instance()->tlsDir(), kTlsFingerprintTrustedServersFilename);
|
||||
}
|
||||
|
||||
void Settings::setValue(const QString &key, const QVariant &value)
|
||||
{
|
||||
if (instance()->m_settings->value(key) == value)
|
||||
|
||||
@ -143,6 +143,7 @@ public:
|
||||
static const QString settingsPath();
|
||||
static const QString tlsDir();
|
||||
static const QString tlsLocalDb();
|
||||
static const QString tlsTrustedServersDb();
|
||||
static const QString logLevelText();
|
||||
static QSettingsProxy &proxy();
|
||||
static void save(bool emitSaving = true);
|
||||
|
||||
@ -524,9 +524,7 @@ int SecureSocket::secureConnect(int socket)
|
||||
retry = 0;
|
||||
// No error, set ready, process and return ok
|
||||
m_secureReady = true;
|
||||
std::string dbDir = deskflow::string::sprintf(
|
||||
"%s/%s", Settings::tlsDir().toStdString().c_str(), kTlsFingerprintTrustedServersFilename
|
||||
);
|
||||
std::string dbDir = Settings::tlsTrustedServersDb().toStdString().c_str();
|
||||
if (verifyCertFingerprint(dbDir)) {
|
||||
LOG((CLOG_INFO "connected to secure socket"));
|
||||
if (!showCertificate()) {
|
||||
|
||||
Reference in New Issue
Block a user