refactor: new Setting::tlsTrustedClientssDb() method to return trusted client fingerprint db
This commit is contained in:
parent
38f00da704
commit
b051c5ae60
4 changed files with 8 additions and 5 deletions
|
|
@ -1146,8 +1146,7 @@ void MainWindow::setHostName()
|
||||||
QString MainWindow::trustedFingerprintDb()
|
QString MainWindow::trustedFingerprintDb()
|
||||||
{
|
{
|
||||||
const bool isClient = m_coreProcess.mode() == CoreMode::Client;
|
const bool isClient = m_coreProcess.mode() == CoreMode::Client;
|
||||||
const auto trustFile = isClient ? Settings::tlsTrustedServersDb() : kTlsFingerprintTrustedClientsFilename;
|
return isClient ? Settings::tlsTrustedServersDb() : Settings::tlsTrustedClientsDb();
|
||||||
return QStringLiteral("%1/%2").arg(Settings::tlsDir(), trustFile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::regenerateLocalFingerprints()
|
bool MainWindow::regenerateLocalFingerprints()
|
||||||
|
|
|
||||||
|
|
@ -176,6 +176,11 @@ const QString Settings::tlsTrustedServersDb()
|
||||||
return QStringLiteral("%1/%2").arg(instance()->tlsDir(), kTlsFingerprintTrustedServersFilename);
|
return QStringLiteral("%1/%2").arg(instance()->tlsDir(), kTlsFingerprintTrustedServersFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString Settings::tlsTrustedClientsDb()
|
||||||
|
{
|
||||||
|
return QStringLiteral("%1/%2").arg(instance()->tlsDir(), kTlsFingerprintTrustedClientsFilename);
|
||||||
|
}
|
||||||
|
|
||||||
void Settings::setValue(const QString &key, const QVariant &value)
|
void Settings::setValue(const QString &key, const QVariant &value)
|
||||||
{
|
{
|
||||||
if (instance()->m_settings->value(key) == value)
|
if (instance()->m_settings->value(key) == value)
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,7 @@ public:
|
||||||
static const QString tlsDir();
|
static const QString tlsDir();
|
||||||
static const QString tlsLocalDb();
|
static const QString tlsLocalDb();
|
||||||
static const QString tlsTrustedServersDb();
|
static const QString tlsTrustedServersDb();
|
||||||
|
static const QString tlsTrustedClientsDb();
|
||||||
static const QString logLevelText();
|
static const QString logLevelText();
|
||||||
static QSettingsProxy &proxy();
|
static QSettingsProxy &proxy();
|
||||||
static void save(bool emitSaving = true);
|
static void save(bool emitSaving = true);
|
||||||
|
|
|
||||||
|
|
@ -448,9 +448,7 @@ int SecureSocket::secureAccept(int socket)
|
||||||
// If not fatal and no retry, state is good
|
// If not fatal and no retry, state is good
|
||||||
if (retry == 0) {
|
if (retry == 0) {
|
||||||
if (m_securityLevel == SecurityLevel::PeerAuth) {
|
if (m_securityLevel == SecurityLevel::PeerAuth) {
|
||||||
std::string dbDir = deskflow::string::sprintf(
|
std::string dbDir = Settings::tlsTrustedClientsDb().toStdString().c_str();
|
||||||
"%s/%s", Settings::tlsDir().toStdString().c_str(), kTlsFingerprintTrustedClientsFilename
|
|
||||||
);
|
|
||||||
if (!verifyCertFingerprint(dbDir)) {
|
if (!verifyCertFingerprint(dbDir)) {
|
||||||
retry = 0;
|
retry = 0;
|
||||||
disconnect();
|
disconnect();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue